meta = $meta; } public function getToolType() : int{ return BlockToolType::TYPE_PICKAXE; } public function getToolHarvestLevel() : int{ return TieredTool::TIER_WOODEN; } public function getHardness() : float{ return 2; } public function getName() : string{ static $names = [ self::NONE_MOSSY_WALL => "Cobblestone", self::MOSSY_WALL => "Mossy Cobblestone", self::GRANITE_WALL => "Granite", self::DIORITE_WALL => "Diorite", self::ANDESITE_WALL => "Andesite", self::SANDSTONE_WALL => "Sandstone", self::BRICK_WALL => "Brick", self::STONE_BRICK_WALL => "Stone Brick", self::MOSSY_STONE_BRICK_WALL => "Mossy Stone Brick", self::NETHER_BRICK_WALL => "Nether Brick", self::END_STONE_BRICK_WALL => "End Stone Brick", self::PRISMARINE_WALL => "Prismarine", self::RED_SANDSTONE_WALL => "Red Sandstone", self::RED_NETHER_BRICK_WALL => "Red Nether Brick" ]; return ($names[$this->getVariant()] ?? "Unknown") . " Wall"; } protected function recalculateBoundingBox() : ?AxisAlignedBB{ //walls don't have any special collision boxes like fences do $north = $this->canConnect($this->getSide(Vector3::SIDE_NORTH)); $south = $this->canConnect($this->getSide(Vector3::SIDE_SOUTH)); $west = $this->canConnect($this->getSide(Vector3::SIDE_WEST)); $east = $this->canConnect($this->getSide(Vector3::SIDE_EAST)); $inset = 0.25; if( $this->getSide(Vector3::SIDE_UP)->getId() === Block::AIR and //if there is a block on top, it stays as a post ( ($north and $south and !$west and !$east) or (!$north and !$south and $west and $east) ) ){ //If connected to two sides on the same axis but not any others, AND there is not a block on top, there is no post and the wall is thinner $inset = 0.3125; } return new AxisAlignedBB( $this->x + ($west ? 0 : $inset), $this->y, $this->z + ($north ? 0 : $inset), $this->x + 1 - ($east ? 0 : $inset), $this->y + 1.5, $this->z + 1 - ($south ? 0 : $inset) ); } public function canConnect(Block $block){ return $block instanceof static or $block instanceof FenceGate or ($block->isSolid() and !$block->isTransparent()); } }