Class ServerEntityLevelChangeEvents

java.lang.Object
net.fabricmc.fabric.api.entity.event.v1.ServerEntityLevelChangeEvents

public final class ServerEntityLevelChangeEvents extends Object
Events related to an entity being moved to another level.
API Note:
For a ServerPlayer, please use AFTER_PLAYER_CHANGE_LEVEL.
  • Field Details

    • AFTER_ENTITY_CHANGE_LEVEL

      public static final Event<ServerEntityLevelChangeEvents.AfterEntityChange> AFTER_ENTITY_CHANGE_LEVEL
      An event which is called after an entity has been moved to a different level.

      All entities are copied to the destination and the old entity removed. This event does not apply to the ServerPlayer since players are physically moved to the new level instead of being copied over.

      A mod may use this event for reference cleanup if it is tracking an entity's current level.

      See Also:
    • AFTER_PLAYER_CHANGE_LEVEL

      public static final Event<ServerEntityLevelChangeEvents.AfterPlayerChange> AFTER_PLAYER_CHANGE_LEVEL
      An event which is called after a player has been moved to a different level.

      This is similar to AFTER_ENTITY_CHANGE_LEVEL but is only called for players. This is because the player is usually physically moved to the new level instead of being recreated at the destination.

      However, there is one exception to this. When the player respawns in a different level, the player is recreated at the destination. When that happens, this event passes in the new ServerPlayer. If you need the old ServerPlayer, see ServerPlayerEvents.AFTER_RESPAWN

      See Also: