Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Minecraft-Community-Edition/client/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Level API provides core functionality for world management in Minecraft Community Edition. TheLevel class serves as the foundation for both single-player and multiplayer worlds, handling block manipulation, entity management, lighting, and game logic.
Class Hierarchy
Level Class
The abstract base class for all game worlds. Header:Minecraft.World/Level.hInherits:
LevelSource
Constants
Core Members
Constructors
Creates a new level with the specified storage, name, dimension, and settings.Parameters:
levelStorage- Shared pointer to level storage systemname- World namedimension- Dimension instance (Overworld, Nether, End)levelSettings- World generation and gameplay settings
Creates a dimension variant of an existing level.Parameters:
level- Source level to derive fromdimension- Target dimension
Block Access & Modification
Gets the block ID at the specified coordinates.Returns: Block/tile ID, or 0 if air or unloaded
Gets the block metadata/data value at the specified coordinates.Returns: Block data value (0-15)
Sets a block at the specified position with lighting and updates.Parameters:
x, y, z- Block coordinatestile- Block ID to place
true if block was changedSets both block ID and metadata at the specified position.Parameters:
x, y, z- Block coordinatestile- Block ID to placedata- Metadata value (0-15)
true if block was changedSets a block without triggering neighbor updates or lighting recalculation.Warning: Use sparingly - can cause lighting bugs if not followed by
checkLight()Sets block metadata/data value.Parameters:
data- Metadata value (0-15)forceUpdate- Force neighbor updates even if data unchanged
Chunk Management
Checks if a chunk is loaded (may return true for chunks being generated).Parameters:
x, z- Chunk coordinates (not block coordinates)
Checks if a chunk is actually loaded and ready.Note: More strict than
hasChunk() - doesn’t include chunks being generatedGets a chunk, loading it if necessary.Returns: Pointer to chunk (never null - will load/generate if needed)
Gets the chunk containing the specified block coordinates.Parameters:
x, z- Block coordinates (will be converted to chunk coords)
Lighting
Gets light level at coordinates for the specified layer.Parameters:
layer-LightLayer::SkyorLightLayer::Blockx, y, z- Block coordinates
Sets light level at coordinates.Parameters:
brightness- Light level (0-15)
Recalculates lighting at the specified position.Parameters:
force- Force recalculation even if lighting appears correctrootOnlyEmissive- Only recalculate emissive (block) lighting
Gets raw brightness combining sky and block light.Returns: Combined light level (0-15)
Entity Management
Adds an entity to the world.Returns:
true if entity was added successfullyMarks an entity for removal on next tick.
Gets all entities within a bounding box.Parameters:
except- Entity to exclude from resultsbb- Axis-aligned bounding box
Gets entities of a specific type within a bounding box.Example:
World Queries
Gets the Y coordinate of the highest non-air block.Returns: Y coordinate of topmost solid block
Checks if a position has direct line of sight to the sky.
Checks if a position contains air.
Gets the biome at the specified coordinates.
Gets the sea level for this world.Returns: Y coordinate of sea level (typically 63)
Time & Weather
Gets the current world time in ticks.
Sets the world time.
Checks if it’s currently daytime.
Checks if it’s currently raining.
Checks if there’s currently a thunderstorm.
Sets rain intensity (0.0 to 1.0).
Tick & Update
Advances the world by one tick (1/20th of a second).Updates entities, tile entities, scheduled ticks, weather, and mob spawning.
Updates all entities in the world.
MultiPlayerLevel Class
Client-side implementation of Level for multiplayer worlds. Header:Minecraft.Client/MultiPlayerLevel.hInherits:
Level
Key Features
- Receives world updates from server via
ClientConnection - Manages chunk visibility and streaming
- Handles entity synchronization
- Supports multiple local players (split-screen)
Constructor
Creates a multiplayer client-side level.Parameters:
connection- Connection to serverlevelSettings- World settingsdimension- Dimension ID (0=Overworld, -1=Nether, 1=End)difficulty- Difficulty level
Methods
Marks a chunk as visible or invisible to the client.Used for chunk streaming - invisible chunks can be unloaded.
Registers an entity with a network ID for synchronization.
Gets an entity by its network ID.
Removes and returns an entity by network ID.
Example Usage
Basic Block Manipulation
Finding Entities
Lighting Updates
See Also
- Chunk API - Chunk storage and management
- Entity API - Entity system
- Player API - Player-specific functionality