Files
CatServer/patches/net/minecraft/entity/passive/EntityRabbit.java.patch
2018-09-08 17:51:33 +08:00

43 lines
2.1 KiB
Diff

--- ../src-base/minecraft/net/minecraft/entity/passive/EntityRabbit.java
+++ ../src-work/minecraft/net/minecraft/entity/passive/EntityRabbit.java
@@ -68,8 +68,13 @@
this.setSize(0.4F, 0.5F);
this.jumpHelper = new EntityRabbit.RabbitJumpHelper(this);
this.moveHelper = new EntityRabbit.RabbitMoveHelper(this);
+ this.initializePathFinderGoals(); // CraftBukkit - moved code
+ }
+ // CraftBukkit start - code from constructor
+ public void initializePathFinderGoals(){
this.setMovementSpeed(0.0D);
}
+ // CraftBukkit end
protected void initEntityAI()
{
@@ -590,11 +595,25 @@
if (integer.intValue() == 0)
{
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.rabbit, blockpos, Blocks.AIR, 0).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setBlockState(blockpos, Blocks.AIR.getDefaultState(), 2);
world.destroyBlock(blockpos, true);
}
else
{
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(
+ this.rabbit,
+ blockpos,
+ block, block.getMetaFromState(iblockstate.withProperty(BlockCarrot.AGE, Integer.valueOf(integer.intValue() - 1)))
+ ).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setBlockState(blockpos, iblockstate.withProperty(BlockCarrot.AGE, Integer.valueOf(integer.intValue() - 1)), 2);
world.playEvent(2001, blockpos, Block.getStateId(iblockstate));
}