Skip to content

PistonStructureResolver 5.46.0 ​

final class · pocketmine\block\utils\PistonStructureResolver · source

Finds the blocks moved and destroyed by a piston: the line of blocks in front of it, plus the blocks dragged along by slime and honey blocks. Same algorithm as vanilla's piston structure resolver (also used by PowerNukkitX), with Bedrock's limit of 12 moved blocks.

Constants ​

MAX_PUSHED_BLOCKS ​

php
public const MAX_PUSHED_BLOCKS = 12

Methods ​

__construct() ​

php
public function __construct(\pocketmine\world\World $world, \pocketmine\math\Vector3 $pistonPos, int $pistonFacing, bool $extending)

getBlocksToDestroy() ​

php
public function getBlocksToDestroy() : array

getBlocksToPush() ​

php
public function getBlocksToPush() : array

getPushDirection() ​

php
public function getPushDirection() : int

resolve() ​

php
public function resolve() : bool

Computes the blocks to move and destroy. Returns false if the piston can't move them (immovable block in the way, more than 12 blocks, or the edge of the world).

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