isActivable = true; if(($this->meta & 0x04) === 0x04){ $this->isFullBlock = true; }else{ $this->isFullBlock = false; } $this->hardness = 15; } protected function recalculateBoundingBox(){ if(($this->getDamage() & 0x04) > 0){ return null; } $i = ($this->getDamage() & 0x03); if($i === 2 and $i === 0){ return AxisAlignedBB::getBoundingBoxFromPool( $this->x, $this->y, $this->z + 0.375, $this->x + 1, $this->y + 1, $this->z + 0.625 ); }else{ return AxisAlignedBB::getBoundingBoxFromPool( $this->x + 0.375, $this->y, $this->z, $this->x + 0.625, $this->y + 1, $this->z + 1 ); } } public function place(Item $item, Block $block, Block $target, $face, $fx, $fy, $fz, Player $player = null){ $faces = [ 0 => 3, 1 => 0, 2 => 1, 3 => 2, ]; $this->meta = $faces[$player instanceof Player ? $player->getDirection() : 0] & 0x03; $this->getLevel()->setBlock($block, $this, true, true); return true; } public function getDrops(Item $item){ return [ [$this->id, 0, 1], ]; } public function onActivate(Item $item, Player $player = null){ $faces = [ 0 => 3, 1 => 0, 2 => 1, 3 => 2, ]; $this->meta = ($faces[$player instanceof Player ? $player->getDirection() : 0] & 0x03) | ((~$this->meta) & 0x04); if(($this->meta & 0x04) === 0x04){ $this->isFullBlock = true; }else{ $this->isFullBlock = false; } $this->getLevel()->setBlock($this, $this, true); return true; } }