Skip to content

World ​

class · pocketmine\world\World · source

Implements ChunkManager

Constants ​

DEFAULT_SIMULATION_DISTANCE 5.46.0 ​

php
public const DEFAULT_SIMULATION_DISTANCE = 4

Bedrock Dedicated Server's default simulation distance (server.properties tick-distance=4).

DEFAULT_TICKED_BLOCKS_PER_SUBCHUNK_PER_TICK ​

php
public const DEFAULT_TICKED_BLOCKS_PER_SUBCHUNK_PER_TICK = 3

DIFFICULTY_EASY ​

php
public const DIFFICULTY_EASY = 1

DIFFICULTY_HARD ​

php
public const DIFFICULTY_HARD = 3

DIFFICULTY_NORMAL ​

php
public const DIFFICULTY_NORMAL = 2

DIFFICULTY_PEACEFUL ​

php
public const DIFFICULTY_PEACEFUL = 0

TIME_DAY ​

php
public const TIME_DAY = 1000

TIME_FULL ​

php
public const TIME_FULL = 24000

TIME_MIDNIGHT ​

php
public const TIME_MIDNIGHT = 18000

TIME_NIGHT ​

php
public const TIME_NIGHT = 13000

TIME_NOON ​

php
public const TIME_NOON = 6000

TIME_SUNRISE ​

php
public const TIME_SUNRISE = 23000

TIME_SUNSET ​

php
public const TIME_SUNSET = 12000

Y_MAX ​

php
public const Y_MAX = 320

Y_MIN ​

php
public const Y_MIN = -64

Properties ​

$stopTime ​

php
public bool $stopTime

$tickRateTime ​

php
public float $tickRateTime

$timings ​

php
public \pocketmine\world\WorldTimings $timings

$updateEntities ​

php
public array $updateEntities

Methods ​

__construct() ​

php
public function __construct(\pocketmine\Server $server, string $name, \pocketmine\world\format\io\WritableWorldProvider $provider, \pocketmine\scheduler\AsyncPool $workerPool, \pocketmine\world\dimension\Dimension $dimension = \pocketmine\world\dimension\Dimension::OVERWORLD)

Init the default world data

__debugInfo() ​

php
public function __debugInfo() : array

actuallyDoTick() protected ​

php
protected function actuallyDoTick(int $currentTick) : void

addEntity() ​

php
public function addEntity(\pocketmine\entity\Entity $entity) : void

addGameEvent() 5.46.0 ​

php
public function addGameEvent(\pocketmine\math\Vector3 $pos, \pocketmine\world\vibration\GameEvent $event, ?\pocketmine\entity\Entity $source = null, ?\pocketmine\block\Block $affected = null) : void

Emits a vibration (game event) that sculk sensors around the given position can detect.

addOnUnloadCallback() ​

php
public function addOnUnloadCallback(\Closure $callback) : void

addParticle() ​

php
public function addParticle(\pocketmine\math\Vector3 $pos, \pocketmine\world\particle\Particle $particle, ?array $players = null) : void

addRandomTickedBlock() ​

php
public function addRandomTickedBlock(\pocketmine\block\Block $block) : void

addSound() ​

php
public function addSound(\pocketmine\math\Vector3 $pos, \pocketmine\world\sound\Sound $sound, ?array $players = null) : void

blockHash() ​

php
public static function blockHash(int $x, int $y, int $z) : int

broadcastPacketToViewers() ​

php
public function broadcastPacketToViewers(\pocketmine\math\Vector3 $pos, \pocketmine\network\mcpe\protocol\ClientboundPacket $packet) : void

Broadcasts a packet to every player who has the target position within their view distance.

cancelUnloadChunkRequest() ​

php
public function cancelUnloadChunkRequest(int $x, int $z) : void

checkSleep() ​

php
public function checkSleep() : void

chunkBlockHash() ​

php
public static function chunkBlockHash(int $x, int $y, int $z) : int

Computes a small index relative to chunk base from the given coordinates.

chunkHash() ​

php
public static function chunkHash(int $x, int $z) : int

clearCache() ​

php
public function clearCache(bool $force = false) : void

computeSkyLightReduction() ​

php
public function computeSkyLightReduction() : int

Computes how many points of sky light is subtracted based on the current time. Used to offset raw chunk sky light to get a real light value.

computeSunAnglePercentage() ​

php
public function computeSunAnglePercentage() : float

Computes the percentage of a circle away from noon the sun is currently at. This can be multiplied by 2 * M_PI to get an angle in radians, or by 360 to get an angle in degrees.

createBlockUpdatePackets() ​

php
public function createBlockUpdatePackets(array $blocks) : array

doChunkGarbageCollection() ​

php
public function doChunkGarbageCollection() : void

dropExperience() ​

php
public function dropExperience(\pocketmine\math\Vector3 $pos, int $amount) : array

Drops XP orbs into the world for the specified amount, splitting the amount into several orbs if necessary.

dropItem() ​

php
public function dropItem(\pocketmine\math\Vector3 $source, \pocketmine\item\Item $item, ?\pocketmine\math\Vector3 $motion = null, int $delay = 10) : ?\pocketmine\entity\object\ItemEntity

getAdjacentChunks() ​

php
public function getAdjacentChunks(int $x, int $z) : array

Returns the chunks adjacent to the specified chunk.

getAutoSave() ​

php
public function getAutoSave() : bool

getBiome() ​

php
public function getBiome(int $x, int $y, int $z) : \pocketmine\world\biome\Biome

getBiomeId() ​

php
public function getBiomeId(int $x, int $y, int $z) : int

getBlock() ​

php
public function getBlock(\pocketmine\math\Vector3 $pos, bool $cached = true, bool $addToCache = true) : \pocketmine\block\Block

Gets the Block object at the Vector3 location. This method wraps around getBlockAt, converting the vector components to integers.

Note: If you're using this for performance-sensitive code, and you're guaranteed to be supplying ints in the specified vector, consider using getBlockAt instead for better performance.

getBlockAt() ​

php
public function getBlockAt(int $x, int $y, int $z, bool $cached = true, bool $addToCache = true) : \pocketmine\block\Block

Gets the Block object at the specified coordinates.

Note for plugin developers: If you are using this method a lot (thousands of times for many positions for example), you may want to set addToCache to false to avoid using excessive amounts of memory.

getBlockCollisionBoxes() ​

php
public function getBlockCollisionBoxes(\pocketmine\math\AxisAlignedBB $bb) : array

getBlockLightAt() ​

php
public function getBlockLightAt(int $x, int $y, int $z) : int

Gets the raw block light level

getBlockPower() 5.46.0 ​

php
public function getBlockPower(\pocketmine\math\Vector3 $pos) : int

Returns the highest redstone power (0-15) received by the block at the given position. Always 0 if redstone is disabled.

getBlockXYZ() ​

php
public static function getBlockXYZ(int $hash, ?int &$x, ?int &$y, ?int &$z) : void

getChunk() ​

php
public function getChunk(int $chunkX, int $chunkZ) : ?\pocketmine\world\format\Chunk

getChunkEntities() ​

php
public function getChunkEntities(int $chunkX, int $chunkZ) : array

getChunkListeners() ​

php
public function getChunkListeners(int $chunkX, int $chunkZ) : array

Returns all the listeners attached to this chunk.

getChunkLoaders() ​

php
public function getChunkLoaders(int $chunkX, int $chunkZ) : array

Gets the chunk loaders being used in a specific chunk

getChunkPlayers() ​

php
public function getChunkPlayers(int $chunkX, int $chunkZ) : array

Deprecated

WARNING: This function has a misleading name. Contrary to what the name might imply, this function

Returns a list of players who have the target chunk within their view distance.

getChunkTickRadius() ​

php
public function getChunkTickRadius() : int

Returns the radius of chunks to be ticked around each player. This is referred to as "simulation distance" in the Minecraft: Bedrock world options screen.

getCollidingEntities() ​

php
public function getCollidingEntities(\pocketmine\math\AxisAlignedBB $bb, ?\pocketmine\entity\Entity $entity = null) : array

Returns all collidable entities whose bounding boxes intersect the given bounding box. If an entity is given, it will be excluded from the result. If a non-collidable entity is given, the result will be empty.

This function is the same as World::getNearbyEntities(), but with additional collidability filters.

getCollisionBlocks() ​

php
public function getCollisionBlocks(\pocketmine\math\AxisAlignedBB $bb, bool $targetFirst = false) : array

getCollisionBoxes() ​

php
public function getCollisionBoxes(\pocketmine\entity\Entity $entity, \pocketmine\math\AxisAlignedBB $bb, bool $entities = true) : array

Deprecated

Use World::getBlockCollisionBoxes() instead (alongside World::getCollidingEntities()

getDifficulty() ​

php
public function getDifficulty() : int

getDifficultyFromString() ​

php
public static function getDifficultyFromString(string $str) : int

getDimension() 5.46.0 ​

php
public function getDimension() : \pocketmine\world\dimension\Dimension

Returns the dimension this world is presented as to clients (sky, fog, chunk height, portals).

getDisplayName() ​

php
public function getDisplayName() : string

Returns the World display name. WARNING: This is NOT guaranteed to be unique. Multiple worlds at runtime may share the same display name.

getEntities() ​

php
public function getEntities() : array

Returns a list of all the entities in this world, indexed by their entity runtime IDs

getEntity() ​

php
public function getEntity(int $entityId) : ?\pocketmine\entity\Entity

getFolderName() ​

php
public function getFolderName() : string

Returns the World folder name. This will not change at runtime and will be unique to a world per runtime.

getFullLight() ​

php
public function getFullLight(\pocketmine\math\Vector3 $pos) : int

Returns the highest level of any type of light at the given coordinates, adjusted for the current weather and time of day.

getFullLightAt() ​

php
public function getFullLightAt(int $x, int $y, int $z) : int

Returns the highest level of any type of light at the given coordinates, adjusted for the current weather and time of day.

getHighestAdjacentBlockLight() ​

php
public function getHighestAdjacentBlockLight(int $x, int $y, int $z) : int

Returns the highest block light level available in the positions adjacent to the specified block coordinates.

getHighestAdjacentFullLightAt() ​

php
public function getHighestAdjacentFullLightAt(int $x, int $y, int $z) : int

Returns the highest level of any type of light at, or adjacent to, the given coordinates, adjusted for the current weather and time of day.

getHighestAdjacentPotentialBlockSkyLight() ​

php
public function getHighestAdjacentPotentialBlockSkyLight(int $x, int $y, int $z) : int

Returns the highest potential level of sky light in the positions adjacent to the specified block coordinates.

getHighestAdjacentPotentialLightAt() ​

php
public function getHighestAdjacentPotentialLightAt(int $x, int $y, int $z) : int

Returns the highest potential level of any type of light at, or adjacent to, the given coordinates. This is not affected by weather or time of day.

getHighestAdjacentRealBlockSkyLight() ​

php
public function getHighestAdjacentRealBlockSkyLight(int $x, int $y, int $z) : int

Returns the highest block sky light available in the positions adjacent to the given coordinates, adjusted for the world's current time of day and weather conditions.

getHighestBlockAt() ​

php
public function getHighestBlockAt(int $x, int $z) : ?int

Gets the highest block Y value at a specific $x and $z

getId() ​

php
final public function getId() : int

Returns the unique world identifier

getLoadedChunks() ​

php
public function getLoadedChunks() : array

getLogger() ​

php
public function getLogger() : \Logger

getMaxY() ​

php
public function getMaxY() : int

getMinY() ​

php
public function getMinY() : int

getNaturalMobSpawner() 5.46.0 ​

php
public function getNaturalMobSpawner() : ?\pocketmine\world\mobs\NaturalMobSpawner

Natural mob spawning around players, or null if disabled in pocketmine.yml.

getNearbyEntities() ​

php
public function getNearbyEntities(\pocketmine\math\AxisAlignedBB $bb, ?\pocketmine\entity\Entity $entity = null) : array

Returns all entities whose bounding boxes intersect the given bounding box, excluding the given entity.

getNearestEntity() ​

php
public function getNearestEntity(\pocketmine\math\Vector3 $pos, float $maxDistance, string $entityType = \pocketmine\entity\Entity::class, bool $includeDead = false) : ?\pocketmine\entity\Entity

Returns the closest Entity to the specified position, within the given radius.

getOrLoadChunkAtPosition() ​

php
public function getOrLoadChunkAtPosition(\pocketmine\math\Vector3 $pos) : ?\pocketmine\world\format\Chunk

Returns the chunk containing the given Vector3 position.

getPatrolSpawner() 5.46.0 ​

php
public function getPatrolSpawner() : ?\pocketmine\world\mobs\PatrolSpawner

Pillager patrol spawning, or null if disabled in pocketmine.yml.

getPlayers() ​

php
public function getPlayers() : array

Returns a list of the players in this world

getPoiManager() 5.46.0 ​

php
public function getPoiManager() : \pocketmine\world\raid\PoiManager

Village points of interest of this world (beds, bells, job sites) and the villagers that claimed them.

getPotentialBlockSkyLightAt() ​

php
public function getPotentialBlockSkyLightAt(int $x, int $y, int $z) : int

Returns the highest potential level of sky light at the target coordinates, regardless of the time of day or weather conditions.

getPotentialLight() ​

php
public function getPotentialLight(\pocketmine\math\Vector3 $pos) : int

Returns the highest potential level of any type of light at the target coordinates. This is not affected by weather or time of day.

getPotentialLightAt() ​

php
public function getPotentialLightAt(int $x, int $y, int $z) : int

Returns the highest potential level of any type of light at the target coordinates. This is not affected by weather or time of day.

getProvider() ​

php
final public function getProvider() : \pocketmine\world\format\io\WritableWorldProvider

getRaidManager() 5.46.0 ​

php
public function getRaidManager() : \pocketmine\world\raid\RaidManager

Raids of this world (villages attacked by illagers) and the Bad Omen / Raid Omen effects that start them.

getRandomTickedBlocks() ​

php
public function getRandomTickedBlocks() : array

getRealBlockSkyLightAt() ​

php
public function getRealBlockSkyLightAt(int $x, int $y, int $z) : int

Returns the sky light level at the specified coordinates, offset by the current time and weather.

getRedstone() 5.46.0 ​

php
public function getRedstone() : ?\pocketmine\world\redstone\RedstoneEngine

Returns the redstone engine of this world, or null if redstone is disabled in pocketmine.yml.

getSafeSpawn() ​

php
public function getSafeSpawn(?\pocketmine\math\Vector3 $spawn = null) : \pocketmine\world\Position

Returns a safe spawn position near the given position, or near the world's spawn position if not provided. This function will throw an exception if the terrain is not already generated in advance.

getSeed() ​

php
public function getSeed() : int

Gets the world seed

getServer() ​

php
public function getServer() : \pocketmine\Server

getSimulationDistance() 5.46.0 ​

php
public function getSimulationDistance() : int

Returns the radius of chunks around each player in which entities are ticked ("simulation distance"), or 0 if the entities of every loaded chunk are ticked.

getSkyLightReduction() ​

php
public function getSkyLightReduction() : int

Returns how many points of sky light is subtracted based on the current time.

getSpawnLocation() ​

php
public function getSpawnLocation() : \pocketmine\world\Position

Returns a Position pointing to the spawn

getSunAngleDegrees() ​

php
public function getSunAngleDegrees() : float

Returns the current sun angle in degrees.

getSunAnglePercentage() ​

php
public function getSunAnglePercentage() : float

Returns the percentage of a circle away from noon the sun is currently at.

getSunAngleRadians() ​

php
public function getSunAngleRadians() : float

Returns the current sun angle in radians.

getTickRateTime() ​

php
public function getTickRateTime() : float

getTickingChunks() ​

php
public function getTickingChunks() : array

Returns a list of chunk position hashes (as returned by World::chunkHash()) which are currently valid for ticking.

getTile() ​

php
public function getTile(\pocketmine\math\Vector3 $pos) : ?\pocketmine\block\tile\Tile

Returns the Tile in a position, or null if not found.

Note: This method wraps getTileAt(). If you're guaranteed to be passing integers, and you're using this method in performance-sensitive code, consider using getTileAt() instead of this method for better performance.

getTileAt() ​

php
public function getTileAt(int $x, int $y, int $z) : ?\pocketmine\block\tile\Tile

Returns the tile at the specified x,y,z coordinates, or null if it does not exist.

getTime() ​

php
public function getTime() : int

Gets the current time

getTimeOfDay() ​

php
public function getTimeOfDay() : int

Returns the current time of day

getVibrations() 5.46.0 ​

php
public function getVibrations() : \pocketmine\world\vibration\VibrationManager

Returns the manager which delivers vibrations (game events) to the sculk sensors of this world.

getViewersForPosition() ​

php
public function getViewersForPosition(\pocketmine\math\Vector3 $pos) : array

Returns an array of players who have the target position within their view distance.

getWeather() 5.46.0 ​

php
public function getWeather() : \pocketmine\world\weather\Weather

Rain, snow and thunderstorms of this world (always clear outside the Overworld).

getXZ() ​

php
public static function getXZ(int $hash, ?int &$x, ?int &$z) : void

hasEntitiesThatMayBeStoodOn() 5.46.0 ​

php
public function hasEntitiesThatMayBeStoodOn() : bool

Returns whether this world holds any entity which players may be able to stand on (see Entity::canBeStoodOn()). Lets per-movement checks skip looking for such entities in most worlds.

isBlockPowered() 5.46.0 ​

php
public function isBlockPowered(\pocketmine\math\Vector3 $pos) : bool

Returns whether the block at the given position receives redstone power from any side. Always false if redstone is disabled.

isBlockUpdateScheduled() 5.46.0 ​

php
public function isBlockUpdateScheduled(int $x, int $y, int $z) : bool

Returns whether a delayed block update (see World::scheduleDelayedBlockUpdate()) is pending at the given position.

isChunkGenerated() ​

php
public function isChunkGenerated(int $x, int $z) : bool

isChunkInUse() ​

php
public function isChunkInUse(int $x, int $z) : bool

isChunkLoaded() ​

php
public function isChunkLoaded(int $x, int $z) : bool

isChunkLocked() ​

php
public function isChunkLocked(int $chunkX, int $chunkZ) : bool

Returns whether anyone currently has a lock on the chunk at the given coordinates. You should check this to make sure that population tasks aren't currently modifying chunks that you want to use in async tasks.

isChunkPopulated() ​

php
public function isChunkPopulated(int $x, int $z) : bool

isChunkSimulated() 5.46.0 ​

php
public function isChunkSimulated(int $chunkX, int $chunkZ) : bool

Returns whether the entities of the chunk are ticked: it is within the simulation distance of a player, or registered for ticking or simulation, or the simulation distance is unlimited.

isDoingTick() ​

php
public function isDoingTick() : bool

isInLoadedTerrain() ​

php
public function isInLoadedTerrain(\pocketmine\math\Vector3 $pos) : bool

Returns whether the given position is in a loaded area of terrain.

isInWorld() ​

php
public function isInWorld(int $x, int $y, int $z) : bool

isLoaded() ​

php
public function isLoaded() : bool

isMobSpawningEnabled() 5.46.0 ​

php
public function isMobSpawningEnabled() : bool

Returns whether mobs spawn naturally in this world (gamerule domobspawning). Mobs keep despawning when it is off.

isSpawnChunk() ​

php
public function isSpawnChunk(int $X, int $Z) : bool

Returns whether the chunk at the specified coordinates is a spawn chunk

loadChunk() ​

php
public function loadChunk(int $x, int $z) : ?\pocketmine\world\format\Chunk

Attempts to load a chunk from the world provider (if not already loaded). If the chunk is already loaded, it is returned directly.

lockChunk() ​

php
public function lockChunk(int $chunkX, int $chunkZ, \pocketmine\world\ChunkLockId $lockId) : void

Flags a chunk as locked, usually for async modification.

This is an advisory lock. This means that the lock does not prevent the chunk from being modified on the main thread, such as by setBlock() or setBiomeId(). However, you can use it to detect when such modifications have taken place - unlockChunk() with the same lockID will fail and return false if this happens.

This is used internally by the generation system to ensure that two PopulationTasks don't try to modify the same chunk at the same time. Generation will respect these locks and won't try to do generation of chunks over which a lock is held.

WARNING: Be sure to release all locks once you're done with them, or you WILL have problems with terrain not being generated.

notifyNeighbourBlockUpdate() ​

php
public function notifyNeighbourBlockUpdate(\pocketmine\math\Vector3 $pos) : void

Notify the blocks at and around the position that the block at the position may have changed. This will cause onNearbyBlockChange() to be called for these blocks. TODO: Accept plain integers in PM6 - the Vector3 requirement is an unnecessary inconvenience

notifyNeighbourBlockUpdateAt() 5.46.0 ​

php
public function notifyNeighbourBlockUpdateAt(int $x, int $y, int $z) : void

Integer version of World::notifyNeighbourBlockUpdate(): queues updates for the block at the given position and its six neighbours.

orderChunkPopulation() ​

php
public function orderChunkPopulation(int $chunkX, int $chunkZ, ?\pocketmine\world\ChunkLoader $associatedChunkLoader) : \pocketmine\promise\Promise

Initiates asynchronous generation/population of the target chunk, if it's not already generated/populated. If generation has already been requested for the target chunk, the promise for the already active request will be returned directly.

If the chunk is currently locked (for example due to another chunk using it for async generation), the request will be queued and executed at the earliest opportunity.

registerChunkListener() ​

php
public function registerChunkListener(\pocketmine\world\ChunkListener $listener, int $chunkX, int $chunkZ) : void

Registers a listener to receive events on a chunk.

registerChunkLoader() ​

php
public function registerChunkLoader(\pocketmine\world\ChunkLoader $loader, int $chunkX, int $chunkZ, bool $autoLoad = true) : void

registerSimulatingChunk() 5.46.0 ​

php
public function registerSimulatingChunk(\pocketmine\world\ChunkTicker $ticker, int $chunkX, int $chunkZ) : void

Instructs the World to tick the entities of the specified chunk even if it is beyond the simulation distance of every player, for as long as this chunk ticker (or any other) is registered to it. Chunks registered with World::registerTickingChunk() are simulated too.

registerTickingChunk() ​

php
public function registerTickingChunk(\pocketmine\world\ChunkTicker $ticker, int $chunkX, int $chunkZ) : void

Instructs the World to tick the specified chunk, for as long as this chunk ticker (or any other chunk ticker) is registered to it.

removeEntity() ​

php
public function removeEntity(\pocketmine\entity\Entity $entity) : void

Removes the entity from the world index

removeOnUnloadCallback() ​

php
public function removeOnUnloadCallback(\Closure $callback) : void

removeRandomTickedBlock() ​

php
public function removeRandomTickedBlock(\pocketmine\block\Block $block) : void

requestChunkPopulation() ​

php
public function requestChunkPopulation(int $chunkX, int $chunkZ, ?\pocketmine\world\ChunkLoader $associatedChunkLoader) : \pocketmine\promise\Promise

Attempts to initiate asynchronous generation/population of the target chunk, if it's currently reasonable to do so (and if it isn't already generated/populated). If the generator is busy, the request will be put into a queue and delayed until a better time.

