Class EntityJoinWorldEvent

java.lang.Object
net.minecraftforge.eventbus.api.Event
net.minecraftforge.event.entity.EntityEvent
net.minecraftforge.event.entity.EntityJoinWorldEvent

public class EntityJoinWorldEvent extends EntityEvent
EntityJoinWorldEvent is fired when an Entity joins the world.
This event is fired whenever an Entity is added to the world in Level#loadEntities(Collection), net.minecraft.world.ServerWorld#loadEntities(Collection) World#joinEntityInSurroundings(Entity), and World#spawnEntity(Entity).
Note: This event may be called before the underlying LevelChunk is promoted to ChunkStatus.FULL. You will cause chunk loading deadlocks if you don't delay your world interactions.

world contains the world in which the entity is to join.

This event is Cancelable.
If this event is canceled, the Entity is not added to the world.

This event does not have a result. Event.HasResult

This event is fired on the MinecraftForge.EVENT_BUS.
  • Field Details

    • world

      private final Level world
    • loadedFromDisk

      private final boolean loadedFromDisk
  • Constructor Details

    • EntityJoinWorldEvent

      public EntityJoinWorldEvent(Entity entity, Level world)
    • EntityJoinWorldEvent

      public EntityJoinWorldEvent(Entity entity, Level world, boolean loadedFromDisk)
  • Method Details

    • getWorld

      public Level getWorld()
    • loadedFromDisk

      public boolean loadedFromDisk()
      Returns:
      true if the entity was loaded from disk. On client entities, the info isn't available and this will always return false.