diff options
Diffstat (limited to 'patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Rabbit.java.patch')
-rw-r--r-- | patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Rabbit.java.patch | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Rabbit.java.patch b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Rabbit.java.patch new file mode 100644 index 0000000000..9808520a10 --- /dev/null +++ b/patch-remap/mache-vineflower-stripped/net/minecraft/world/entity/animal/Rabbit.java.patch @@ -0,0 +1,40 @@ +--- a/net/minecraft/world/entity/animal/Rabbit.java ++++ b/net/minecraft/world/entity/animal/Rabbit.java +@@ -66,6 +66,9 @@ + import net.minecraft.world.level.gameevent.GameEvent; + import net.minecraft.world.level.pathfinder.Path; + import net.minecraft.world.phys.Vec3; ++// CraftBukkit start ++import org.bukkit.craftbukkit.event.CraftEventFactory; ++// CraftBukkit end + + public class Rabbit extends Animal implements VariantHolder<Rabbit.Variant> { + public static final double STROLL_SPEED_MOD = 0.6; +@@ -571,12 +579,22 @@ + if (this.canRaid && block instanceof CarrotBlock) { + int i = blockState.getValue(CarrotBlock.AGE); + if (i == 0) { +- level.setBlock(blockPos, Blocks.AIR.defaultBlockState(), 2); +- level.destroyBlock(blockPos, true, this.rabbit); ++ // CraftBukkit start ++ if (!CraftEventFactory.callEntityChangeBlockEvent(this.rabbit, blockposition, Blocks.AIR.defaultBlockState())) { ++ return; ++ } ++ // CraftBukkit end ++ world.setBlock(blockposition, Blocks.AIR.defaultBlockState(), 2); ++ world.destroyBlock(blockposition, true, this.rabbit); + } else { +- level.setBlock(blockPos, blockState.setValue(CarrotBlock.AGE, Integer.valueOf(i - 1)), 2); +- level.gameEvent(GameEvent.BLOCK_CHANGE, blockPos, GameEvent.Context.of(this.rabbit)); +- level.levelEvent(2001, blockPos, Block.getId(blockState)); ++ // CraftBukkit start ++ if (!CraftEventFactory.callEntityChangeBlockEvent(this.rabbit, blockposition, iblockdata.setValue(CarrotBlock.AGE, i - 1))) { ++ return; ++ } ++ // CraftBukkit end ++ world.setBlock(blockposition, (IBlockData) iblockdata.setValue(CarrotBlock.AGE, i - 1), 2); ++ world.gameEvent(GameEvent.BLOCK_CHANGE, blockposition, GameEvent.Context.of((Entity) this.rabbit)); ++ world.levelEvent(2001, blockposition, Block.getId(iblockdata)); + } + + this.rabbit.moreCarrotTicks = 40; |