World¶
Represents the in-game world, exposing time, dimension, spawn location, and chunk state information.
Fields¶
day: boolean — Read-Only¶
Indicates whether it is currently daytime in the world.
dimension: string — Read-Only¶
The identifier of the world’s dimension (e.g., "minecraft:overworld", "minecraft:the_nether").
night: boolean — Read-Only¶
Indicates whether it is currently nighttime in the world.
realtime: number — Read-Only¶
The current real-world time in milliseconds since 1970-01-01 (UTC), as the server's clock tells it.
spawnPos: Vec3 — Read/Write¶
The world spawn point where players appear when respawning.
time: number — Read-Only¶
The number of ticks this world has run. It always advances, even while the daylight cycle is stopped, and it is not affected by /time set.
timeOfDay: number — Read-Only¶
The time of day in ticks, from 0 to 23999: 0 is sunrise, 6000 noon, 12000 sunset and 18000 midnight. /time set changes it, and it stands still while the daylight cycle is stopped.
Methods¶
isLoaded(pos: Vec3) → loaded: boolean¶
Checks whether the chunk containing the specified position is currently loaded in memory.
Example
local position = Vec3:new(100, 64, 100)
if world:isLoaded(position) then
print("The chunk at the specified position is loaded.")
else
print("The chunk at the specified position is not loaded.")
end
Parameters
- pos: Vec3 — The position to check.
Returns
- loaded: boolean —
trueif the chunk is loaded,falseotherwise.