A ChunkLoader can be associated with the generation request to ensure that the generation request is cancelled if no loaders are attached to the target chunk. If no loader is provided, one will be assigned (and automatically removed when the generation request completes).

requestSafeSpawn() ​

php
public function requestSafeSpawn(?\pocketmine\math\Vector3 $spawn = null) : \pocketmine\promise\Promise

Requests a safe spawn position near the given position, or near the world's spawn position if not provided. Terrain near the position will be loaded or generated as needed.

save() ​

php
public function save(bool $force = false) : bool

saveChunks() ​

php
public function saveChunks() : void

scheduleDelayedBlockUpdate() ​

php
public function scheduleDelayedBlockUpdate(\pocketmine\math\Vector3 $pos, int $delay) : void

Schedules a block update to be executed after the specified number of ticks. Blocks will be updated with the scheduled update type.

scheduleNeighbourBlockUpdateAt() 5.46.0 ​

php
public function scheduleNeighbourBlockUpdateAt(int $x, int $y, int $z) : void

Queues Block::onNearbyBlockChange() for the block at the given position only (not its neighbours).

setAutoSave() ​

php
public function setAutoSave(bool $value) : void

setBiomeId() ​

php
public function setBiomeId(int $x, int $y, int $z, int $biomeId) : void

setBlock() ​

