Paper/nms-patches/EntityRabbit.patch

42 lines
2.0 KiB
Diff
Raw Normal View History

2015-05-25 18:37:24 +08:00
--- a/net/minecraft/server/EntityRabbit.java
+++ b/net/minecraft/server/EntityRabbit.java
2018-07-15 08:00:00 +08:00
@@ -17,8 +17,14 @@
2016-03-01 05:32:46 +08:00
this.setSize(0.4F, 0.5F);
2018-07-15 08:00:00 +08:00
this.h = new EntityRabbit.ControllerJumpRabbit(this);
2015-02-27 06:41:06 +08:00
this.moveController = new EntityRabbit.ControllerMoveRabbit(this);
2014-12-07 05:45:51 +08:00
+ this.initializePathFinderGoals(); // CraftBukkit - moved code
+ }
2015-02-27 06:41:06 +08:00
+
2014-12-07 05:45:51 +08:00
+ // CraftBukkit start - code from constructor
+ public void initializePathFinderGoals(){
2016-03-01 05:32:46 +08:00
this.c(0.0D);
2014-12-07 05:45:51 +08:00
}
+ // CraftBukkit end
2018-07-15 08:00:00 +08:00
protected void n() {
2016-03-01 05:32:46 +08:00
this.goalSelector.a(1, new PathfinderGoalFloat(this));
2018-07-15 08:00:00 +08:00
@@ -397,9 +403,23 @@
Integer integer = (Integer) iblockdata.get(BlockCarrots.AGE);
if (integer.intValue() == 0) {
+ // CraftBukkit start
2018-07-15 08:00:00 +08:00
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.f, blockposition, Blocks.AIR.getBlockData()).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(
2018-07-15 08:00:00 +08:00
+ this.f,
2016-07-08 09:12:40 +08:00
+ blockposition,
2018-07-15 08:00:00 +08:00
+ iblockdata.set(BlockCarrots.AGE, Integer.valueOf(integer.intValue() - 1))
+ ).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
2018-07-15 08:00:00 +08:00
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockCarrots.AGE, Integer.valueOf(integer.intValue() - 1)), 2);
world.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata));
}