mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-22 00:33:59 +00:00
Corrected block metadata
This commit is contained in:
parent
bbd113692e
commit
34db027ffd
@ -43,7 +43,7 @@ class LevelAPI{
|
||||
switch($event){
|
||||
case "player.block.place":
|
||||
case "player.block.update":
|
||||
$b = BlockAPI::get($data["block"]);
|
||||
$b = BlockAPI::get($data["block"], $data["meta"]);
|
||||
console("[DEBUG] Player ".$data["entity"]->player->username." placed ".$b->getName()." (".$data["block"].":".$data["meta"].") at (".$data["x"].", ".$data["y"].", ".$data["z"].")", true, true, 2);
|
||||
$this->setBlock($data["x"], $data["y"], $data["z"], $data["block"], $data["meta"]);
|
||||
break;
|
||||
@ -52,7 +52,7 @@ class LevelAPI{
|
||||
if($block[0] === 0){
|
||||
break;
|
||||
}
|
||||
$b = BlockAPI::get($block[0]);
|
||||
$b = BlockAPI::get($block[0], $block[1]);
|
||||
console("[DEBUG] Player ".$data["entity"]->player->username." broke ".$b->getName()." (".$block[0].":".$block[1].") at (".$data["x"].", ".$data["y"].", ".$data["z"].")", true, true, 2);
|
||||
$this->setBlock($data["x"], $data["y"], $data["z"], 0, 0, true, true);
|
||||
break;
|
||||
|
@ -549,7 +549,8 @@ class Player{
|
||||
if($this->server->handle("player.equipment.change", $data) !== false){
|
||||
$this->equipment[0] = $data["block"];
|
||||
$this->equipment[1] = $data["meta"];
|
||||
console("[DEBUG] EID ".$this->eid." has now ".$data["block"].":".$data["meta"]." in their hands!", true, true, 2);
|
||||
$b = BlockAPI::get($data["block"], $data["meta"]);
|
||||
console("[DEBUG] Player ".$this->username." has now ".$b->getName()." (".$data["block"].":".$data["meta"].") in their hands!", true, true, 2);
|
||||
}
|
||||
break;
|
||||
case MC_REQUEST_CHUNK:
|
||||
|
@ -58,7 +58,7 @@ abstract class Block{
|
||||
}
|
||||
|
||||
final public function getMetadata(){
|
||||
return $meta & 0x0F;
|
||||
return $this->meta & 0x0F;
|
||||
}
|
||||
|
||||
final public function position(Vector3 $v){
|
||||
|
@ -31,8 +31,8 @@ class SaplingBlock extends TransparentBlock{
|
||||
const BIRCH = 2;
|
||||
const BURN_TIME = 5;
|
||||
|
||||
public function __construct($type = Sapling::OAK){
|
||||
parent::__construct(SAPLING, $type, "Sapling");
|
||||
public function __construct($meta = Sapling::OAK){
|
||||
parent::__construct(SAPLING, $meta, "Sapling");
|
||||
$this->isActivable = true;
|
||||
$this->isFlowable = true;
|
||||
$names = array(
|
||||
@ -40,7 +40,7 @@ class SaplingBlock extends TransparentBlock{
|
||||
1 => "Spruce Sapling",
|
||||
2 => "Birch Sapling",
|
||||
);
|
||||
$this->name = $names[$this->type & 0x03];
|
||||
$this->name = $names[$this->meta & 0x03];
|
||||
}
|
||||
|
||||
public function onActivate(LevelAPI $level, Item $item, Player $player){
|
||||
|
@ -26,8 +26,8 @@ the Free Software Foundation, either version 3 of the License, or
|
||||
*/
|
||||
|
||||
class TallGrassBlock extends FlowableBlock{
|
||||
public function __construct($type = 1){
|
||||
parent::__construct(TALL_GRASS, $type, "Tall Grass");
|
||||
public function __construct($meta = 1){
|
||||
parent::__construct(TALL_GRASS, $meta, "Tall Grass");
|
||||
$this->isFlowable = true;
|
||||
$this->isReplaceable = true;
|
||||
$names = array(
|
||||
@ -35,7 +35,7 @@ class TallGrassBlock extends FlowableBlock{
|
||||
1 => "Tall Grass",
|
||||
2 => "Fern",
|
||||
);
|
||||
$this->name = $names[$this->type & 0x03];
|
||||
$this->name = $names[$this->meta & 0x03];
|
||||
}
|
||||
|
||||
}
|
@ -26,14 +26,14 @@ the Free Software Foundation, either version 3 of the License, or
|
||||
*/
|
||||
|
||||
class LeavesBlock extends TransparentBlock{
|
||||
public function __construct($type = 0){
|
||||
parent::__construct(LEAVES, $type, "Leaves");
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(LEAVES, $meta, "Leaves");
|
||||
$names = array(
|
||||
0 => "Oak Leaves",
|
||||
1 => "Spruce Leaves",
|
||||
2 => "Birch Leaves",
|
||||
);
|
||||
$this->name = $names[$this->type & 0x03];
|
||||
$this->name = $names[$this->meta & 0x03];
|
||||
}
|
||||
|
||||
}
|
@ -26,8 +26,8 @@ the Free Software Foundation, either version 3 of the License, or
|
||||
*/
|
||||
|
||||
class PlanksBlock extends SolidBlock{
|
||||
public function __construct($type = 0){
|
||||
parent::__construct(PLANKS, $type, "Wooden Planks");
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(PLANKS, $meta, "Wooden Planks");
|
||||
}
|
||||
|
||||
}
|
@ -26,14 +26,14 @@ the Free Software Foundation, either version 3 of the License, or
|
||||
*/
|
||||
|
||||
class SandstoneBlock extends SolidBlock{
|
||||
public function __construct($type = 0){
|
||||
parent::__construct(SANDSTONE, $type, "Sandstone");
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(SANDSTONE, $meta, "Sandstone");
|
||||
$names = array(
|
||||
0 => "Sandstone",
|
||||
1 => "Chiseled Sandstone",
|
||||
2 => "Smooth Sandstone",
|
||||
);
|
||||
$this->name = $names[$this->type & 0x03];
|
||||
$this->name = $names[$this->meta & 0x03];
|
||||
}
|
||||
|
||||
}
|
@ -29,14 +29,14 @@ class WoodBlock extends SolidBlock{
|
||||
const OAK = 0;
|
||||
const SPRUCE = 1;
|
||||
const BIRCH = 2;
|
||||
public function __construct($type = 0){
|
||||
parent::__construct(WOOD, $type, "Wood");
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(WOOD, $meta, "Wood");
|
||||
$names = array(
|
||||
0 => "Oak Wood",
|
||||
1 => "Spruce Wood",
|
||||
2 => "Birch Wood",
|
||||
);
|
||||
$this->name = $names[$this->type & 0x03];
|
||||
$this->name = $names[$this->meta & 0x03];
|
||||
}
|
||||
|
||||
}
|
@ -26,8 +26,8 @@ the Free Software Foundation, either version 3 of the License, or
|
||||
*/
|
||||
|
||||
class WoolBlock extends SolidBlock{
|
||||
public function __construct($type = 0){
|
||||
parent::__construct(WOOL, $type, "Wool");
|
||||
public function __construct($meta = 0){
|
||||
parent::__construct(WOOL, $meta, "Wool");
|
||||
$names = array(
|
||||
0 => "White Wool",
|
||||
1 => "Orange Wool",
|
||||
@ -46,7 +46,7 @@ class WoolBlock extends SolidBlock{
|
||||
14 => "Red Wool",
|
||||
15 => "Black Wool",
|
||||
);
|
||||
$this->name = $names[$this->type];
|
||||
$this->name = $names[$this->meta];
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user