Class BabyEntitySpawnEvent

java.lang.Object
net.neoforged.bus.api.Event
net.neoforged.neoforge.event.entity.living.BabyEntitySpawnEvent
All Implemented Interfaces:
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.
invalid reference
HasResult


This event is fired on the NeoForge.EVENT_BUS.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private final net.minecraft.world.entity.player.Player
     
    private net.minecraft.world.entity.AgeableMob
     
    private final net.minecraft.world.entity.Mob
     
    private final net.minecraft.world.entity.Mob
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    BabyEntitySpawnEvent(net.minecraft.world.entity.Mob parentA, net.minecraft.world.entity.Mob parentB, @Nullable net.minecraft.world.entity.AgeableMob proposedChild)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    @Nullable net.minecraft.world.entity.player.Player
     
    @Nullable net.minecraft.world.entity.AgeableMob
     
    net.minecraft.world.entity.Mob
     
    net.minecraft.world.entity.Mob
     
    void
    setChild(net.minecraft.world.entity.AgeableMob proposedChild)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

    Methods inherited from interface net.neoforged.bus.api.ICancellableEvent

    isCanceled, setCanceled
  • Field Details

    • parentA

      private final net.minecraft.world.entity.Mob parentA
    • parentB

      private final net.minecraft.world.entity.Mob parentB
    • causedByPlayer

      private final net.minecraft.world.entity.player.Player causedByPlayer
    • child

      private net.minecraft.world.entity.AgeableMob child
  • Constructor Details

    • BabyEntitySpawnEvent

      public BabyEntitySpawnEvent(net.minecraft.world.entity.Mob parentA, net.minecraft.world.entity.Mob parentB, @Nullable @Nullable net.minecraft.world.entity.AgeableMob proposedChild)
  • Method Details

    • getParentA

      public net.minecraft.world.entity.Mob getParentA()
    • getParentB

      public net.minecraft.world.entity.Mob getParentB()
    • getCausedByPlayer

      @Nullable public @Nullable net.minecraft.world.entity.player.Player getCausedByPlayer()
    • getChild

      @Nullable public @Nullable net.minecraft.world.entity.AgeableMob getChild()
    • setChild

      public void setChild(net.minecraft.world.entity.AgeableMob proposedChild)