World

Basic world.

class World : EventListener!(WorldEvent, EntityEvent, "entity", PlayerEvent, "player") {}

Constructors

this
this(Generator generator, uint seed)
Undocumented in source.
this
this(uint seed)
Undocumented in source.

Members

Aliases

schedule
alias schedule = addTask

Registers a task.

Functions

addTask
size_t addTask(void delegate() task, size_t interval, size_t repeat)

Registers a task.

afterSpawnPlayer
void afterSpawnPlayer(Player player, bool announce)
Undocumented in source. Be warned that the author may not have intended to support it.
broadcast
void broadcast(E args)

Broadcasts a message (raw or translatable) to every player in the world. To broadcast a message to every player in the group, use group.broadcast.

broadcastImpl
void broadcastImpl(Message[] message)
Undocumented in source. Be warned that the author may not have intended to support it.
broadcastTip
void broadcastTip(E args)

Broadcasts a tip to the players in the world.

broadcastTipImpl
void broadcastTipImpl(Message[] message)
Undocumented in source. Be warned that the author may not have intended to support it.
delay
size_t delay(void delegate() task, size_t timeout)

Executes a task one time after the given ticks.

despawn
void despawn(T entity)

Despawns an entity.

despawnPlayer
void despawnPlayer(Player player)
Undocumented in source. Be warned that the author may not have intended to support it.
drop
ItemEntity drop(Slot slot, EntityPosition position, EntityPosition motion)
ItemEntity drop(Slot slot, EntityPosition position)
void drop(Block from, BlockPosition position)

Drops an item.

entity
Entity entity(uint eid)

Gets an entity from an id.

explode
void explode(EntityPosition position, float power, Living damager)
Undocumented in source. Be warned that the author may not have intended to support it.
explode
void explode(BlockPosition position, float power, Living damager)
Undocumented in source. Be warned that the author may not have intended to support it.
generate
Chunk generate(ChunkPosition position)
Chunk generate(int x, int z)

Generates and sets a chunk.

initChunks
void initChunks()
Undocumented in source. Be warned that the author may not have intended to support it.
log
void log(E args)

Logs a message into the server's console as this world but without sending it to the players.

logImpl
void logImpl(Message[] messages)
Undocumented in source. Be warned that the author may not have intended to support it.
opBinaryRight
Chunk* opBinaryRight(ChunkPosition position)

Gets a pointer to the chunk at the given position.

opBinaryRight
Block* opBinaryRight(BlockPosition position)
Undocumented in source. Be warned that the author may not have intended to support it.
opEquals
bool opEquals(Object o)
Undocumented in source. Be warned that the author may not have intended to support it.
opIndex
Chunk opIndex(int x, int z)
Chunk opIndex(ChunkPosition position)

Gets a chunk.

opIndex
Block opIndex(BlockPosition position)
Block opIndex(int x, uint y, int z)

Gets a block.

opIndexAssign
Chunk opIndexAssign(Chunk chunk)

Sets a chunk.

opIndexAssign
Block* opIndexAssign(T block, BlockPosition position)
Block* opIndexAssign(T block, int x, uint y, int z)

Sets a block.

opIndexAssign
void opIndexAssign(T tile, BlockPosition position)
void opIndexAssign(T tile, int x, uint y, int z)

Sets a tile.

opIndexAssign
void opIndexAssign(block_t b, Slice x, Slice y, Slice z)
void opIndexAssign(block_t b, int x, Slice y, Slice z)
void opIndexAssign(block_t b, Slice x, uint y, Slice z)
void opIndexAssign(block_t b, Slice x, Slice y, int z)
void opIndexAssign(block_t b, int x, uint y, Slice z)
void opIndexAssign(block_t b, int x, Slice y, int z)
void opIndexAssign(block_t b, Slice x, uint y, int z)

Sets the same block in a rectangualar area. This method is optimised for building as it uses a cached pointer instead of getting it every time and it doesn't call any block update.

opSlice
Slice opSlice(int min, int max)
Undocumented in source. Be warned that the author may not have intended to support it.
player
Player player(uint eid)

Gets a player from an id.

playerUpdateRadius
void playerUpdateRadius(Player player)
Undocumented in source. Be warned that the author may not have intended to support it.
preSpawnPlayer
void preSpawnPlayer(Player player)
Undocumented in source. Be warned that the author may not have intended to support it.
registerCommand
void registerCommand(void delegate(Parameters!func) del, string command, Description description, string[] aliases, ubyte permissionLevel, string[] permissions, bool hidden, bool implemented)

Registers a command.

removeTask
void removeTask(void delegate() task)
void removeTask(size_t tid)

Removes a task using the task's delegate or the id returned by the addTask function.

