Class EntityJoinLevelEvent

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

public class EntityJoinLevelEvent extends EntityEvent
This event is fired whenever an Entity joins a Level. This event is fired whenever an entity is added to a level in LevelWriter.addFreshEntity(Entity) and PersistentEntitySectionManager#addNewEntity(Entity, boolean).

Note: This event may be called before the underlying LevelChunk is promoted to ChunkStatus.FULL. You will cause chunk loading deadlocks if you do not delay your world interactions.

This event is cancellable and does not have a result. If the event is canceled, the entity will not be added to the level.

This event is fired on the main Forge event bus on both logical sides.

  • Field Details

    • level

      private final Level level
    • loadedFromDisk

      private final boolean loadedFromDisk
  • Constructor Details

    • EntityJoinLevelEvent

      public EntityJoinLevelEvent(Entity entity, Level level)
    • EntityJoinLevelEvent

      public EntityJoinLevelEvent(Entity entity, Level level, boolean loadedFromDisk)
  • Method Details

    • getLevel

      public Level getLevel()
      Returns the level that the entity is set to join.
      Returns:
      the level that the entity is set to join
    • loadedFromDisk

      public boolean loadedFromDisk()
      Returns:
      true if the entity was loaded from disk, false otherwise. On the logical client, this will always return false.