mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-08-30 06:55:11 +00:00
MAp getFloor() method
This commit is contained in:
parent
3e54ceb8a3
commit
67d5e92def
@ -68,7 +68,9 @@ class LevelAPI{
|
|||||||
}
|
}
|
||||||
|
|
||||||
private function check(){
|
private function check(){
|
||||||
if($this->active === false and $this->server->map === false){
|
if($this->active === true){
|
||||||
|
return true;
|
||||||
|
}elseif($this->active === false and $this->server->map === false){
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
$this->active = true;
|
$this->active = true;
|
||||||
@ -89,6 +91,13 @@ class LevelAPI{
|
|||||||
return array(0,0);
|
return array(0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFloor($x, $z){
|
||||||
|
if($this->check()){
|
||||||
|
return $this->map->getFloor($x, $z);
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
public function setBlock($x, $y, $z, $block, $meta = 0){
|
public function setBlock($x, $y, $z, $block, $meta = 0){
|
||||||
if($this->check()){
|
if($this->check()){
|
||||||
$this->map->setBlock($x, $y, $z, $block, $meta);
|
$this->map->setBlock($x, $y, $z, $block, $meta);
|
||||||
|
@ -154,6 +154,20 @@ class ChunkParser{
|
|||||||
fclose($fp);
|
fclose($fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFloor($x, $z){
|
||||||
|
$X = $x >> 4;
|
||||||
|
$Z = $z >> 4;
|
||||||
|
$aX = $x - ($X << 4);
|
||||||
|
$aZ = $z - ($Z << 4);
|
||||||
|
$index = $aZ + ($aX << 4);
|
||||||
|
for($y = 127; $y <= 0; --$y){
|
||||||
|
if($this->map[$X][$Z][0][$index]{$y} !== "\x00"){
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $y;
|
||||||
|
}
|
||||||
|
|
||||||
public function getBlock($x, $y, $z){
|
public function getBlock($x, $y, $z){
|
||||||
$x = (int) $x;
|
$x = (int) $x;
|
||||||
$y = (int) $y;
|
$y = (int) $y;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user