Skip to content

HorizontalConnectionsTrait 5.46.0 ​

trait · pocketmine\block\utils\HorizontalConnectionsTrait · source

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 $connections

facing => facing, as expected by RuntimeDataDescriber::horizontalFacingFlags()

Methods ​

canConnectTo() protected ​

php
abstract protected function canConnectTo(\pocketmine\block\Block $block, int $facing) : bool

Returns whether this block should connect to the given neighbour on the given side.

getConnections() ​

php
public function getConnections() : array

Returns the horizontal faces this block is connected on.

hasConnection() ​

php
public function hasConnection(int $facing) : bool

recalculateConnections() protected ​

php
protected function recalculateConnections() : bool

Recomputes the connections from the neighbouring blocks. Returns true if anything changed.

setConnection() ​

php
public function setConnection(int $facing, bool $connected) : self

VanillaMine is a fork of PocketMine-MP, maintained by Luxury Nodes. Not affiliated with the PMMP team or Mojang.