3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-12-18 04:20:08 +01:00
Paper/nms-patches/EntityRabbit.patch

42 Zeilen
2.1 KiB
Diff

2015-05-25 12:37:24 +02:00
--- a/net/minecraft/server/EntityRabbit.java
+++ b/net/minecraft/server/EntityRabbit.java
2016-05-10 13:47:39 +02:00
@@ -16,8 +16,14 @@
2016-02-29 22:32:46 +01:00
this.setSize(0.4F, 0.5F);
2015-02-26 23:41:06 +01:00
this.g = new EntityRabbit.ControllerJumpRabbit(this);
this.moveController = new EntityRabbit.ControllerMoveRabbit(this);
2014-12-06 22:45:51 +01:00
+ this.initializePathFinderGoals(); // CraftBukkit - moved code
+ }
2015-02-26 23:41:06 +01:00
+
2014-12-06 22:45:51 +01:00
+ // CraftBukkit start - code from constructor
+ public void initializePathFinderGoals(){
2016-02-29 22:32:46 +01:00
this.c(0.0D);
2014-12-06 22:45:51 +01:00
}
+ // CraftBukkit end
2016-02-29 22:32:46 +01:00
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));
}