Fix EntityBreedEvent cancellation (#12046)

This commit is contained in:
Lulu13022002
2025-02-08 20:59:13 +01:00
committed by GitHub
parent 61312fdb59
commit 1a04e96ab7
4 changed files with 30 additions and 33 deletions

View File

@@ -1896,11 +1896,11 @@ public class CraftEventFactory {
}
public static EntityBreedEvent callEntityBreedEvent(net.minecraft.world.entity.LivingEntity child, net.minecraft.world.entity.LivingEntity mother, net.minecraft.world.entity.LivingEntity father, net.minecraft.world.entity.LivingEntity breeder, ItemStack bredWith, int experience) {
org.bukkit.entity.LivingEntity breederEntity = (LivingEntity) (breeder == null ? null : breeder.getBukkitEntity());
LivingEntity breederEntity = breeder == null ? null : (LivingEntity) breeder.getBukkitEntity();
CraftItemStack bredWithStack = bredWith == null ? null : CraftItemStack.asCraftMirror(bredWith).clone();
EntityBreedEvent event = new EntityBreedEvent((LivingEntity) child.getBukkitEntity(), (LivingEntity) mother.getBukkitEntity(), (LivingEntity) father.getBukkitEntity(), breederEntity, bredWithStack, experience);
child.level().getCraftServer().getPluginManager().callEvent(event);
event.callEvent();
return event;
}