replace
size_t replace(block_t from, block_t to)
Undocumented in source. Be warned that the author may not have intended to support it.
replace
size_t replace(Block* from, Block* to)
Undocumented in source. Be warned that the author may not have intended to support it.
replace
size_t replace(block_t from, block_t to, BlockPosition fromp, BlockPosition top)
Undocumented in source. Be warned that the author may not have intended to support it.
replaceImpl
size_t replaceImpl(Chunk chunk, Block* from, Block* to)
Undocumented in source. Be warned that the author may not have intended to support it.
scheduleBlockUpdate
void scheduleBlockUpdate(Block block, uint time)

schedules a block update

spawn
T spawn(E args)

* Spawns an entity.

start
void start(WorldGroup group)
Undocumented in source. Be warned that the author may not have intended to support it.
stop
void stop()
Undocumented in source. Be warned that the author may not have intended to support it.
strike
void strike(EntityPosition position)
void strike(Entity entity)

Stikes a lightning.

tick
void tick()
Undocumented in source. Be warned that the author may not have intended to support it.
tileAt
T tileAt(int x, uint y, int z)
T tileAt(BlockPosition position)

Gets a tile.

unload
bool unload(ChunkPosition position)

Unloads and removes a chunk.

unregisterCommand
void unregisterCommand(string command)

Unregisters a command.

updateBlock
void updateBlock(BlockPosition position)
Undocumented in source. Be warned that the author may not have intended to support it.
updateState
void updateState(uint state)
Undocumented in source. Be warned that the author may not have intended to support it.
updateTile
void updateTile(Tile tile, BlockPosition position)

function called by a tile when its data is updated

Properties

blocks
BlockStorage blocks [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
chunks
Chunk[int][int] chunks [@property getter]

Gets an associative array with every chunk loaded in the world.

currentState
uint currentState [@property getter]

Gets the current world's state.

depleteHunger
bool depleteHunger [@property getter]
bool depleteHunger [@property setter]

Gets/sets whether players' hunger is depleted when the world's difficulty is not set to peaceful.

difficulty
Difficulty difficulty [@property getter]
Difficulty difficulty [@property setter]

Gets/sets the world's difficulty.

dimension
Dimension dimension [@property getter]

Gets the world's dimension as a group of bytes.

entities
T[] entities [@property getter]
Entity[] entities [@property getter]

Gets the entities spawned in the world.

gamemode
Gamemode gamemode [@property getter]
Gamemode gamemode [@property setter]

Gets/sets the world's gamemode.

id
uint id [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
items
ItemStorage items [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
loadedChunks
size_t loadedChunks [@property getter]

Gets the number of loaded chunks in the world and its children.

naturalRegeneration
bool naturalRegeneration [@property getter]
bool naturalRegeneration [@property setter]

Gets/sets whether player's health regenerates naturally or not.

players
T[] players [@property getter]
Player[] players [@property getter]

Gets a list of the players spawned in the world.

pvp
bool pvp [@property getter]
bool pvp [@property setter]

Gets/sets whether the pvp (player vs player) is active in the current group of worlds.

random
Random random [@property getter]

Gets the world's random generator initialised with the world's seed.

randomTickSpeed
uint randomTickSpeed [@property getter]
uint randomTickSpeed [@property setter]

Gets/sets the world's random tick speed.

seed
const(uint) seed [@property getter]

Gets the world's seed used for terrain and randomness generation.

server
shared(NodeServer) server [@property getter]
Undocumented in source. Be warned that the author may not have intended to support it.
ticks
tick_t ticks [@property getter]

Gets the number of this ticks occurred since the creation of the world.

time
auto time [@property getter]

Gets the world's time manager.

type
const(string) type [@property getter]

Gets the world's type as a string. Valid types are "flat" and "default" for both Minecraft and Minecraft: Pocket Edition plus "largeBiomes", "amplified" and "customized" for Minecraft only.

viewDistance
uint viewDistance [@property getter]
uint viewDistance [@property setter]

Gets/sets the worlds group's default highest view distance for players.

weather
auto weather [@property getter]

Gets the world's weather manager.

Static functions

growTree
void growTree(World world, BlockPosition position, ushort[] trunk, ushort leaves)

Grows a tree in the given world.

Variables

_update_state
void delegate(int, uint) _update_state;
Undocumented in source.
defaultChunks
ChunkPosition[] defaultChunks;
Undocumented in source.
generator
Generator generator;
Undocumented in source.
info
WorldInfo info;
Undocumented in source.
n_blocks
BlockStorage n_blocks;
Undocumented in source.
n_dimension
Dimension n_dimension;
Undocumented in source.
n_items
ItemStorage n_items;
Undocumented in source.
n_seed
uint n_seed;
Undocumented in source.
n_type
string n_type;
Undocumented in source.
spawnPoint
BlockPosition spawnPoint;
Undocumented in source.
updateBlocks
bool updateBlocks;
Undocumented in source.

Meta