3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-16 13:00:06 +01:00
Paper/nms-patches/EntityRabbit.patch
2018-12-13 11:00:00 +11:00

42 Zeilen
1.9 KiB
Diff

--- a/net/minecraft/server/EntityRabbit.java
+++ b/net/minecraft/server/EntityRabbit.java
@@ -17,8 +17,14 @@
this.setSize(0.4F, 0.5F);
this.h = new EntityRabbit.ControllerJumpRabbit(this);
this.moveController = new EntityRabbit.ControllerMoveRabbit(this);
+ this.initializePathFinderGoals(); // CraftBukkit - moved code
+ }
+
+ // CraftBukkit start - code from constructor
+ public void initializePathFinderGoals(){
this.c(0.0D);
}
+ // CraftBukkit end
protected void n() {
this.goalSelector.a(1, new PathfinderGoalFloat(this));
@@ -393,9 +399,23 @@
Integer integer = (Integer) iblockdata.get(BlockCarrots.AGE);
if (integer == 0) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.entity, 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(
+ this.entity,
+ blockposition,
+ iblockdata.set(BlockCarrots.AGE, integer - 1)
+ ).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setTypeAndData(blockposition, (IBlockData) iblockdata.set(BlockCarrots.AGE, integer - 1), 2);
world.triggerEffect(2001, blockposition, Block.getCombinedId(iblockdata));
}