Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ryanhcode/sable/llms.txt
Use this file to discover all available pages before exploring further.
SubLevelContainer is the main entry point for accessing and managing sub-levels within a Level. Each dimension has a container attached to it; use the static getContainer() methods to retrieve it. The concrete subtypes ServerSubLevelContainer and ClientSubLevelContainer expose side-specific operations and are returned when you pass a typed level.
Constants
| Constant | Value | Description |
|---|---|---|
DEFAULT_LOG_SIZE_LENGTH | 7 | log₂ of the side length (in chunks) of the plotgrid. |
DEFAULT_LOG_PLOT_SIZE | 7 | log₂ of the number of chunks on a side of one plot. |
DEFAULT_ORIGIN | 10000 | Origin of the plotyard in plot coordinates, placing it over 30 million blocks from spawn. |
Static methods
getContainer(Level)
SubLevelContainer attached to any Level, or null if one is not present.
The level to retrieve the container from.
getContainer(ServerLevel)
ServerSubLevelContainer directly, avoiding a cast. Returns null if no container is attached.
The server-side level to retrieve the container from.
getContainer(ClientLevel)
ClientSubLevelContainer directly. Returns null if no container is attached.
The client-side level to retrieve the container from.
Instance methods
allocateNewSubLevel
The initial position and orientation for the sub-level in global space.
SubLevel.
allocateSubLevel
The unique identifier to assign to the new sub-level.
Local plot X coordinate within the grid (0-inclusive, grid-width-exclusive).
Local plot Z coordinate within the grid (0-inclusive, grid-width-exclusive).
The initial position and orientation for the sub-level in global space.
SubLevel.
removeSubLevel(SubLevel, SubLevelRemovalReason)
The sub-level instance to remove.
The reason for removal. When
REMOVED, the plot slot is freed and the occupancy bit is cleared. When UNLOADED, the slot remains reserved.removeSubLevel(int, int, SubLevelRemovalReason)
Local plot X coordinate.
Local plot Z coordinate.
The reason for removal.
getSubLevel(UUID)
null if no matching sub-level is currently loaded.
The unique identifier of the sub-level to retrieve.
getSubLevel(int, int)
null if the slot is empty or out of bounds.
Local plot X coordinate.
Local plot Z coordinate.
getAllSubLevels
ServerSubLevelContainer this is narrowed to List<ServerSubLevel>; on ClientSubLevelContainer to List<ClientSubLevel>.
getLoadedCount
queryIntersecting
The double-precision axis-aligned bounding box to test against.
getChunk
LevelChunk at the given global chunk position if it belongs to a plot in this container, or null otherwise.
The global chunk position.
getPlot
LevelPlot that owns the given global chunk position, or null if the position is not within any plot.
The global chunk position.
inBounds(ChunkPos)
true if the given global chunk position falls within the plotgrid boundaries.
inBounds(BlockPos)
true if the given global block position falls within the plotgrid boundaries.
addObserver
SubLevelObserver that will be notified of sub-level additions, removals, and ticks.
The observer to register. See the SubLevelObserver section below.
tick
SubLevelObserver.tick() on every registered observer. You do not need to call this manually.
getLevel
Level this container is attached to. On ServerSubLevelContainer the return type is narrowed to ServerLevel; on ClientSubLevelContainer to ClientLevel.
getOrigin
Vector2i(originX, originZ).
getLogPlotSize
7, each plot is 128 × 128 chunks.
getLogSideLength
7, the grid is 128 × 128 plots.
SubLevelObserver
SubLevelObserver is a listener interface with default no-op implementations for all callbacks. Register instances with addObserver().
Called after a sub-level is successfully allocated and added to the container.
Called before a sub-level is removed from the container. The sub-level is still accessible at this point.
Called once per game tick for the container. Use this for polling or per-tick bookkeeping tied to the grid.
Force-loading tickets (server only)
ServerSubLevelContainer exposes a ticket system to keep sub-levels loaded across server restarts. Tickets are persisted to saved data and re-applied on world load.
addForceLoadTicket
true if the ticket was newly added, false if an identical ticket already existed.
The sub-level to add the ticket to.
The ticket type. Use
SubLevelLoadingTicketType.COMMAND_FORCED or create your own with SubLevelLoadingTicketType.create().A key value that uniquely identifies this ticket instance within the type.
removeForceLoadTicket
true if a matching ticket existed and was removed.
The sub-level to remove the ticket from.
The ticket type to remove.
The key that identifies the specific ticket to remove.
SubLevelLoadingTicketType
COMMAND_FORCED— built-in type used by the/sablecommand to force-load sub-levels. Key type isUnit.create(ResourceLocation, Codec<T>)— registers a new ticket type. Call this once at mod initialization.byName(ResourceLocation)— looks up a registered type by its resource location.
