Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
First in additional events: AnimalTameEvent.
- Loading branch information
1 parent
d58bf4b
commit 53062a8
Showing
5 changed files
with
81 additions
and
4 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
CraftTweaker2-API/src/main/java/crafttweaker/api/event/AnimalTameEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package crafttweaker.api.event; | ||
|
||
import crafttweaker.annotations.ZenRegister; | ||
import crafttweaker.api.entity.IEntityAnimal; | ||
import crafttweaker.api.player.IPlayer; | ||
import stanhebben.zenscript.annotations.ZenClass; | ||
import stanhebben.zenscript.annotations.ZenGetter; | ||
|
||
/** | ||
* @author Noob | ||
*/ | ||
@ZenClass("crafttweaker.event.AnimalTameEvent") | ||
@ZenRegister | ||
public interface AnimalTameEvent extends IEventCancelable, IPlayerEvent { | ||
@ZenGetter("animal") | ||
IEntityAnimal getAnimal(); | ||
|
||
@ZenGetter("tamer") | ||
IPlayer getPlayer(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
...ker2-MC1120-Main/src/main/java/crafttweaker/mc1120/events/handling/MCAnimalTameEvent.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package crafttweaker.mc1120.events.handling; | ||
|
||
import crafttweaker.api.entity.IEntityAnimal; | ||
import crafttweaker.api.event.AnimalTameEvent; | ||
import crafttweaker.api.minecraft.CraftTweakerMC; | ||
import crafttweaker.api.player.IPlayer; | ||
|
||
public class MCAnimalTameEvent implements AnimalTameEvent { | ||
private final net.minecraftforge.event.entity.living.AnimalTameEvent event; | ||
|
||
public MCAnimalTameEvent(net.minecraftforge.event.entity.living.AnimalTameEvent event) { | ||
this.event = event; | ||
} | ||
|
||
@Override | ||
public IEntityAnimal getAnimal() { | ||
return CraftTweakerMC.getIEntityAnimal(event.getAnimal()); | ||
} | ||
|
||
@Override | ||
public IPlayer getPlayer() { | ||
return CraftTweakerMC.getIPlayer(event.getTamer()); | ||
} | ||
|
||
@Override | ||
public boolean isCanceled() { | ||
return event.isCanceled(); | ||
} | ||
|
||
@Override | ||
public void setCanceled(boolean canceled) { | ||
event.setCanceled(canceled); | ||
} | ||
} |