13
0
geforkt von Mirrors/Paper

#1070: Add SpawnReason and TransformReason for Tadpole metamorphosis into Frog

By: Doc <nachito94@msn.com>
Dieser Commit ist enthalten in:
CraftBukkit/Spigot 2022-06-13 15:24:58 +10:00
Ursprung df3ad38359
Commit 8a00d6f5d1

Datei anzeigen

@ -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<Tadpole> getBrain() {
- return super.getBrain();
+ return (BehaviorController<Tadpole>) 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();
}