类 BabyEntitySpawnEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.living.BabyEntitySpawnEvent
所有已实现的接口:
net.neoforged.bus.api.ICancellableEvent

public class BabyEntitySpawnEvent extends net.neoforged.bus.api.Event implements net.neoforged.bus.api.ICancellableEvent
BabyEntitySpawnEvent is fired just before a baby entity is about to be spawned.
Parents will have disengaged their relationship. ICancellableEvent
It is possible to change the child completely by using setChild(AgeableMob)
This event is fired from Animal.spawnChildFromBreeding(ServerLevel, Animal) and Animal.spawnChildFromBreeding(ServerLevel, Animal)

parentA contains the initiating parent entity.
parentB contains the secondary parent entity.
causedByPlayer contains the player responsible for the breading (if applicable).
child contains the child that will be spawned.

This event is ICancellableEvent.
If this event is canceled, the child Entity is not added to the world, and the parents
will no longer attempt to mate.
This event does not have a result.
引用无效
HasResult


This event is fired on the NeoForge.EVENT_BUS.
  • 字段详细资料

    • parentA

      private final Mob parentA
    • parentB

      private final Mob parentB
    • causedByPlayer

      private final Player causedByPlayer
    • child

      private AgeableMob child
  • 构造器详细资料

    • BabyEntitySpawnEvent

      public BabyEntitySpawnEvent(Mob parentA, Mob parentB, @Nullable @Nullable AgeableMob proposedChild)
  • 方法详细资料

    • getParentA

      public Mob getParentA()
    • getParentB

      public Mob getParentB()
    • getCausedByPlayer

      @Nullable public @Nullable Player getCausedByPlayer()
    • getChild

      @Nullable public @Nullable AgeableMob getChild()
    • setChild

      public void setChild(AgeableMob proposedChild)