Class ServerChunkEvents

java.lang.Object
net.fabricmc.fabric.api.event.lifecycle.v1.ServerChunkEvents

public final class ServerChunkEvents extends Object
  • Field Details

    • CHUNK_LOAD

      public static final Event<ServerChunkEvents.Load> CHUNK_LOAD
      Called when a chunk is loaded into a ServerWorld.

      When this event is called, the chunk is already in the world.

      Note that this event is not called for chunks that become accessible without previously being unloaded.

      See Also:
    • CHUNK_GENERATE

      public static final Event<ServerChunkEvents.Generate> CHUNK_GENERATE
      Called when a newly generated chunk is loaded into a ServerWorld.

      When this event is called, the chunk is already in the world.

    • CHUNK_UNLOAD

      public static final Event<ServerChunkEvents.Unload> CHUNK_UNLOAD
      Called when a chunk is unloaded from a ServerWorld.

      When this event is called, the chunk is still present in the world.

      Note that the server typically unloads chunks when the chunk's level goes above 45 (and not immediately when the chunk becomes inaccessible). To know when a chunk first becomes inaccessible, see CHUNK_LEVEL_TYPE_CHANGE.

    • CHUNK_LEVEL_TYPE_CHANGE

      public static final Event<ServerChunkEvents.LevelTypeChange> CHUNK_LEVEL_TYPE_CHANGE
      Called when a chunk's actual ticking behavior is about to align with its updated FullChunkStatus.

      When this event is being called:

      • The chunk's LevelChunk.getFullStatus() has already changed.
      • Entities within the chunk are not guaranteed to be accessible.
      • The chunk's corresponding level type future in ChunkHolder is not guaranteed to be done.
      • When transitioning from FullChunkStatus.INACCESSIBLE to FullChunkStatus.FULL, calling ServerChunkCache.getChunkFuture(int, int, ChunkStatus, boolean) to fetch the current chunk at ChunkStatus.FULL status results in undefined behavior.