PocketMine-MP  1.4 - API 1.10.0
 All Classes Namespaces Functions Variables Pages
pocketmine\level\Level Class Reference
+ Inheritance diagram for pocketmine\level\Level:
+ Collaboration diagram for pocketmine\level\Level:

Public Member Functions

 initLevel ()
 
 getBlockMetadata ()
 
 getServer ()
 
 getProvider ()
 
 getId ()
 
 close ()
 
 getAutoSave ()
 
 setAutoSave ($value)
 
 unload ($force=false)
 
 getUsingChunk ($X, $Z)
 
 useChunk ($X, $Z, Player $player)
 
 freeChunk ($X, $Z, Player $player)
 
 checkTime ()
 
 sendTime ()
 
 clearCache ()
 
 __debugInfo ()
 
 save ($force=false)
 
 saveChunks ()
 
 updateAround (Vector3 $pos)
 
 scheduleUpdate (Vector3 $pos, $delay)
 
 getCollisionBlocks (AxisAlignedBB $bb)
 
 isFullBlock (Vector3 $pos)
 
 getCollisionCubes (Entity $entity, AxisAlignedBB $bb, $entities=true)
 
 getFullLight (Vector3 $pos)
 
 getFullBlock ($x, $y, $z)
 
 getBlock (Vector3 $pos, $cached=true)
 
 updateAllLight (Vector3 $pos)
 
 updateBlockSkyLight ($x, $y, $z)
 
 setBlock (Vector3 $pos, Block $block, $direct=false, $update=true)
 
 dropItem (Vector3 $source, Item $item, Vector3 $motion=null, $delay=10)
 
 useBreakOn (Vector3 $vector, Item &$item=null, Player $player=null)
 
 useItemOn (Vector3 $vector, Item &$item, $face, $fx=0.0, $fy=0.0, $fz=0.0, Player $player=null)
 
 getEntity ($entityId)
 
 getEntities ()
 
 getCollidingEntities (AxisAlignedBB $bb, Entity $entity=null)
 
 getNearbyEntities (AxisAlignedBB $bb, Entity $entity=null)
 
 getTiles ()
 
 getTileById ($tileId)
 
 getPlayers ()
 
 getTile (Vector3 $pos)
 
 getChunkEntities ($X, $Z)
 
 getChunkTiles ($X, $Z)
 
 getBlockIdAt ($x, $y, $z)
 
 setBlockIdAt ($x, $y, $z, $id)
 
 getBlockDataAt ($x, $y, $z)
 
 setBlockDataAt ($x, $y, $z, $data)
 
 getBlockSkyLightAt ($x, $y, $z)
 
 setBlockSkyLightAt ($x, $y, $z, $level)
 
 getBlockLightAt ($x, $y, $z)
 
 setBlockLightAt ($x, $y, $z, $level)
 
 getBiomeId ($x, $z)
 
 getBiomeColor ($x, $z)
 
 getHeightMap ($x, $z)
 
 setBiomeId ($x, $z, $biomeId)
 
 setBiomeColor ($x, $z, $R, $G, $B)
 
 setHeightMap ($x, $z, $value)
 
 getChunk ($x, $z, $create=false)
 
 getChunkAt ($x, $z, $create=false)
 
 generateChunkCallback ($x, $z, FullChunk $chunk)
 
 setChunk ($x, $z, FullChunk $chunk, $unload=true)
 
 getHighestBlockAt ($x, $z)
 
 isChunkLoaded ($x, $z)
 
 isChunkGenerated ($x, $z)
 
 isChunkPopulated ($x, $z)
 
 getSpawnLocation ()
 
 setSpawnLocation (Vector3 $pos)
 
 requestChunk ($x, $z, Player $player, $order=LevelProvider::ORDER_ZXY)
 
 removeEntity (Entity $entity)
 
 addEntity (Entity $entity)
 
 addTile (Tile $tile)
 
 removeTile (Tile $tile)
 
 isChunkInUse ($x, $z)
 
 loadChunk ($x, $z, $generate=true)
 
 unloadChunkRequest ($x, $z, $safe=true)
 
 cancelUnloadChunkRequest ($x, $z)
 
 unloadChunk ($x, $z, $safe=true)
 
 isSpawnChunk ($X, $Z)
 
 getSpawn ()
 
 getSafeSpawn ($spawn=null)
 
 setSpawn (Vector3 $pos)
 
 getTime ()
 
 getName ()
 
 getFolderName ()
 
 setTime ($time)
 
 stopTime ()
 
 startTime ()
 
 getSeed ()
 
 setSeed ($seed)
 
 generateChunk ($x, $z)
 
 regenerateChunk ($x, $z)
 
 doChunkGarbageCollection ()
 
 setMetadata ($metadataKey, MetadataValue $metadataValue)
 
 getMetadata ($metadataKey)
 
 hasMetadata ($metadataKey)
 
 removeMetadata ($metadataKey, Plugin $plugin)
 

