Genisys  Genisys API 1.9.3
A server software for Minecraft: Pocket Edition with many features
Level Class Reference
Inheritance diagram for Level:
[legend]
Collaboration diagram for Level:
[legend]

Public Member Functions

 setBlockTempData (Vector3 $pos, $data=null)
 
 getBlockTempData (Vector3 $pos)
 
 setDimension (int $dimension)
 
 getDimension ()
 
 getWeather ()
 
 getTickRate ()
 
 getTickRateTime ()
 
 setTickRate (int $tickRate)
 
 initLevel ()
 
 getWaterHeight ()
 
 registerGenerator ()
 
 unregisterGenerator ()
 
 getBlockMetadata ()
 
 getServer ()
 
 getProvider ()
 
 getId ()
 
 isClosed ()
 
 close ()
 
 addSound (Sound $sound, array $players=null)
 
 addParticle (Particle $particle, array $players=null)
 
 getAutoSave ()
 
 setAutoSave (bool $value)
 
 unload (bool $force=false)
 
 getChunkPlayers (int $chunkX, int $chunkZ)
 
 getChunkLoaders (int $chunkX, int $chunkZ)
 
 addChunkPacket (int $chunkX, int $chunkZ, DataPacket $packet)
 
 registerChunkLoader (ChunkLoader $loader, int $chunkX, int $chunkZ, bool $autoLoad=true)
 
 unregisterChunkLoader (ChunkLoader $loader, int $chunkX, int $chunkZ)
 
 checkTime ()
 
 sendTime ()
 
 doTick (int $currentTick)
 
 checkSleep ()
 
 sendBlockExtraData (int $x, int $y, int $z, int $id, int $data, array $targets=null)
 
 sendBlocks (array $target, array $blocks, $flags=UpdateBlockPacket::FLAG_NONE, bool $optimizeRebuilds=false)
 
 clearCache (bool $full=false)
 
 clearChunkCache (int $chunkX, int $chunkZ)
 
 addRandomTickedBlock (int $id)
 
 removeRandomTickedBlock (int $id)
 
 __debugInfo ()
 
 save (bool $force=false)
 
 saveChunks ()
 
 updateAround (Vector3 $pos)
 
 scheduleUpdate (Vector3 $pos, int $delay)
 
 getCollisionBlocks (AxisAlignedBB $bb, bool $targetFirst=false)
 
 isFullBlock (Vector3 $pos)
 
 getCollisionCubes (Entity $entity, AxisAlignedBB $bb, bool $entities=true)
 
 getFullLight (Vector3 $pos)
 
 getFullBlock (int $x, int $y, int $z)
 
 getBlock (Vector3 $pos, $cached=true)
 
 updateAllLight (Vector3 $pos)
 
 updateBlockSkyLight (int $x, int $y, int $z)
 
 setBlock (Vector3 $pos, Block $block, bool $direct=false, bool $update=true)
 
 dropItem (Vector3 $source, Item $item, Vector3 $motion=null, int $delay=10)
 
 useBreakOn (Vector3 $vector, Item &$item=null, Player $player=null, bool $createParticles=false)
 
 useItemOn (Vector3 $vector, Item &$item, int $face, float $fx=0.0, float $fy=0.0, float $fz=0.0, Player $player=null)
 
 getEntity (int $entityId)
 
 getEntities ()
 
 getCollidingEntities (AxisAlignedBB $bb, Entity $entity=null)
 
 getNearbyEntities (AxisAlignedBB $bb, Entity $entity=null)
 
 getNearbyExperienceOrb (AxisAlignedBB $bb)
 
 getTiles ()
 
 getTileById (int $tileId)
 
 getPlayers ()
 
 getLoaders ()
 
 getTile (Vector3 $pos)
 
 getChunkEntities ($X, $Z)
 
 getChunkTiles ($X, $Z)
 
 getBlockIdAt (int $x, int $y, int $z)
 
 setBlockIdAt (int $x, int $y, int $z, int $id)
 
 getBlockExtraDataAt (int $x, int $y, int $z)
 
 setBlockExtraDataAt (int $x, int $y, int $z, int $id, int $data)
 
 getBlockDataAt (int $x, int $y, int $z)
 
 setBlockDataAt (int $x, int $y, int $z, int $data)
 
 getBlockSkyLightAt (int $x, int $y, int $z)
 
 setBlockSkyLightAt (int $x, int $y, int $z, int $level)
 
 getBlockLightAt (int $x, int $y, int $z)
 
 setBlockLightAt (int $x, int $y, int $z, int $level)
 
 getBiomeId (int $x, int $z)
 
 getHeightMap (int $x, int $z)
 
 setBiomeId (int $x, int $z, int $biomeId)
 
 setHeightMap (int $x, int $z, int $value)
 
 getChunks ()
 
 getChunk (int $x, int $z, bool $create=false)
 
 generateChunkCallback (int $x, int $z, Chunk $chunk)
 
 setChunk (int $chunkX, int $chunkZ, Chunk $chunk=null, bool $unload=true)
 
 sendLighting (int $x, int $y, int $z, Player $p)
 
 spawnLightning (Vector3 $pos)
 
 spawnXPOrb (Vector3 $pos, int $exp=1)
 
 getHighestBlockAt (int $x, int $z)
 
 canBlockSeeSky (Vector3 $pos)
 
 isChunkLoaded (int $x, int $z)
 
 isChunkGenerated (int $x, int $z)
 
 isChunkPopulated (int $x, int $z)
 
 getSpawnLocation ()
 
 setSpawnLocation (Vector3 $pos)
 
 requestChunk (int $x, int $z, Player $player)
 
 removeEntity (Entity $entity)
 
 addEntity (Entity $entity)
 
 addTile (Tile $tile)
 
 removeTile (Tile $tile)
 
 isChunkInUse (int $x, int $z)
 
 loadChunk (int $x, int $z, bool $generate=true)
 
 unloadChunkRequest (int $x, int $z, bool $safe=true)
 
 cancelUnloadChunkRequest (int $x, int $z)
 
 unloadChunk (int $x, int $z, bool $safe=true, bool $trySave=true)
 
 isSpawnChunk (int $X, int $Z)
 
 getSafeSpawn ($spawn=null)
 
 getTime ()
 
 getName ()
 
 getFolderName ()
 
 setTime (int $time)
 
 stopTime ()
 
 startTime ()
 
 getSeed ()
 
 setSeed (int $seed)
 
 populateChunk (int $x, int $z, bool $force=false)
 
 generateChunk (int $x, int $z, bool $force=false)
 
 regenerateChunk (int $x, int $z)
 
 doChunkGarbageCollection ()
 
 unloadChunks (bool $force=false)
 
 setMetadata ($metadataKey, MetadataValue $metadataValue)
 
 getMetadata ($metadataKey)
 
 hasMetadata ($metadataKey)
 
 removeMetadata ($metadataKey, Plugin $plugin)
 
 addEntityMotion (int $chunkX, int $chunkZ, int $entityId, float $x, float $y, float $z)
 
 addEntityMovement (int $chunkX, int $chunkZ, int $entityId, float $x, float $y, float $z, float $yaw, float $pitch, $headYaw=null)
 
