mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-21 08:17:34 +00:00
Add getBlockFace method to Level API and BlockFace class
This commit is contained in:
parent
145d0707e6
commit
28048db141
@ -66,8 +66,15 @@ class LevelAPI{
|
||||
return $this->map->map[$X][$Z];
|
||||
}
|
||||
|
||||
public function getBlockFace($x, $y, $z, $face){
|
||||
$data = array("x" => $x, "y" => $y, "z" => $z);
|
||||
BlockFace::setPosition($data, $face);
|
||||
return $this->getBlock($data["x"], $data["y"], $data["z"]);
|
||||
}
|
||||
|
||||
public function getBlock($x, $y, $z){
|
||||
return $this->map->getBlock($x, $y, $z);
|
||||
$b = $this->map->getBlock($x, $y, $z);
|
||||
$b[2] = array($x, $y, $z);
|
||||
}
|
||||
|
||||
public function getFloor($x, $z){
|
||||
|
@ -25,12 +25,46 @@ the Free Software Foundation, either version 3 of the License, or
|
||||
|
||||
*/
|
||||
|
||||
class BlockFace{
|
||||
const BOTTOM = 0;
|
||||
const TOP = 1;
|
||||
const DOWN = 0;
|
||||
const UP = 1;
|
||||
const SOUTH = 3;
|
||||
const EAST = 5;
|
||||
const NORTH = 2;
|
||||
const WEST = 4;
|
||||
public static function setPosition(&$data, $face){
|
||||
switch((int) $face){
|
||||
case 0:
|
||||
--$data["y"];
|
||||
break;
|
||||
case 1:
|
||||
++$data["y"];
|
||||
break;
|
||||
case 2:
|
||||
--$data["z"];
|
||||
break;
|
||||
case 3:
|
||||
++$data["z"];
|
||||
break;
|
||||
case 4:
|
||||
--$data["x"];
|
||||
break;
|
||||
case 5:
|
||||
++$data["x"];
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
class Material{
|
||||
static $flowable = array(
|
||||
0 => true,
|
||||
6 => true,
|
||||
//8 => true,
|
||||
//9 => true,
|
||||
30 => true,
|
||||
31 => true,
|
||||
32 => true,
|
||||
|
Loading…
x
Reference in New Issue
Block a user