Static Public Member Functions

static chunkHash ($x, $z)
 
static blockHash ($x, $y, $z)
 
static getBlockXYZ ($hash, &$x, &$y, &$z)
 
static getXZ ($hash, &$x, &$z)
 

Public Attributes

const BLOCK_UPDATE_NORMAL = 1
 
const BLOCK_UPDATE_RANDOM = 2
 
const BLOCK_UPDATE_SCHEDULED = 3
 
const BLOCK_UPDATE_WEAK = 4
 
const BLOCK_UPDATE_TOUCH = 5
 
const TIME_DAY = 0
 
const TIME_SUNSET = 12000
 
const TIME_NIGHT = 14000
 
const TIME_SUNRISE = 23000
 
const TIME_FULL = 24000
 
 $updateEntities = []
 
 $updateTiles = []
 
 $stopTime
 
 $timings
 

Static Public Attributes

static $COMPRESSION_LEVEL = 8
 

Protected Member Functions

 queueUnloadChunk ($x, $z)
 
 unloadChunks ()
 

Protected Attributes

 $tiles = []
 
 $players = []
 
 $entities = []
 
 $blockCache = []
 
 $server
 
 $levelId
 
 $provider
 
 $usedChunks = []
 
 $unloadQueue
 
 $time
 
 $changedBlocks = []
 
 $changedCount = []
 
 $chunkTickRadius
 
 $chunkTickList = []
 
 $chunksPerTick
 
 $clearChunksOnTick
 
 $randomTickBlocks
 
 $generator
 

Detailed Description

Definition at line 101 of file Level.php.

Member Function Documentation

pocketmine\level\Level::addEntity ( Entity  $entity)
Parameters
Entity$entity
Exceptions
LevelException

Definition at line 1937 of file Level.php.

References pocketmine\level\Position\getLevel().

+ Here is the call graph for this function:

pocketmine\level\Level::addTile ( Tile  $tile)
Parameters
Tile$tile
Exceptions
LevelException

Definition at line 1952 of file Level.php.

References pocketmine\level\Position\getLevel().

+ Here is the call graph for this function:

pocketmine\level\Level::checkTime ( )

WARNING: Do not use this, it's only for internal use. Changes to this function won't be recorded on the version.

Definition at line 456 of file Level.php.

References pocketmine\level\Level\stopTime().

+ Here is the call graph for this function:

static pocketmine\level\Level::chunkHash (   $x,
  $z 
)
static
pocketmine\level\Level::dropItem ( Vector3  $source,
Item  $item,
Vector3  $motion = null,
  $delay = 10 
)
Parameters
Vector3$source
Item$item
Vector3$motion
int$delay

Definition at line 1159 of file Level.php.

References pocketmine\entity\Entity\createEntity(), and pocketmine\level\Level\getChunk().

Referenced by pocketmine\level\Level\useBreakOn().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\level\Level::freeChunk (   $X,
  $Z,
Player  $player 
)

WARNING: Do not use this, it's only for internal use. Changes to this function won't be recorded on the version.

Parameters
int$X
int$Z
Player$player

Definition at line 447 of file Level.php.

References pocketmine\level\Level\chunkHash().

+ Here is the call graph for this function:

pocketmine\level\Level::getAutoSave ( )
Returns
bool

Definition at line 362 of file Level.php.

Referenced by pocketmine\level\Level\save().

+ Here is the caller graph for this function:

pocketmine\level\Level::getBiomeColor (   $x,
  $z 
)
Parameters
int$x
int$z
Returns
int[]

Definition at line 1680 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::getBiomeId (   $x,
  $z 
)
Parameters
int$x
int$z
Returns
int

Definition at line 1670 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::getBlock ( Vector3  $pos,
  $cached = true 
)

Gets the Block object on the Vector3 location

Parameters
Vector3$pos
boolean$cached
Returns
Block

Definition at line 960 of file Level.php.

References pocketmine\level\Level\chunkHash().

Referenced by pocketmine\level\Level\getCollisionBlocks(), pocketmine\level\Level\getCollisionCubes(), pocketmine\level\Level\isFullBlock(), pocketmine\level\Level\updateAround(), pocketmine\level\Level\useBreakOn(), and pocketmine\level\Level\useItemOn().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\level\Level::getBlockDataAt (   $x,
  $y,
  $z 
)

Gets the raw block metadata

Parameters
int$x
int$y
int$z
Returns
int 0-15

Implements pocketmine\level\ChunkManager.

Definition at line 1597 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::getBlockIdAt (   $x,
  $y,
  $z 
)

Gets the raw block id.

Parameters
int$x
int$y
int$z
Returns
int 0-255

Implements pocketmine\level\ChunkManager.

Definition at line 1571 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::getBlockLightAt (   $x,
  $y,
  $z 
)

Gets the raw block light level

Parameters
int$x
int$y
int$z
Returns
int 0-15

Definition at line 1648 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::getBlockMetadata ( )
Returns
BlockMetadataStore

Definition at line 314 of file Level.php.

pocketmine\level\Level::getBlockSkyLightAt (   $x,
  $y,
  $z 
)

Gets the raw block skylight level

Parameters
int$x
int$y
int$z
Returns
int 0-15

Definition at line 1623 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::getChunk (   $x,
  $z,
  $create = false 
)

Gets the Chunk object

Parameters
int$x
int$z
bool$createWhether to generate the chunk if it does not exist
Returns
Chunk

Definition at line 1732 of file Level.php.

References pocketmine\level\Level\chunkHash(), and pocketmine\level\Level\loadChunk().

Referenced by pocketmine\level\Level\dropItem(), pocketmine\level\Level\getBiomeColor(), pocketmine\level\Level\getBiomeId(), pocketmine\level\Level\getBlockDataAt(), pocketmine\level\Level\getBlockIdAt(), pocketmine\level\Level\getBlockLightAt(), pocketmine\level\Level\getBlockSkyLightAt(), pocketmine\level\Level\getChunkAt(), pocketmine\level\Level\getChunkEntities(), pocketmine\level\Level\getChunkTiles(), pocketmine\level\Level\getFullBlock(), pocketmine\level\Level\getHeightMap(), pocketmine\level\Level\getHighestBlockAt(), pocketmine\level\Level\getSafeSpawn(), pocketmine\level\Level\getTile(), pocketmine\level\Level\isChunkGenerated(), pocketmine\level\Level\isChunkPopulated(), pocketmine\level\Level\setBiomeColor(), pocketmine\level\Level\setBiomeId(), pocketmine\level\Level\setBlock(), pocketmine\level\Level\setBlockDataAt(), pocketmine\level\Level\setBlockIdAt(), pocketmine\level\Level\setBlockLightAt(), pocketmine\level\Level\setBlockSkyLightAt(), pocketmine\level\Level\setHeightMap(), and pocketmine\level\Level\useItemOn().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\level\Level::getChunkAt (   $x,
  $z,
  $create = false 
)
Parameters
int$x
int$z
bool$create
Returns
Chunk
Deprecated:

Definition at line 1751 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::getChunkEntities (   $X,
  $Z 
)

Returns a list of the entities on a given chunk

Parameters
int$X
int$Z
Returns
Entity[]

Definition at line 1546 of file Level.php.

References pocketmine\level\Level\getChunk().

Referenced by pocketmine\level\Level\getCollidingEntities(), and pocketmine\level\Level\getNearbyEntities().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\level\Level::getChunkTiles (   $X,
  $Z 
)

Gives a list of the Tile entities on a given chunk

Parameters
int$X
int$Z
Returns
Tile[]

Definition at line 1558 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::getCollidingEntities ( AxisAlignedBB  $bb,
Entity  $entity = null 
)

Returns the entities colliding the current one inside the AxisAlignedBB

Parameters
AxisAlignedBB$bb
Entity$entity
Returns
Entity[]

Definition at line 1442 of file Level.php.

References pocketmine\level\Level\getChunkEntities().

Referenced by pocketmine\level\Level\getCollisionCubes(), and pocketmine\level\Level\useItemOn().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\level\Level::getCollisionBlocks ( AxisAlignedBB  $bb)
Parameters
AxisAlignedBB$bb
Returns
Block[]

Definition at line 776 of file Level.php.

References pocketmine\level\Level\getBlock().

+ Here is the call graph for this function:

pocketmine\level\Level::getCollisionCubes ( Entity  $entity,
AxisAlignedBB  $bb,
  $entities = true 
)
Parameters
Entity$entity
AxisAlignedBB$bb
boolean$entities
Returns
AxisAlignedBB[]

Definition at line 824 of file Level.php.

References pocketmine\level\Level\getBlock(), and pocketmine\level\Level\getCollidingEntities().

+ Here is the call graph for this function:

pocketmine\level\Level::getEntities ( )

Gets the list of all the entities in this level

Returns
Entity[]

Definition at line 1430 of file Level.php.

pocketmine\level\Level::getEntity (   $entityId)
Parameters
int$entityId
Returns
Entity

Definition at line 1421 of file Level.php.

pocketmine\level\Level::getFolderName ( )

Returns the Level folder name

Returns
string

Definition at line 2175 of file Level.php.

pocketmine\level\Level::getFullBlock (   $x,
  $y,
  $z 
)
Parameters
$x
$y
$z
Returns
int bitmap, (id << 4) | data

Definition at line 948 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::getHeightMap (   $x,
  $z 
)
Parameters
int$x
int$z
Returns
int

Definition at line 1690 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::getHighestBlockAt (   $x,
  $z 
)

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

Parameters
int$x
int$z
Returns
int 0-127

Definition at line 1792 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::getId ( )
final

Returns the unique level identifier

Returns
int

Definition at line 337 of file Level.php.

Referenced by pocketmine\level\generator\GenerationInstanceManager\closeLevel(), pocketmine\level\generator\GenerationRequestManager\closeLevel(), pocketmine\level\generator\GenerationRequestManager\openLevel(), pocketmine\level\generator\GenerationInstanceManager\openLevel(), pocketmine\level\Level\setBlock(), and pocketmine\Server\unloadLevel().

+ Here is the caller graph for this function:

pocketmine\level\Level::getMetadata (   $metadataKey)

Returns a list of previously set metadata values from the implementing object's metadata store.

Parameters
string$metadataKey
Returns
MetadataValue[]

Implements pocketmine\metadata\Metadatable.

Definition at line 2283 of file Level.php.

pocketmine\level\Level::getName ( )

Returns the Level name

Returns
string

Definition at line 2166 of file Level.php.

Referenced by pocketmine\level\Level\unload().

+ Here is the caller graph for this function:

pocketmine\level\Level::getNearbyEntities ( AxisAlignedBB  $bb,
Entity  $entity = null 
)

Returns the entities near the current one inside the AxisAlignedBB

Parameters
AxisAlignedBB$bb
Entity$entity
Returns
Entity[]

Definition at line 1473 of file Level.php.

References pocketmine\level\Level\getChunkEntities().

Referenced by pocketmine\level\Level\setBlock().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\level\Level::getPlayers ( )

Returns a list of the players in this level

Returns
Player[]

Definition at line 1517 of file Level.php.

Referenced by pocketmine\level\Level\unload().

+ Here is the caller graph for this function:

pocketmine\level\Level::getProvider ( )
final
Returns
LevelProvider

Definition at line 328 of file Level.php.

pocketmine\level\Level::getSafeSpawn (   $spawn = null)
Parameters
Vector3$spawndefault null
Returns
bool|Position

Definition at line 2108 of file Level.php.

References pocketmine\level\Level\getChunk(), and pocketmine\level\Level\getSpawnLocation().

+ Here is the call graph for this function:

pocketmine\level\Level::getSeed ( )

Gets the level seed

Returns
int

Definition at line 2210 of file Level.php.

Referenced by pocketmine\level\generator\GenerationRequestManager\openLevel(), and pocketmine\level\generator\GenerationInstanceManager\openLevel().

+ Here is the caller graph for this function:

pocketmine\level\Level::getServer ( )
Returns
Server

Definition at line 321 of file Level.php.

pocketmine\level\Level::getSpawn ( )

Returns the raw spawnpoint

Deprecated:
Returns
Position

Definition at line 2099 of file Level.php.

References pocketmine\level\Level\getSpawnLocation().

+ Here is the call graph for this function:

pocketmine\level\Level::getSpawnLocation ( )

Returns a Position pointing to the spawn

Returns
Position

Definition at line 1833 of file Level.php.

Referenced by pocketmine\level\Level\getSafeSpawn(), pocketmine\level\Level\getSpawn(), pocketmine\level\Level\setSpawnLocation(), pocketmine\level\Level\useBreakOn(), and pocketmine\level\Level\useItemOn().

+ Here is the caller graph for this function:

pocketmine\level\Level::getTile ( Vector3  $pos)

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

Parameters
Vector3$pos
Returns
Tile

Definition at line 1528 of file Level.php.

References pocketmine\level\Level\getChunk().

Referenced by pocketmine\level\Level\useBreakOn().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\level\Level::getTileById (   $tileId)
Parameters
$tileId
Returns
Tile

Definition at line 1508 of file Level.php.

pocketmine\level\Level::getTiles ( )

Returns a list of the Tile entities in this level

Returns
Tile[]

Definition at line 1499 of file Level.php.

pocketmine\level\Level::getTime ( )

Gets the current time

Returns
int

Definition at line 2157 of file Level.php.

pocketmine\level\Level::getUsingChunk (   $X,
  $Z 
)

Gets the chunks being used by players

Parameters
int$X
int$Z
Returns
Player[]

Definition at line 421 of file Level.php.

References pocketmine\level\Level\chunkHash().

Referenced by pocketmine\level\Level\setBlock().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\level\Level::hasMetadata (   $metadataKey)

Tests to see whether the implementing object contains the given metadata value in its metadata store.

Parameters
string$metadataKey
Returns
boolean

Implements pocketmine\metadata\Metadatable.

Definition at line 2287 of file Level.php.

pocketmine\level\Level::isChunkGenerated (   $x,
  $z 
)
Parameters
int$x
int$z
Returns
bool

Definition at line 1812 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::isChunkInUse (   $x,
  $z 
)
Parameters
int$x
int$z
Returns
bool

Definition at line 1979 of file Level.php.

References pocketmine\level\Level\chunkHash().

+ Here is the call graph for this function:

pocketmine\level\Level::isChunkLoaded (   $x,
  $z 
)
Parameters
int$x
int$z
Returns
bool

Definition at line 1802 of file Level.php.

References pocketmine\level\Level\chunkHash().

+ Here is the call graph for this function:

pocketmine\level\Level::isChunkPopulated (   $x,
  $z 
)
Parameters
int$x
int$z
Returns
bool

Definition at line 1823 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::isFullBlock ( Vector3  $pos)
Parameters
Vector3$pos
Returns
bool

Definition at line 807 of file Level.php.

References pocketmine\level\Level\getBlock().

+ Here is the call graph for this function:

pocketmine\level\Level::isSpawnChunk (   $X,
  $Z 
)

Returns true if the spawn is part of the spawn

Parameters
int$X
int$Z
Returns
bool

Definition at line 2086 of file Level.php.

pocketmine\level\Level::loadChunk (   $x,
  $z,
  $generate = true 
)
Parameters
int$x
int$z
bool$generate
Returns
bool

Definition at line 1990 of file Level.php.

References pocketmine\level\Level\chunkHash().

Referenced by pocketmine\level\Level\getChunk(), and pocketmine\level\Level\useChunk().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\level\Level::removeEntity ( Entity  $entity)

Removes the entity from the level index

Parameters
Entity$entity
Exceptions
LevelException

Definition at line 1916 of file Level.php.

References pocketmine\level\Position\getLevel().

+ Here is the call graph for this function:

pocketmine\level\Level::removeMetadata (   $metadataKey,
Plugin  $owningPlugin 
)

Removes the given metadata value from the implementing object's metadata store.

Parameters
string$metadataKey
Plugin$owningPlugin
Returns
void

Implements pocketmine\metadata\Metadatable.

Definition at line 2291 of file Level.php.

pocketmine\level\Level::removeTile ( Tile  $tile)
Parameters
Tile$tile
Exceptions
LevelException

Definition at line 1964 of file Level.php.

References pocketmine\level\Position\getLevel().

+ Here is the call graph for this function:

pocketmine\level\Level::save (   $force = false)
Parameters
bool$force
Returns
bool

Definition at line 697 of file Level.php.

References pocketmine\level\Level\getAutoSave().

+ Here is the call graph for this function:

pocketmine\level\Level::scheduleUpdate ( Vector3  $pos,
  $delay 
)
Parameters
Vector3$pos
int$delay

Definition at line 763 of file Level.php.

pocketmine\level\Level::sendTime ( )

WARNING: Do not use this, it's only for internal use. Changes to this function won't be recorded on the version.

Definition at line 468 of file Level.php.

References pocketmine\Server\broadcastPacket(), and pocketmine\level\Level\stopTime().

Referenced by pocketmine\level\Level\setTime(), pocketmine\level\Level\startTime(), and pocketmine\level\Level\stopTime().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\level\Level::setAutoSave (   $value)
Parameters
bool$value

Definition at line 369 of file Level.php.

pocketmine\level\Level::setBiomeColor (   $x,
  $z,
  $R,
  $G,
  $B 
)
Parameters
int$x
int$z
int$R
int$G
int$B

Definition at line 1710 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::setBiomeId (   $x,
  $z,
  $biomeId 
)
Parameters
int$x
int$z
int$biomeId

Definition at line 1699 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::setBlock ( Vector3  $pos,
Block  $block,
  $direct = false,
  $update = true 
)

Sets on Vector3 the data from a Block object, does block updates and puts the changes to the send queue.

If $direct is true, it'll send changes directly to players. if false, it'll be queued and the best way to send queued changes will be done in the next tick. This way big changes can be sent on a single chunk update packet instead of thousands of packets.

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

Parameters
Vector3$pos
Block$block
bool$direct
bool$update
Returns
bool

Definition at line 1094 of file Level.php.

References pocketmine\Server\broadcastPacket(), pocketmine\level\Level\chunkHash(), pocketmine\level\Level\getChunk(), pocketmine\block\Block\getDamage(), pocketmine\level\Level\getId(), pocketmine\block\Block\getId(), pocketmine\level\Level\getNearbyEntities(), pocketmine\level\Level\getUsingChunk(), pocketmine\block\Block\position(), pocketmine\utils\Cache\remove(), pocketmine\math\Vector3\setComponents(), and pocketmine\level\Level\updateAround().

Referenced by pocketmine\level\Level\useItemOn().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\level\Level::setBlockDataAt (   $x,
  $y,
  $z,
  $data 
)

Sets the raw block metadata.

Parameters
int$x
int$y
int$z
int$data0-15

Implements pocketmine\level\ChunkManager.

Definition at line 1609 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::setBlockIdAt (   $x,
  $y,
  $z,
  $id 
)

Sets the raw block id.

Parameters
int$x
int$y
int$z
int$id0-255

Implements pocketmine\level\ChunkManager.

Definition at line 1583 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::setBlockLightAt (   $x,
  $y,
  $z,
  $level 
)

Sets the raw block light level.

Parameters
int$x
int$y
int$z
int$level0-15

Definition at line 1660 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::setBlockSkyLightAt (   $x,
  $y,
  $z,
  $level 
)

Sets the raw block skylight level.

Parameters
int$x
int$y
int$z
int$level0-15

Definition at line 1635 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::setHeightMap (   $x,
  $z,
  $value 
)
Parameters
int$x
int$z
int$value

Definition at line 1719 of file Level.php.

References pocketmine\level\Level\getChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::setMetadata (   $metadataKey,
MetadataValue  $newMetadataValue 
)

Sets a metadata value in the implementing object's metadata store.

Parameters
string$metadataKey
MetadataValue$newMetadataValue
Returns
void

Implements pocketmine\metadata\Metadatable.

Definition at line 2279 of file Level.php.

pocketmine\level\Level::setSeed (   $seed)

Sets the seed for the level

Parameters
int$seed

Definition at line 2219 of file Level.php.

pocketmine\level\Level::setSpawn ( Vector3  $pos)

Sets the spawnpoint

Parameters
Vector3$pos
Deprecated:

Definition at line 2148 of file Level.php.

References pocketmine\level\Level\setSpawnLocation().

+ Here is the call graph for this function:

pocketmine\level\Level::setSpawnLocation ( Vector3  $pos)

Sets the level spawn location

Parameters
Vector3$pos

Definition at line 1842 of file Level.php.

References pocketmine\level\Level\getSpawnLocation().

Referenced by pocketmine\level\Level\setSpawn().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\level\Level::setTime (   $time)

Sets the current time on the level

Parameters
int$time

Definition at line 2184 of file Level.php.

References pocketmine\level\Level\sendTime().

+ Here is the call graph for this function:

pocketmine\level\Level::startTime ( )

Start the time again, if it was stopped

Definition at line 2200 of file Level.php.

References pocketmine\level\Level\sendTime(), and pocketmine\level\Level\stopTime().

+ Here is the call graph for this function:

pocketmine\level\Level::stopTime ( )

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

Definition at line 2192 of file Level.php.

References pocketmine\level\Level\sendTime().

Referenced by pocketmine\level\Level\checkTime(), pocketmine\level\Level\sendTime(), and pocketmine\level\Level\startTime().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\level\Level::unload (   $force = false)

Unloads the current level from memory safely

Parameters
bool$forcedefault false, force unload of default level
Returns
bool

Definition at line 380 of file Level.php.

References pocketmine\level\Level\getName(), and pocketmine\level\Level\getPlayers().

Referenced by pocketmine\Server\unloadLevel().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\level\Level::updateAround ( Vector3  $pos)
Parameters
Vector3$pos

Definition at line 727 of file Level.php.

References pocketmine\level\Level\getBlock().

Referenced by pocketmine\level\Level\setBlock().

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

pocketmine\level\Level::useBreakOn ( Vector3  $vector,
Item $item = null,
Player  $player = null 
)

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.

Parameters
Vector3$vector
Item&$item(if null, can break anything)
Player$player
Returns
boolean

Definition at line 1201 of file Level.php.

References pocketmine\math\Vector3\add(), pocketmine\level\Level\dropItem(), pocketmine\level\Level\getBlock(), pocketmine\level\Level\getSpawnLocation(), and pocketmine\level\Level\getTile().

+ Here is the call graph for this function:

pocketmine\level\Level::useChunk (   $X,
  $Z,
Player  $player 
)

WARNING: Do not use this, it's only for internal use. Changes to this function won't be recorded on the version.

Parameters
int$X
int$Z
Player$player

Definition at line 433 of file Level.php.

References pocketmine\level\Level\chunkHash(), and pocketmine\level\Level\loadChunk().

+ Here is the call graph for this function:

pocketmine\level\Level::useItemOn ( Vector3  $vector,
Item $item,
  $face,
  $fx = 0.0,
  $fy = 0.0,
  $fz = 0.0,
Player  $player = null 
)

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

Parameters
Vector3$vector
Item$item
int$face
float$fxdefault 0.0
float$fydefault 0.0
float$fzdefault 0.0
Player$playerdefault null
Returns
boolean

Definition at line 1297 of file Level.php.

References pocketmine\tile\Tile\createTile(), pocketmine\level\Level\getBlock(), pocketmine\level\Level\getChunk(), pocketmine\level\Level\getCollidingEntities(), pocketmine\level\Level\getSpawnLocation(), and pocketmine\level\Level\setBlock().

+ Here is the call graph for this function:

Member Data Documentation

pocketmine\level\Level::$randomTickBlocks
protected
Initial value:
= [
Block::GRASS => Grass::class

Definition at line 193 of file Level.php.


The documentation for this class was generated from the following file: