PocketMine-MP 5.21.2 git-b2aa6396c3cc2cafdd815eacc360e1ad89599899
|
Public Member Functions | |
__construct (private Server $server, string $name, private WritableWorldProvider $provider, private AsyncPool $workerPool) | |
__debugInfo () | |
addEntity (Entity $entity) | |
addOnUnloadCallback (\Closure $callback) | |
addParticle (Vector3 $pos, Particle $particle, ?array $players=null) | |
addRandomTickedBlock (Block $block) | |
addSound (Vector3 $pos, Sound $sound, ?array $players=null) | |
addTile (Tile $tile) | |
broadcastPacketToViewers (Vector3 $pos, ClientboundPacket $packet) | |
cancelUnloadChunkRequest (int $x, int $z) | |
checkSleep () | |
clearCache (bool $force=false) | |
computeSkyLightReduction () | |
computeSunAnglePercentage () | |
createBlockUpdatePackets (array $blocks) | |
doChunkGarbageCollection () | |
doTick (int $currentTick) | |
dropExperience (Vector3 $pos, int $amount) | |
dropItem (Vector3 $source, Item $item, ?Vector3 $motion=null, int $delay=10) | |
getAdjacentChunks (int $x, int $z) | |
getAutoSave () | |
getBiome (int $x, int $y, int $z) | |
getBiomeId (int $x, int $y, int $z) | |
getBlock (Vector3 $pos, bool $cached=true, bool $addToCache=true) | |
getBlockAt (int $x, int $y, int $z) | |
getBlockAt (int $x, int $y, int $z, bool $cached=true, bool $addToCache=true) | |
getBlockCollisionBoxes (AxisAlignedBB $bb) | |
getBlockLightAt (int $x, int $y, int $z) | |
getChunk (int $chunkX, int $chunkZ) | |
getChunkEntities (int $chunkX, int $chunkZ) | |
getChunkListeners (int $chunkX, int $chunkZ) | |
getChunkLoaders (int $chunkX, int $chunkZ) | |
getChunkPlayers (int $chunkX, int $chunkZ) | |
getChunkTickRadius () | |
getCollidingEntities (AxisAlignedBB $bb, ?Entity $entity=null) | |
getCollisionBlocks (AxisAlignedBB $bb, bool $targetFirst=false) | |
getCollisionBoxes (Entity $entity, AxisAlignedBB $bb, bool $entities=true) | |
getDifficulty () | |
getDisplayName () | |
getEntities () | |
getEntity (int $entityId) | |
getFolderName () | |
getFullLight (Vector3 $pos) | |
getFullLightAt (int $x, int $y, int $z) | |
getHighestAdjacentBlockLight (int $x, int $y, int $z) | |
getHighestAdjacentFullLightAt (int $x, int $y, int $z) | |
getHighestAdjacentPotentialBlockSkyLight (int $x, int $y, int $z) | |
getHighestAdjacentPotentialLightAt (int $x, int $y, int $z) | |
getHighestAdjacentRealBlockSkyLight (int $x, int $y, int $z) | |
getHighestBlockAt (int $x, int $z) | |
getId () | |
getLoadedChunks () | |
getLogger () | |
getMaxY () | |
getMinY () | |
getNearbyEntities (AxisAlignedBB $bb, ?Entity $entity=null) | |
getNearestEntity (Vector3 $pos, float $maxDistance, string $entityType=Entity::class, bool $includeDead=false) | |
getOrLoadChunkAtPosition (Vector3 $pos) | |
getPlayers () | |
getPotentialBlockSkyLightAt (int $x, int $y, int $z) | |
getPotentialLight (Vector3 $pos) | |
getPotentialLightAt (int $x, int $y, int $z) | |
getProvider () | |
getRandomTickedBlocks () | |
getRealBlockSkyLightAt (int $x, int $y, int $z) | |
getSafeSpawn (?Vector3 $spawn=null) | |
getSeed () | |
getServer () | |
getSkyLightReduction () | |
getSpawnLocation () | |
getSunAngleDegrees () | |
getSunAnglePercentage () | |
getSunAngleRadians () | |
getTickingChunks () | |
getTickRateTime () | |
getTile (Vector3 $pos) | |
getTileAt (int $x, int $y, int $z) | |
getTime () | |
getTimeOfDay () | |
getViewersForPosition (Vector3 $pos) | |
isChunkGenerated (int $x, int $z) | |
isChunkInUse (int $x, int $z) | |
isChunkLoaded (int $x, int $z) | |
isChunkLocked (int $chunkX, int $chunkZ) | |
isChunkPopulated (int $x, int $z) | |
isDoingTick () | |
isInLoadedTerrain (Vector3 $pos) | |
isInWorld (int $x, int $y, int $z) | |
isLoaded () | |
isSpawnChunk (int $X, int $Z) | |
loadChunk (int $x, int $z) | |
lockChunk (int $chunkX, int $chunkZ, ChunkLockId $lockId) | |
notifyNeighbourBlockUpdate (Vector3 $pos) | |
onEntityMoved (Entity $entity) | |
onUnload () | |
orderChunkPopulation (int $chunkX, int $chunkZ, ?ChunkLoader $associatedChunkLoader) | |
registerChunkListener (ChunkListener $listener, int $chunkX, int $chunkZ) | |
registerChunkLoader (ChunkLoader $loader, int $chunkX, int $chunkZ, bool $autoLoad=true) | |
registerGeneratorToWorker (int $worker) | |
registerTickingChunk (ChunkTicker $ticker, int $chunkX, int $chunkZ) | |
removeEntity (Entity $entity) | |
removeOnUnloadCallback (\Closure $callback) | |
removeRandomTickedBlock (Block $block) | |
removeTile (Tile $tile) | |
requestChunkPopulation (int $chunkX, int $chunkZ, ?ChunkLoader $associatedChunkLoader) | |
requestSafeSpawn (?Vector3 $spawn=null) | |
save (bool $force=false) | |
saveChunks () | |
scheduleDelayedBlockUpdate (Vector3 $pos, int $delay) | |
sendTime (Player ... $targets) | |
setAutoSave (bool $value) | |
setBiomeId (int $x, int $y, int $z, int $biomeId) | |
setBlock (Vector3 $pos, Block $block, bool $update=true) | |
setBlockAt (int $x, int $y, int $z, Block $block) | |
setBlockAt (int $x, int $y, int $z, Block $block, bool $update=true) | |
setChunk (int $chunkX, int $chunkZ, Chunk $chunk) | |
setChunkTickRadius (int $radius) | |
setDifficulty (int $difficulty) | |
setDisplayName (string $name) | |
setSleepTicks (int $ticks) | |
setSpawnLocation (Vector3 $pos) | |
setTime (int $time) | |
startTime () | |
stopTime () | |
unloadChunk (int $x, int $z, bool $safe=true, bool $trySave=true) | |
unloadChunkRequest (int $x, int $z, bool $safe=true) | |
unloadChunks (bool $force=false) | |
unlockChunk (int $chunkX, int $chunkZ, ?ChunkLockId $lockId) | |
unregisterChunkListener (ChunkListener $listener, int $chunkX, int $chunkZ) | |
unregisterChunkListenerFromAll (ChunkListener $listener) | |
unregisterChunkLoader (ChunkLoader $loader, int $chunkX, int $chunkZ) | |
unregisterGenerator () | |
unregisterTickingChunk (ChunkTicker $ticker, int $chunkX, int $chunkZ) | |
updateAllLight (int $x, int $y, int $z) | |
useBreakOn (Vector3 $vector, Item &$item=null, ?Player $player=null, bool $createParticles=false, array &$returnedItems=[]) | |
useItemOn (Vector3 $vector, Item &$item, int $face, ?Vector3 $clickVector=null, ?Player $player=null, bool $playSound=false, array &$returnedItems=[]) | |
Static Public Member Functions | |
static | blockHash (int $x, int $y, int $z) |
static | chunkBlockHash (int $x, int $y, int $z) |
static | chunkHash (int $x, int $z) |
static | getBlockXYZ (int $hash, ?int &$x, ?int &$y, ?int &$z) |
static | getDifficultyFromString (string $str) |
static | getXZ (int $hash, ?int &$x, ?int &$z) |
Public Attributes | |
bool | $stopTime = false |
float | $tickRateTime = 0 |
WorldTimings | $timings |
array | $updateEntities = [] |
const | DEFAULT_TICKED_BLOCKS_PER_SUBCHUNK_PER_TICK = 3 |
const | DIFFICULTY_EASY = 1 |
const | DIFFICULTY_HARD = 3 |
const | DIFFICULTY_NORMAL = 2 |
const | DIFFICULTY_PEACEFUL = 0 |
const | TIME_DAY = 1000 |
const | TIME_FULL = 24000 |
const | TIME_MIDNIGHT = 18000 |
const | TIME_NIGHT = 13000 |
const | TIME_NOON = 6000 |
const | TIME_SUNRISE = 23000 |
const | TIME_SUNSET = 12000 |
const | Y_MAX = 320 |
const | Y_MIN = -64 |
Protected Member Functions | |
actuallyDoTick (int $currentTick) | |
@phpstan-type ChunkPosHash int @phpstan-type BlockPosHash int @phpstan-type ChunkBlockPosHash int
pocketmine\world\World::__construct | ( | private Server | $server, |
string | $name, | ||
private WritableWorldProvider | $provider, | ||
private AsyncPool | $workerPool ) |
Init the default world data
Definition at line 474 of file World.php.
References pocketmine\scheduler\AsyncPool\removeWorkerStartHook(), and pocketmine\server().
|
protected |
pocketmine\world\World::addEntity | ( | Entity | $entity | ) |
pocketmine\world\World::addOnUnloadCallback | ( | \Closure | $callback | ) |
pocketmine\world\World::addRandomTickedBlock | ( | Block | $block | ) |
|
static |
pocketmine\world\World::broadcastPacketToViewers | ( | Vector3 | $pos, |
ClientboundPacket | $packet ) |
pocketmine\world\World::cancelUnloadChunkRequest | ( | int | $x, |
int | $z ) |
|
static |
|
static |
pocketmine\world\World::clearCache | ( | bool | $force = false | ) |
pocketmine\world\World::computeSkyLightReduction | ( | ) |
pocketmine\world\World::computeSunAnglePercentage | ( | ) |
pocketmine\world\World::createBlockUpdatePackets | ( | array | $blocks | ) |
pocketmine\world\World::dropExperience | ( | Vector3 | $pos, |
int | $amount ) |
pocketmine\world\World::getAdjacentChunks | ( | int | $x, |
int | $z ) |
pocketmine\world\World::getBiome | ( | int | $x, |
int | $y, | ||
int | $z ) |
pocketmine\world\World::getBiomeId | ( | int | $x, |
int | $y, | ||
int | $z ) |
pocketmine\world\World::getBlock | ( | Vector3 | $pos, |
bool | $cached = true, | ||
bool | $addToCache = true ) |
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.
bool | $cached | Whether to use the block cache for getting the block (faster, but may be inaccurate) |
bool | $addToCache | Whether to cache the block object created by this method call. |
|
inherited |
Returns a Block object representing the block state at the given coordinates.
Implemented in pocketmine\world\SimpleChunkManager.
pocketmine\world\World::getBlockAt | ( | int | $x, |
int | $y, | ||
int | $z, | ||
bool | $cached = true, | ||
bool | $addToCache = true ) |
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.
bool | $cached | Whether to use the block cache for getting the block (faster, but may be inaccurate) |
bool | $addToCache | Whether to cache the block object created by this method call. |
pocketmine\world\World::getBlockCollisionBoxes | ( | AxisAlignedBB | $bb | ) |
pocketmine\world\World::getBlockLightAt | ( | int | $x, |
int | $y, | ||
int | $z ) |
|
static |
pocketmine\world\World::getChunk | ( | int | $chunkX, |
int | $chunkZ ) |
Implements pocketmine\world\ChunkManager.
pocketmine\world\World::getChunkEntities | ( | int | $chunkX, |
int | $chunkZ ) |
pocketmine\world\World::getChunkListeners | ( | int | $chunkX, |
int | $chunkZ ) |
pocketmine\world\World::getChunkLoaders | ( | int | $chunkX, |
int | $chunkZ ) |
pocketmine\world\World::getChunkPlayers | ( | int | $chunkX, |
int | $chunkZ ) |
Returns a list of players who have the target chunk within their view distance.
pocketmine\world\World::getChunkTickRadius | ( | ) |
pocketmine\world\World::getCollidingEntities | ( | AxisAlignedBB | $bb, |
?Entity | $entity = null ) |
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.
pocketmine\world\World::getCollisionBlocks | ( | AxisAlignedBB | $bb, |
bool | $targetFirst = false ) |
pocketmine\world\World::getCollisionBoxes | ( | Entity | $entity, |
AxisAlignedBB | $bb, | ||
bool | $entities = true ) |
World::getBlockCollisionBoxes()
instead (alongside World::getCollidingEntities()
if entity collision boxes are also required).Definition at line 1603 of file World.php.
References pocketmine\math\AxisAlignedBB\expandedCopy().
|
static |
pocketmine\world\World::getDisplayName | ( | ) |
pocketmine\world\World::getEntities | ( | ) |
pocketmine\world\World::getFolderName | ( | ) |
pocketmine\world\World::getFullLight | ( | Vector3 | $pos | ) |
pocketmine\world\World::getFullLightAt | ( | int | $x, |
int | $y, | ||
int | $z ) |
pocketmine\world\World::getHighestAdjacentBlockLight | ( | int | $x, |
int | $y, | ||
int | $z ) |
pocketmine\world\World::getHighestAdjacentFullLightAt | ( | int | $x, |
int | $y, | ||
int | $z ) |
pocketmine\world\World::getHighestAdjacentPotentialBlockSkyLight | ( | int | $x, |
int | $y, | ||
int | $z ) |
pocketmine\world\World::getHighestAdjacentPotentialLightAt | ( | int | $x, |
int | $y, | ||
int | $z ) |
pocketmine\world\World::getHighestAdjacentRealBlockSkyLight | ( | int | $x, |
int | $y, | ||
int | $z ) |
pocketmine\world\World::getHighestBlockAt | ( | int | $x, |
int | $z ) |
Gets the highest block Y value at a specific $x and $z
WorldException | if the terrain is not generated |
Definition at line 2606 of file World.php.
References pocketmine\world\format\Chunk\getHighestBlockAt().
|
final |
Returns the unique world identifier
Definition at line 610 of file World.php.
Referenced by pocketmine\world\generator\GeneratorRegisterTask\__construct().
pocketmine\world\World::getLoadedChunks | ( | ) |
pocketmine\world\World::getMaxY | ( | ) |
Returns the highest buildable Y coordinate of the world
Implements pocketmine\world\ChunkManager.
Definition at line 3188 of file World.php.
Referenced by pocketmine\world\generator\GeneratorRegisterTask\__construct().
pocketmine\world\World::getMinY | ( | ) |
Returns the lowest buildable Y coordinate of the world
Implements pocketmine\world\ChunkManager.
Definition at line 3184 of file World.php.
Referenced by pocketmine\world\generator\GeneratorRegisterTask\__construct().
pocketmine\world\World::getNearbyEntities | ( | AxisAlignedBB | $bb, |
?Entity | $entity = null ) |
pocketmine\world\World::getNearestEntity | ( | Vector3 | $pos, |
float | $maxDistance, | ||
string | $entityType = Entity::class, | ||
bool | $includeDead = false ) |
Returns the closest Entity to the specified position, within the given radius.
string | $entityType | Class of entity to use for instanceof |
bool | $includeDead | Whether to include entitites which are dead @phpstan-template TEntity of Entity @phpstan-param class-string<TEntity> $entityType |
pocketmine\world\World::getOrLoadChunkAtPosition | ( | Vector3 | $pos | ) |
pocketmine\world\World::getPlayers | ( | ) |
pocketmine\world\World::getPotentialBlockSkyLightAt | ( | int | $x, |
int | $y, | ||
int | $z ) |
pocketmine\world\World::getPotentialLight | ( | Vector3 | $pos | ) |
pocketmine\world\World::getPotentialLightAt | ( | int | $x, |
int | $y, | ||
int | $z ) |
pocketmine\world\World::getRandomTickedBlocks | ( | ) |
pocketmine\world\World::getRealBlockSkyLightAt | ( | int | $x, |
int | $y, | ||
int | $z ) |
pocketmine\world\World::getSafeSpawn | ( | ?Vector3 | $spawn = null | ) |
pocketmine\world\World::getSeed | ( | ) |
Gets the world seed
Definition at line 3180 of file World.php.
Referenced by pocketmine\world\generator\GeneratorRegisterTask\__construct().
pocketmine\world\World::getSkyLightReduction | ( | ) |
pocketmine\world\World::getSpawnLocation | ( | ) |
pocketmine\world\World::getSunAngleDegrees | ( | ) |
pocketmine\world\World::getSunAnglePercentage | ( | ) |
pocketmine\world\World::getSunAngleRadians | ( | ) |
pocketmine\world\World::getTickingChunks | ( | ) |
pocketmine\world\World::getTile | ( | Vector3 | $pos | ) |
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.
pocketmine\world\World::getTileAt | ( | int | $x, |
int | $y, | ||
int | $z ) |
pocketmine\world\World::getTime | ( | ) |
pocketmine\world\World::getTimeOfDay | ( | ) |
pocketmine\world\World::getViewersForPosition | ( | Vector3 | $pos | ) |
|
static |
pocketmine\world\World::isChunkGenerated | ( | int | $x, |
int | $z ) |
pocketmine\world\World::isChunkLocked | ( | int | $chunkX, |
int | $chunkZ ) |
pocketmine\world\World::isChunkPopulated | ( | int | $x, |
int | $z ) |
pocketmine\world\World::isInLoadedTerrain | ( | Vector3 | $pos | ) |
pocketmine\world\World::isInWorld | ( | int | $x, |
int | $y, | ||
int | $z ) |
Returns whether the specified coordinates are within the valid world boundaries, taking world format limitations into account.
Implements pocketmine\world\ChunkManager.
pocketmine\world\World::isSpawnChunk | ( | int | $X, |
int | $Z ) |
pocketmine\world\World::loadChunk | ( | int | $x, |
int | $z ) |
pocketmine\world\World::lockChunk | ( | int | $chunkX, |
int | $chunkZ, | ||
ChunkLockId | $lockId ) |
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.
pocketmine\world\World::notifyNeighbourBlockUpdate | ( | Vector3 | $pos | ) |
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
pocketmine\world\World::orderChunkPopulation | ( | int | $chunkX, |
int | $chunkZ, | ||
?ChunkLoader | $associatedChunkLoader ) |
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.
@phpstan-return Promise<Chunk>
pocketmine\world\World::registerChunkListener | ( | ChunkListener | $listener, |
int | $chunkX, | ||
int | $chunkZ ) |
pocketmine\world\World::registerChunkLoader | ( | ChunkLoader | $loader, |
int | $chunkX, | ||
int | $chunkZ, | ||
bool | $autoLoad = true ) |
pocketmine\world\World::registerGeneratorToWorker | ( | int | $worker | ) |
pocketmine\world\World::registerTickingChunk | ( | ChunkTicker | $ticker, |
int | $chunkX, | ||
int | $chunkZ ) |
pocketmine\world\World::removeEntity | ( | Entity | $entity | ) |
pocketmine\world\World::removeOnUnloadCallback | ( | \Closure | $callback | ) |
pocketmine\world\World::removeRandomTickedBlock | ( | Block | $block | ) |
pocketmine\world\World::requestChunkPopulation | ( | int | $chunkX, |
int | $chunkZ, | ||
?ChunkLoader | $associatedChunkLoader ) |
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).
@phpstan-return Promise<Chunk>
pocketmine\world\World::requestSafeSpawn | ( | ?Vector3 | $spawn = null | ) |
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.
pocketmine\world\World::scheduleDelayedBlockUpdate | ( | Vector3 | $pos, |
int | $delay ) |
pocketmine\world\World::setBiomeId | ( | int | $x, |
int | $y, | ||
int | $z, | ||
int | $biomeId ) |
|
inherited |
Sets the block at the given coordinates to the block state specified.
InvalidArgumentException
Implemented in pocketmine\world\SimpleChunkManager.
pocketmine\world\World::setBlockAt | ( | int | $x, |
int | $y, | ||
int | $z, | ||
Block | $block, | ||
bool | $update = true ) |
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.
InvalidArgumentException if the position is out of the world bounds
pocketmine\world\World::setChunk | ( | int | $chunkX, |
int | $chunkZ, | ||
Chunk | $chunk ) |
Implements pocketmine\world\ChunkManager.
pocketmine\world\World::setChunkTickRadius | ( | int | $radius | ) |
pocketmine\world\World::setDisplayName | ( | string | $name | ) |
pocketmine\world\World::setSpawnLocation | ( | Vector3 | $pos | ) |
pocketmine\world\World::setTime | ( | int | $time | ) |
pocketmine\world\World::startTime | ( | ) |
pocketmine\world\World::stopTime | ( | ) |
pocketmine\world\World::unloadChunk | ( | int | $x, |
int | $z, | ||
bool | $safe = true, | ||
bool | $trySave = true ) |
pocketmine\world\World::unloadChunkRequest | ( | int | $x, |
int | $z, | ||
bool | $safe = true ) |
pocketmine\world\World::unloadChunks | ( | bool | $force = false | ) |
pocketmine\world\World::unlockChunk | ( | int | $chunkX, |
int | $chunkZ, | ||
?ChunkLockId | $lockId ) |
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.
pocketmine\world\World::unregisterChunkListener | ( | ChunkListener | $listener, |
int | $chunkX, | ||
int | $chunkZ ) |
pocketmine\world\World::unregisterChunkListenerFromAll | ( | ChunkListener | $listener | ) |
pocketmine\world\World::unregisterChunkLoader | ( | ChunkLoader | $loader, |
int | $chunkX, | ||
int | $chunkZ ) |
pocketmine\world\World::unregisterTickingChunk | ( | ChunkTicker | $ticker, |
int | $chunkX, | ||
int | $chunkZ ) |
pocketmine\world\World::updateAllLight | ( | int | $x, |
int | $y, | ||
int | $z ) |
pocketmine\world\World::useBreakOn | ( | Vector3 | $vector, |
Item & | $item = null, | ||
?Player | $player = null, | ||
bool | $createParticles = false, | ||
array & | $returnedItems = [] ) |
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.
Item | &$item | reference parameter (if null, can break anything) |
Item[] | &$returnedItems | Items to be added to the target's inventory (or dropped, if the inventory is full) @phpstan-param-out Item $item |
pocketmine\world\World::useItemOn | ( | Vector3 | $vector, |
Item & | $item, | ||
int | $face, | ||
?Vector3 | $clickVector = null, | ||
?Player | $player = null, | ||
bool | $playSound = false, | ||
array & | $returnedItems = [] ) |
Uses a item on a position and face, placing it or activating the block
Player | null | $player | default null |
bool | $playSound | Whether to play a block-place sound if the block was placed successfully. |
Item[] | &$returnedItems | Items to be added to the target's inventory (or dropped if the inventory is full) |
WorldTimings pocketmine\world\World::$timings |
const pocketmine\world\World::DEFAULT_TICKED_BLOCKS_PER_SUBCHUNK_PER_TICK = 3 |