craftbukkit/nms-patches/net/minecraft/world/entity/animal/EntityRabbit.patch

42 lines
1.9 KiB
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/entity/animal/EntityRabbit.java
+++ b/net/minecraft/world/entity/animal/EntityRabbit.java
2022-12-08 03:00:00 +11:00
@@ -88,8 +88,14 @@
2019-04-23 12:00:00 +10:00
super(entitytypes, world);
2021-06-11 15:00:00 +10:00
this.jumpControl = new EntityRabbit.ControllerJumpRabbit(this);
this.moveControl = new EntityRabbit.ControllerMoveRabbit(this);
2014-12-06 22:45:51 +01:00
+ this.initializePathFinderGoals(); // CraftBukkit - moved code
+ }
2015-02-26 22:41:06 +00:00
+
2014-12-06 22:45:51 +01:00
+ // CraftBukkit start - code from constructor
+ public void initializePathFinderGoals(){
2021-11-22 09:00:00 +11:00
this.setSpeedModifier(0.0D);
2014-12-06 22:45:51 +01:00
}
+ // CraftBukkit end
2019-04-23 12:00:00 +10:00
@Override
2021-11-22 09:00:00 +11:00
public void registerGoals() {
2023-06-08 01:30:00 +10:00
@@ -576,9 +582,23 @@
2021-11-22 09:00:00 +11:00
int i = (Integer) iblockdata.getValue(BlockCarrots.AGE);
2021-06-11 15:00:00 +10:00
if (i == 0) {
+ // CraftBukkit start
2021-11-22 09:00:00 +11:00
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.rabbit, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
2021-11-22 09:00:00 +11:00
world.setBlock(blockposition, Blocks.AIR.defaultBlockState(), 2);
world.destroyBlock(blockposition, true, this.rabbit);
} else {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(
2021-06-11 15:00:00 +10:00
+ this.rabbit,
2016-07-08 11:12:40 +10:00
+ blockposition,
2021-11-22 09:00:00 +11:00
+ iblockdata.setValue(BlockCarrots.AGE, i - 1)
+ ).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
2021-11-22 09:00:00 +11:00
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockCarrots.AGE, i - 1), 2);
world.levelEvent(2001, blockposition, Block.getId(iblockdata));
}