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 ServerLevel.

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

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

      See Also:
    • CHUNK_GENERATE

      @Deprecated public static final Event<ServerChunkEvents.Generate> CHUNK_GENERATE
      Deprecated.
      use CHUNK_LOAD directly instead
      Called when a newly generated chunk is loaded into a ServerLevel.

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

    • CHUNK_UNLOAD

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

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

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

    • FULL_CHUNK_STATUS_CHANGE

      public static final Event<ServerChunkEvents.FullChunkStatusChange> FULL_CHUNK_STATUS_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 full chunk status 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.