HorizontalConnectionsTrait 5.46.0
Shared logic for blocks whose horizontal connections (fences, glass panes, iron bars, trip wire, ...) are part of their block state. Since Bedrock 1.26.50 the client renders these from the minecraft:connection_* states instead of inferring them from the neighbouring blocks, so the server has to track them.
Properties
$connections protected
php
protected array $connectionsfacing => facing, as expected by RuntimeDataDescriber::horizontalFacingFlags()
Methods
canConnectTo() protected
php
abstract protected function canConnectTo(\pocketmine\block\Block $block, int $facing) : boolReturns whether this block should connect to the given neighbour on the given side.
getConnections()
php
public function getConnections() : arrayReturns the horizontal faces this block is connected on.
hasConnection()
php
public function hasConnection(int $facing) : boolrecalculateConnections() protected
php
protected function recalculateConnections() : boolRecomputes the connections from the neighbouring blocks. Returns true if anything changed.
setConnection()
php
public function setConnection(int $facing, bool $connected) : self