PaperMC/paper-server/nms-patches/net/minecraft/world/entity/animal/EntityRabbit.patch
CraftBukkit/Spigot 9d740b84b0 Update to Minecraft 1.20
By: md_5 <git@md-5.net>
2023-06-08 01:30:00 +10:00

41 lines
1.9 KiB
Diff

--- a/net/minecraft/world/entity/animal/EntityRabbit.java
+++ b/net/minecraft/world/entity/animal/EntityRabbit.java
@@ -88,8 +88,14 @@
super(entitytypes, world);
this.jumpControl = new EntityRabbit.ControllerJumpRabbit(this);
this.moveControl = new EntityRabbit.ControllerMoveRabbit(this);
+ this.initializePathFinderGoals(); // CraftBukkit - moved code
+ }
+
+ // CraftBukkit start - code from constructor
+ public void initializePathFinderGoals(){
this.setSpeedModifier(0.0D);
}
+ // CraftBukkit end
@Override
public void registerGoals() {
@@ -576,9 +582,23 @@
int i = (Integer) iblockdata.getValue(BlockCarrots.AGE);
if (i == 0) {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.rabbit, blockposition, Blocks.AIR.defaultBlockState()).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setBlock(blockposition, Blocks.AIR.defaultBlockState(), 2);
world.destroyBlock(blockposition, true, this.rabbit);
} else {
+ // CraftBukkit start
+ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(
+ this.rabbit,
+ blockposition,
+ iblockdata.setValue(BlockCarrots.AGE, i - 1)
+ ).isCancelled()) {
+ return;
+ }
+ // CraftBukkit end
world.setBlock(blockposition, (IBlockData) iblockdata.setValue(BlockCarrots.AGE, i - 1), 2);
world.levelEvent(2001, blockposition, Block.getId(iblockdata));
}