dummy */ protected $connections = []; /** @var bool */ protected $up = false; public function getToolType() : int{ return BlockToolType::TYPE_PICKAXE; } public function getToolHarvestLevel() : int{ return TieredTool::TIER_WOODEN; } public function getHardness() : float{ return 2; } public function readStateFromWorld() : void{ parent::readStateFromWorld(); foreach(Facing::HORIZONTAL as $facing){ $block = $this->getSide($facing); if($block instanceof static or $block instanceof FenceGate or ($block->isSolid() and !$block->isTransparent())){ $this->connections[$facing] = true; }else{ unset($this->connections[$facing]); } } $this->up = $this->getSide(Facing::UP)->getId() !== BlockLegacyIds::AIR; } protected function recalculateBoundingBox() : ?AxisAlignedBB{ //walls don't have any special collision boxes like fences do $north = isset($this->connections[Facing::NORTH]); $south = isset($this->connections[Facing::SOUTH]); $west = isset($this->connections[Facing::WEST]); $east = isset($this->connections[Facing::EAST]); $inset = 0.25; if( !$this->up 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( ($west ? 0 : $inset), 0, ($north ? 0 : $inset), 1 - ($east ? 0 : $inset), 1.5, 1 - ($south ? 0 : $inset) ); } }