diff --git a/src/API/BlockAPI.php b/src/API/BlockAPI.php index 288667deb..83b1dfdff 100644 --- a/src/API/BlockAPI.php +++ b/src/API/BlockAPI.php @@ -438,39 +438,6 @@ class BlockAPI{ } } break; - case 53://Stairs - case 67: - case 108: - case 109: - case 114: - case 128: - case 156: - $faces = array( - 0 => 0, - 1 => 2, - 2 => 1, - 3 => 3, - ); - $data["meta"] = $faces[$direction] & 0x03; - if(($data["y"] - 1) > $entity->y){ - $data["meta"] |= 0x04; //Upside-down stairs - } - break; - case 96: //trapdoor - if(isset(Material::$transparent[$target[0]])){ - return false; - } - $faces = array( - 2 => 0, - 3 => 1, - 4 => 2, - 5 => 3, - ); - if(!isset($faces[$data["face"]])){ - return false; - } - $data["meta"] = $faces[$data["face"]] & 0x03; - break; case 107: //Fence gate $faces = array( 0 => 3, diff --git a/src/classes/material/block/attachable/Torch.php b/src/classes/material/block/attachable/Torch.php index ca78b773f..0fb866057 100644 --- a/src/classes/material/block/attachable/Torch.php +++ b/src/classes/material/block/attachable/Torch.php @@ -45,7 +45,7 @@ class TorchBlock extends FlowableBlock{ } } return false; - } + } public function getDrops(Item $item, Player $player){ return array( array($this->id, 0, 1), diff --git a/src/classes/material/block/attachable/Trapdoor.php b/src/classes/material/block/attachable/Trapdoor.php new file mode 100644 index 000000000..d89dc1862 --- /dev/null +++ b/src/classes/material/block/attachable/Trapdoor.php @@ -0,0 +1,62 @@ +isActivable = true; + } + public function place(BlockAPI $level, Item $item, Player $player, Block $block, Block $target, $face, $fx, $fy, $fz){ + if($block->inWorld === true){ + if($target->isTransparent === false and $face !== 0 and $face !== 1){ + $faces = array( + 2 => 0, + 3 => 1, + 4 => 2, + 5 => 3, + ); + $this->meta = $faces[$face] & 0x03; + if($fy > 0.5){ + $this->meta |= 0x08; + } + $level->setBlock($block, $this->id, $this->meta); + return true; + } + } + return false; + } + public function getDrops(Item $item, Player $player){ + return array( + array($this->id, 0, 1), + ); + } + public function onActivate(BlockAPI $level, Item $item, Player $player){ + $this->meta ^= 0x04; + $level->setBlock($this, $this->id, $this->meta); + return true; + } +} \ No newline at end of file diff --git a/src/classes/material/block/solid/Trapdoor.php b/src/classes/material/block/solid/Trapdoor.php deleted file mode 100644 index 1291ee2b8..000000000 --- a/src/classes/material/block/solid/Trapdoor.php +++ /dev/null @@ -1,34 +0,0 @@ -isActivable = true; - } - -} \ No newline at end of file