php
public function setBlock(\pocketmine\math\Vector3 $pos, \pocketmine\block\Block $block, bool $update = true) : void

Sets the block at the given Vector3 coordinates.

setBlockAt() ​

php
public function setBlockAt(int $x, int $y, int $z, \pocketmine\block\Block $block, bool $update = true) : void

Sets the block at the given coordinates.

If $update is true, it'll get the neighbour blocks (6 sides) and update them, and also update local lighting. If you are doing big changes, you might want to set this to false, then update manually.

setChunk() ​

php
public function setChunk(int $chunkX, int $chunkZ, \pocketmine\world\format\Chunk $chunk) : void

setChunkTickRadius() ​

php
public function setChunkTickRadius(int $radius) : void

Sets the radius of chunks ticked around each player. This may not take effect immediately, since each player needs to recalculate their tick radius.

setDifficulty() ​

php
public function setDifficulty(int $difficulty) : void

setDisplayName() ​

php
public function setDisplayName(string $name) : void

Sets the World display name.

setMobSpawningEnabled() 5.46.0 ​

php
public function setMobSpawningEnabled(bool $enabled) : void

Turns natural mob spawning on or off (gamerule domobspawning, saved with the world when its format supports it).

setSimulationDistance() 5.46.0 ​

php
public function setSimulationDistance(int $distance) : void

