world class
world.getBlock
function world.getBlock(x, y, z) endReturns the block name at the given position. Returns "minecraft:air" if the block or block source isn't available.
Parameters
x: number: The x coordinate.y: number: The y coordinate.z: number: The z coordinate.
Returns
- string: The block name.
world.getLightLevel
function world.getLightLevel(x, y, z) endReturns the light level at the given position. Returns 0 if the block source isn't available.
Parameters
x: number: The x coordinate.y: number: The y coordinate.z: number: The z coordinate.
Returns
- number: The light level.
world.raycast
function world.raycast(maxDistance) endRaycasts from the player's crosshair and returns the hit block if it is within range. Returns nil if there is no local player, no level, the max distance is invalid, or no tile was hit within range.
Parameters
maxDistance: number|nil: Maximum hit distance. Defaults to 6.
Returns
- table|nil: Hit info with x, y, z, blockX, blockY, blockZ, face, faceId, and distance.
world.worldToScreen
function world.worldToScreen(x, y, z) endProjects a world position to screen coordinates.
Parameters
x: number: The world x coordinate.y: number: The world y coordinate.z: number: The world z coordinate.
Returns
- boolean: visible True if the world position is visible on screen.
- number: screenX The projected screen x coordinate.
- number: screenY The projected screen y coordinate.
world.getDimension
function world.getDimension() endReturns the current dimension name. Returns "unknown" if the dimension isn't available.
Returns
- string: The dimension name.
world.getWorldName
function world.getWorldName() endReturns the current world/level name. Returns an empty string if the world name isn't available.
Returns
- string: The world name.
world.getEntities
function world.getEntities(maxDistance) endReturns nearby loaded entities around the local player. The local player is excluded. Pass 0 to disable the distance filter.
Parameters
maxDistance: number|nil: Maximum distance from the local player. Defaults to 128.
Returns
- Entity[]: The matching entities.
Reference: world.lua