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

36 lines
1.9 KiB
Diff
Raw Normal View History

2021-03-16 09:00:00 +11:00
--- a/net/minecraft/world/entity/animal/EntityTurtle.java
+++ b/net/minecraft/world/entity/animal/EntityTurtle.java
2021-11-22 09:00:00 +11:00
@@ -311,7 +311,9 @@
protected void ageBoundaryReached() {
super.ageBoundaryReached();
2021-06-11 15:00:00 +10:00
if (!this.isBaby() && this.level.getGameRules().getBoolean(GameRules.RULE_DOMOBLOOT)) {
2018-08-26 12:00:00 +10:00
+ this.forceDrops = true; // CraftBukkit
2021-11-22 09:00:00 +11:00
this.spawnAtLocation(Items.SCUTE, 1);
2018-08-26 12:00:00 +10:00
+ this.forceDrops = false; // CraftBukkit
}
2018-07-24 22:22:56 +10:00
2018-08-26 12:00:00 +10:00
}
2021-11-22 09:00:00 +11:00
@@ -338,7 +340,9 @@
2019-04-23 12:00:00 +10:00
@Override
2021-11-22 09:00:00 +11:00
public void thunderHit(WorldServer worldserver, EntityLightning entitylightning) {
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = entitylightning; // CraftBukkit
2021-11-22 09:00:00 +11:00
this.hurt(DamageSource.LIGHTNING_BOLT, Float.MAX_VALUE);
+ org.bukkit.craftbukkit.event.CraftEventFactory.entityDamage = null; // CraftBukkit
}
2021-06-11 15:00:00 +10:00
private static class e extends ControllerMove {
2021-11-22 09:00:00 +11:00
@@ -484,8 +488,12 @@
} else if (this.turtle.layEggCounter > this.adjustedTickDelay(200)) {
2021-06-11 15:00:00 +10:00
World world = this.turtle.level;
+ // CraftBukkit start
2021-11-22 09:00:00 +11:00
+ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.turtle, this.blockPos.above(), (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1)).isCancelled()) {
2021-06-11 15:00:00 +10:00
world.playSound((EntityHuman) null, blockposition, SoundEffects.TURTLE_LAY_EGG, SoundCategory.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F);
2021-11-22 09:00:00 +11:00
world.setBlock(this.blockPos.above(), (IBlockData) Blocks.TURTLE_EGG.defaultBlockState().setValue(BlockTurtleEgg.EGGS, this.turtle.random.nextInt(4) + 1), 3);
+ }
+ // CraftBukkit end
2021-06-11 15:00:00 +10:00
this.turtle.setHasEgg(false);
2021-11-22 09:00:00 +11:00
this.turtle.setLayingEgg(false);
this.turtle.setInLoveTime(600);