- Public Member Functions inherited from ChunkManager
 updateBlockLight (int $x, int $y, int $z)
 
 getChunk (int $chunkX, int $chunkZ)
 
 setChunk (int $chunkX, int $chunkZ, Chunk $chunk=null)
 

Static Public Member Functions

static chunkHash (int $x, int $z)
 
static blockHash (int $x, int $y, int $z)
 
static getBlockXYZ ($hash, &$x, &$y, &$z)
 
static getXZ ($hash, &$x, &$z)
 
static generateChunkLoaderId (ChunkLoader $loader)
 
static getChunkCacheFromData ($chunkX, $chunkZ, $payload)
 

Data Fields

const Y_MASK = 0xFF
 
const Y_MAX = 0x100
 
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
 
const DIMENSION_NORMAL = 0
 
const DIMENSION_NETHER = 1
 
 $updateEntities = []
 
 $updateTiles = []
 
 $stopTime
 
 $sleepTicks = 0
 
 $timings
 
 $tickRateTime = 0
 
 $tickRateCounter = 0
 

Static Public Attributes

static $COMPRESSION_LEVEL = 8
 

Member Function Documentation

addEntity ( Entity  $entity)
Parameters
Entity$entity
Exceptions
LevelException
addTile ( Tile  $tile)
Parameters
Tile$tile
Exceptions
LevelException
checkTime ( )

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

static chunkHash ( int  $x,
int  $z 
)
static

Returns the chunk unique hash/key

Parameters
int$x
int$z
Returns
string
doTick ( int  $currentTick)

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

Parameters
int$currentTick
dropItem ( Vector3  $source,
Item  $item,
Vector3  $motion = null,
int  $delay = 10 
)
Parameters
Vector3$source
Item$item
Vector3$motion
int$delay
Returns
DroppedItem|null
getAutoSave ( )
Returns
bool
getBiomeId ( int  $x,
int  $z 
)
Parameters
int$x
int$z
Returns
int
getBlock ( Vector3  $pos,
  $cached = true 
)

Gets the Block object on the Vector3 location

Parameters
Vector3$pos
bool$cached
Returns
Block
getBlockDataAt ( int  $x,
int  $y,
int  $z 
)

Gets the raw block metadata

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

Implements ChunkManager.

getBlockExtraDataAt ( int  $x,
int  $y,
int  $z 
)

Gets the raw block extra data

Parameters
int$x
int$y
int$z
Returns
int 16-bit
getBlockIdAt ( int  $x,
int  $y,
int  $z 
)

Gets the raw block id.

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

Implements ChunkManager.

getBlockLightAt ( int  $x,
int  $y,
int  $z 
)

Gets the raw block light level

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

Implements ChunkManager.

getBlockMetadata ( )
Returns
BlockMetadataStore
getBlockSkyLightAt ( int  $x,
int  $y,
int  $z 
)

Gets the raw block skylight level

Parameters
int$x
int$y
int$z
Returns
int 0-15
getBlockTempData ( Vector3  $pos)

This method is internal use only. Do not use this in plugins

Parameters
Vector3$pos
Returns
int
getChunk ( int  $x,
int  $z,
bool  $create = false 
)

Gets the Chunk object

Parameters
int$x
int$z
bool$createWhether to generate the chunk if it does not exist
Returns
Chunk
static getChunkCacheFromData (   $chunkX,
  $chunkZ,
  $payload 
)
static
Parameters
int$chunkX
int$chunkZ
string$payload
Returns
DataPacket
getChunkEntities (   $X,
  $Z 
)

Returns a list of the entities on a given chunk

Parameters
int$X
int$Z
Returns
Entity[]
getChunkLoaders ( int  $chunkX,
int  $chunkZ 
)

Gets the chunk loaders being used in a specific chunk

Parameters
int$chunkX
int$chunkZ
Returns
ChunkLoader[]
getChunkPlayers ( int  $chunkX,
int  $chunkZ 
)

Gets the players being used in a specific chunk

Parameters
int$chunkX
int$chunkZ
Returns
Player[]
getChunks ( )
Returns
Chunk[]
getChunkTiles (   $X,
  $Z 
)

Gives a list of the Tile entities on a given chunk

Parameters
int$X
int$Z
Returns
Tile[]
getCollidingEntities ( AxisAlignedBB  $bb,
Entity  $entity = null 
)

Returns the entities colliding the current one inside the AxisAlignedBB

Parameters
AxisAlignedBB$bb
Entity$entity
Returns
Entity[]
getCollisionBlocks ( AxisAlignedBB  $bb,
bool  $targetFirst = false 
)
Parameters
AxisAlignedBB$bb
bool$targetFirst
Returns
Block[]
getCollisionCubes ( Entity  $entity,
AxisAlignedBB  $bb,
bool  $entities = true 
)
Parameters
Entity$entity
AxisAlignedBB$bb
bool$entities
Returns
AxisAlignedBB[]
getEntities ( )

Gets the list of all the entities in this level

Returns
Entity[]
getEntity ( int  $entityId)
Parameters
int$entityId
Returns
Entity
getFolderName ( )

Returns the Level folder name

Returns
string
getFullBlock ( int  $x,
int  $y,
int  $z 
)
Parameters
$x
$y
$z
Returns
int bitmap, (id << 4) | data
getHeightMap ( int  $x,
int  $z 
)
Parameters
int$x
int$z
Returns
int
getHighestBlockAt ( int  $x,
int  $z 
)

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

Parameters
int$x
int$z
Returns
int 0-255
getId ( )
final

Returns the unique level identifier

Returns
int
getLoaders ( )
Returns
ChunkLoader[]
getMetadata (   $metadataKey)

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

Parameters
string$metadataKey
Returns
MetadataValue[]

Implements Metadatable.

getName ( )

Returns the Level name

Returns
string
getNearbyEntities ( AxisAlignedBB  $bb,
Entity  $entity = null 
)

Returns the entities near the current one inside the AxisAlignedBB

Parameters
AxisAlignedBB$bb
Entity$entity
Returns
Entity[]
getPlayers ( )

Returns a list of the players in this level

Returns
Player[]
getProvider ( )
final
Returns
LevelProvider
getSafeSpawn (   $spawn = null)
Parameters
Vector3$spawndefault null
Returns
bool|Position
getSeed ( )

Gets the level seed

Returns
int|string

Implements ChunkManager.

getServer ( )
Returns
Server
getSpawnLocation ( )

Returns a Position pointing to the spawn

Returns
Position
getTile ( Vector3  $pos)

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

Parameters
Vector3$pos
Returns
Tile
getTileById ( int  $tileId)
Parameters
$tileId
Returns
Tile
getTiles ( )

Returns a list of the Tile entities in this level

Returns
Tile[]
getTime ( )

Gets the current time

Returns
int
getWeather ( )
Returns
Weather
hasMetadata (   $metadataKey)

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

Parameters
string$metadataKey
Returns
bool

Implements Metadatable.

isChunkGenerated ( int  $x,
int  $z 
)
Parameters
int$x
int$z
Returns
bool
isChunkInUse ( int  $x,
int  $z 
)
Parameters
int$x
int$z
Returns
bool
isChunkLoaded ( int  $x,
int  $z 
)
Parameters
int$x
int$z
Returns
bool
isChunkPopulated ( int  $x,
int  $z 
)
Parameters
int$x
int$z
Returns
bool
isFullBlock ( Vector3  $pos)
Parameters
Vector3$pos
Returns
bool
isSpawnChunk ( int  $X,
int  $Z 
)

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

Parameters
int$X
int$Z
Returns
bool
loadChunk ( int  $x,
int  $z,
bool  $generate = true 
)
Parameters
int$x
int$z
bool$generate
Returns
bool
removeEntity ( Entity  $entity)

Removes the entity from the level index

Parameters
Entity$entity
Exceptions
LevelException
removeMetadata (   $metadataKey,
Plugin  $owningPlugin 
)

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

Parameters
string$metadataKey
Plugin$owningPlugin
Returns
void

Implements Metadatable.

removeTile ( Tile  $tile)
Parameters
Tile$tile
Exceptions
LevelException
save ( bool  $force = false)
Parameters
bool$force
Returns
bool
scheduleUpdate ( Vector3  $pos,
int  $delay 
)
Parameters
Vector3$pos
int$delay
sendBlocks ( array  $target,
array  $blocks,
  $flags = UpdateBlockPacket::FLAG_NONE,
bool  $optimizeRebuilds = false 
)
Parameters
Player[]$target
Block[]$blocks
int$flags
bool$optimizeRebuilds
sendLighting ( int  $x,
int  $y,
int  $z,
Player  $p 
)

Directly send a lightning to a player

Deprecated:
Parameters
int$x
int$y
int$z
Player$p
sendTime ( )

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

setAutoSave ( bool  $value)
Parameters
bool$value
setBiomeId ( int  $x,
int  $z,
int  $biomeId 
)
Parameters
int$x
int$z
int$biomeId
setBlock ( Vector3  $pos,
Block  $block,
bool  $direct = false,
bool  $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
setBlockDataAt ( int  $x,
int  $y,
int  $z,
int  $data 
)

Sets the raw block metadata.

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

Implements ChunkManager.

setBlockExtraDataAt ( int  $x,
int  $y,
int  $z,
int  $id,
int  $data 
)

Sets the raw block metadata.

Parameters
int$x
int$y
int$z
int$id
int$data
setBlockIdAt ( int  $x,
int  $y,
int  $z,
int  $id 
)

Sets the raw block id.

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

Implements ChunkManager.

setBlockLightAt ( int  $x,
int  $y,
int  $z,
int  $level 
)

Sets the raw block light level.

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

Implements ChunkManager.

setBlockSkyLightAt ( int  $x,
int  $y,
int  $z,
int  $level 
)

Sets the raw block skylight level.

Parameters
int$x
int$y
int$z
int$level0-15
setBlockTempData ( Vector3  $pos,
  $data = null 
)

This method is internal use only. Do not use this in plugins

Parameters
Vector3$pos
$data
setChunk ( int  $chunkX,
int  $chunkZ,
Chunk  $chunk = null,
bool  $unload = true 
)
Parameters
int$chunkX
int$chunkZ
Chunk$chunk
bool$unload
setHeightMap ( int  $x,
int  $z,
int  $value 
)
Parameters
int$x
int$z
int$value
setMetadata (   $metadataKey,
MetadataValue  $newMetadataValue 
)

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

Parameters
string$metadataKey
MetadataValue$newMetadataValue
Returns
void

Implements Metadatable.

setSeed ( int  $seed)

Sets the seed for the level

Parameters
int$seed
setSpawnLocation ( Vector3  $pos)

Sets the level spawn location

Parameters
Vector3$pos
setTime ( int  $time)

Sets the current time on the level

Parameters
int$time
spawnLightning ( Vector3  $pos)

Add a lightning

Parameters
Vector3$pos
Returns
Lightning
spawnXPOrb ( Vector3  $pos,
int  $exp = 1 
)

Add an experience orb

Parameters
Vector3$pos
int$exp
Returns
bool|XPOrb
startTime ( )

Start the time again, if it was stopped

stopTime ( )

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

unload ( bool  $force = false)

Unloads the current level from memory safely

Parameters
bool$forcedefault false, force unload of default level
Returns
bool
updateAround ( Vector3  $pos)
Parameters
Vector3$pos
useBreakOn ( Vector3  $vector,
Item $item = null,
Player  $player = null,
bool  $createParticles = false 
)

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
bool$createParticles
Returns
bool
useItemOn ( Vector3  $vector,
Item $item,
int  $face,
float  $fx = 0.0,
float  $fy = 0.0,
float  $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
bool

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