Sets the radius of chunks around each player in which entities are ticked (0 = no limit). Like World::setChunkTickRadius(), players pick it up when they next recalculate their chunks.

setSleepTicks() ​

php
public function setSleepTicks(int $ticks) : void

setSpawnLocation() ​

php
public function setSpawnLocation(\pocketmine\math\Vector3 $pos) : void

Sets the world spawn location

setTime() ​

php
public function setTime(int $time) : void

Sets the current time on the world

startTime() ​

php
public function startTime() : void

Start the time again, if it was stopped

stopTime() ​

php
public function stopTime() : void

Stops the time for the world, will not save the lock state to disk

unloadChunk() ​

php
public function unloadChunk(int $x, int $z, bool $safe = true, bool $trySave = true) : bool

unloadChunkRequest() ​

php
public function unloadChunkRequest(int $x, int $z, bool $safe = true) : bool

unloadChunks() ​

php
public function unloadChunks(bool $force = false) : void

unlockChunk() ​

php
public function unlockChunk(int $chunkX, int $chunkZ, ?\pocketmine\world\ChunkLockId $lockId) : bool

Unlocks a chunk previously locked by lockChunk().

You must provide the same lockID as provided to lockChunk(). If a null lockID is given, any existing lock will be removed from the chunk, regardless of who owns it.

Returns true if unlocking was successful, false otherwise.

unregisterChunkListener() ​

php
public function unregisterChunkListener(\pocketmine\world\ChunkListener $listener, int $chunkX, int $chunkZ) : void

Unregisters a chunk listener previously registered.

unregisterChunkListenerFromAll() ​

php
public function unregisterChunkListenerFromAll(\pocketmine\world\ChunkListener $listener) : void

Unregisters a chunk listener from all chunks it is listening on in this World.

unregisterChunkLoader() ​

php
public function unregisterChunkLoader(\pocketmine\world\ChunkLoader $loader, int $chunkX, int $chunkZ) : void

unregisterSimulatingChunk() 5.46.0 ​

php
public function unregisterSimulatingChunk(\pocketmine\world\ChunkTicker $ticker, int $chunkX, int $chunkZ) : void

unregisterTickingChunk() ​

php
public function unregisterTickingChunk(\pocketmine\world\ChunkTicker $ticker, int $chunkX, int $chunkZ) : void

Unregisters the given chunk ticker from the specified chunk. If there are other tickers still registered to the chunk, it will continue to be ticked.

updateAllLight() ​

php
public function updateAllLight(int $x, int $y, int $z) : void

useBreakOn() ​

php
public function useBreakOn(\pocketmine\math\Vector3 $vector, ?\pocketmine\item\Item &$item = null, ?\pocketmine\player\Player $player = null, bool $createParticles = false, array &$returnedItems = []) : bool

Tries to break a block using a item, including Player time checks if available It'll try to lower the durability if Item is a tool, and set it to Air if broken.

useItemOn() ​

php
public function useItemOn(\pocketmine\math\Vector3 $vector, \pocketmine\item\Item &$item, int $face, ?\pocketmine\math\Vector3 $clickVector = null, ?\pocketmine\player\Player $player = null, bool $playSound = false, array &$returnedItems = []) : bool

Uses a item on a position and face, placing it or activating the block

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.