mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-09 11:44:19 +01:00
SPIGOT-1405: Call EntityChangeBlockEvent for Rabbits eating Carrots
By: md_5 <git@md-5.net>
This commit is contained in:
parent
dc3f10a9a0
commit
a9a318835b
1 changed files with 24 additions and 0 deletions
|
@ -15,3 +15,27 @@
|
|||
|
||||
protected void r() {
|
||||
this.goalSelector.a(1, new PathfinderGoalFloat(this));
|
||||
@@ -412,9 +418,23 @@
|
||||
Integer integer = (Integer) iblockdata.get(BlockCarrots.AGE);
|
||||
|
||||
if (integer.intValue() == 0) {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.c, blockposition.getX(), blockposition.getY(), blockposition.getZ(), Blocks.AIR, 0).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, Blocks.AIR.getBlockData(), 2);
|
||||
world.setAir(blockposition, true);
|
||||
} else {
|
||||
+ // CraftBukkit start
|
||||
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(
|
||||
+ this.c,
|
||||
+ blockposition.getX(), blockposition.getY(), blockposition.getZ(),
|
||||
+ block, block.toLegacyData(iblockdata.set(BlockCarrots.AGE, Integer.valueOf(integer.intValue() - 1)))
|
||||
+ ).isCancelled()) {
|
||||
+ return;
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
world.setTypeAndData(blockposition, iblockdata.set(BlockCarrots.AGE, Integer.valueOf(integer.intValue() - 1)), 2);
|
||||
world.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue