mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 09:56:06 +00:00
Low level PMF level interface
This commit is contained in:
@ -20,8 +20,8 @@
|
||||
*/
|
||||
|
||||
class Level{
|
||||
public $entities, $tiles, $blockUpdates, $nextSave, $players = array();
|
||||
private $level, $time, $startCheck, $startTime, $server, $name, $usedChunks, $changedBlocks, $changedCount;
|
||||
public $entities, $tiles, $blockUpdates, $nextSave, $players = array(), $level;
|
||||
private $time, $startCheck, $startTime, $server, $name, $usedChunks, $changedBlocks, $changedCount;
|
||||
|
||||
public function __construct(PMFLevel $level, Config $entities, Config $tiles, Config $blockUpdates, $name){
|
||||
$this->server = ServerAPI::request();
|
||||
@ -263,6 +263,11 @@ class Level{
|
||||
$this->nextSave = microtime(true) + 45;
|
||||
}
|
||||
|
||||
public function getBlockRaw(Vector3 $pos){
|
||||
$b = $this->level->getBlock($pos->x, $pos->y, $pos->z);
|
||||
return BlockAPI::get($b[0], $b[1], new Position($pos->x, $pos->y, $pos->z, $this));
|
||||
}
|
||||
|
||||
public function getBlock(Vector3 $pos){
|
||||
if(!isset($this->level) or ($pos instanceof Position) and $pos->level !== $this){
|
||||
return false;
|
||||
@ -272,9 +277,6 @@ class Level{
|
||||
}
|
||||
|
||||
public function setBlockRaw(Vector3 $pos, Block $block, $direct = true, $send = true){
|
||||
if(!isset($this->level)){
|
||||
return false;
|
||||
}
|
||||
if(($ret = $this->level->setBlock($pos->x, $pos->y, $pos->z, $block->getID(), $block->getMetadata())) === true and $send !== false){
|
||||
if($direct === true){
|
||||
$this->server->api->player->broadcastPacket($this->players, MC_UPDATE_BLOCK, array(
|
||||
|
Reference in New Issue
Block a user