From b865db3b2a525c952cd7b4a915d1e452966c2e42 Mon Sep 17 00:00:00 2001 From: md_5 Date: Thu, 16 Aug 2018 20:27:16 +1000 Subject: [PATCH] SPIGOT-4278: EntityChangeBlockEvent for turtles laying eggs --- nms-patches/EntityTurtle.patch | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/nms-patches/EntityTurtle.patch b/nms-patches/EntityTurtle.patch index 0a4df9659a..14feb6f6af 100644 --- a/nms-patches/EntityTurtle.patch +++ b/nms-patches/EntityTurtle.patch @@ -20,3 +20,17 @@ } public void die(DamageSource damagesource) { +@@ -438,8 +442,12 @@ + } else if (this.f.bK > 200) { + World world = this.f.world; + ++ // CraftBukkit start ++ if (!org.bukkit.craftbukkit.event.CraftEventFactory.callEntityChangeBlockEvent(this.f, this.d.up(), Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, Integer.valueOf(this.f.random.nextInt(4) + 1))).isCancelled()) { + world.a((EntityHuman) null, blockposition, SoundEffects.ENTITY_TURTLE_LAY_EGG, SoundCategory.BLOCKS, 0.3F, 0.9F + world.random.nextFloat() * 0.2F); +- world.setTypeAndData(this.d.up(), (IBlockData) Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, Integer.valueOf(this.f.random.nextInt(4) + 1)), 3); ++ world.setTypeAndData(this.d.up(), (IBlockData) Blocks.TURTLE_EGG.getBlockData().set(BlockTurtleEgg.b, Integer.valueOf(this.f.random.nextInt(4) + 1)), 3); ++ } ++ // CraftBukkit end + this.f.s(false); + this.f.t(false); + this.f.e(600);