From 8a00d6f5d18352c2a67db8c6c1ffb8dc44e643e6 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Mon, 13 Jun 2022 15:24:58 +1000 Subject: [PATCH] #1070: Add SpawnReason and TransformReason for Tadpole metamorphosis into Frog By: Doc --- .../world/entity/animal/frog/Tadpole.patch | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 paper-server/nms-patches/net/minecraft/world/entity/animal/frog/Tadpole.patch diff --git a/paper-server/nms-patches/net/minecraft/world/entity/animal/frog/Tadpole.patch b/paper-server/nms-patches/net/minecraft/world/entity/animal/frog/Tadpole.patch new file mode 100644 index 0000000000..d3af9c52b8 --- /dev/null +++ b/paper-server/nms-patches/net/minecraft/world/entity/animal/frog/Tadpole.patch @@ -0,0 +1,27 @@ +--- a/net/minecraft/world/entity/animal/frog/Tadpole.java ++++ b/net/minecraft/world/entity/animal/frog/Tadpole.java +@@ -68,7 +68,7 @@ + + @Override + public BehaviorController getBrain() { +- return super.getBrain(); ++ return (BehaviorController) super.getBrain(); // CraftBukkit - decompile error + } + + @Override +@@ -232,8 +232,14 @@ + } + + frog.setPersistenceRequired(); ++ // CraftBukkit start ++ if (org.bukkit.craftbukkit.event.CraftEventFactory.callEntityTransformEvent(this, frog, org.bukkit.event.entity.EntityTransformEvent.TransformReason.METAMORPHOSIS).isCancelled()) { ++ this.setAge(0); // Sets the age to 0 for avoid a loop if the event is canceled ++ return; ++ } ++ // CraftBukkit end + this.playSound(SoundEffects.TADPOLE_GROW_UP, 0.15F, 1.0F); +- worldserver.addFreshEntityWithPassengers(frog); ++ worldserver.addFreshEntityWithPassengers(frog, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.METAMORPHOSIS); // CraftBukkit - add SpawnReason + this.discard(); + } +