PistonArm 5.46.0
Extends Spawnable
Block entity of pistons and sticky pistons ("PistonArm" in Bedrock). It holds the movement state of the arm; the client animates the arm and the moving blocks from it.
NBT (Minecraft Wiki "Bedrock Edition level format/Block entity format", PowerNukkitX BlockEntityPistonArm, GeyserMC PistonBlockEntity): State/NewState (byte, 0 retracted, 1 extending, 2 extended, 3 retracting), Progress and LastProgress (float, 0.0/0.5/1.0), Sticky (byte), AttachedBlocks and BreakBlocks (list of int x, y, z triplets of the moved blocks' starting positions and of the destroyed blocks).
Constants
PROGRESS_STEP
public const PROGRESS_STEP = 0.5Progress made by the arm each game tick (a move takes 2 game ticks).
STATE_EXTENDED
public const STATE_EXTENDED = 2STATE_EXTENDING
public const STATE_EXTENDING = 1STATE_RETRACTED
public const STATE_RETRACTED = 0STATE_RETRACTING
public const STATE_RETRACTING = 3Methods
addAdditionalSpawnData() protected
protected function addAdditionalSpawnData(\pocketmine\nbt\tag\CompoundTag $nbt) : voidbroadcastState()
public function broadcastState() : voidSends the arm's current state to the players who can see it, so that their clients animate it.
finishMove()
public function finishMove(bool $extended) : voidEnds the current movement (or forces the given resting state). LastProgress keeps the value of the last step, like vanilla, so that clients finish animating the last half of the movement.
getAttachedBlocks()
public function getAttachedBlocks() : arrayReturns the starting positions of the blocks moved by the current movement.
getBreakBlocks()
public function getBreakBlocks() : arraygetLastMoveTick()
public function getLastMoveTick() : intgetLastProgress()
public function getLastProgress() : floatgetPendingPower()
public function getPendingPower() : ?boolgetProgress()
public function getProgress() : floatgetState()
public function getState() : intisExtending()
public function isExtending() : boolisMoving()
public function isMoving() : boolisSticky()
public function isSticky() : boolreadSaveData()
public function readSaveData(\pocketmine\nbt\tag\CompoundTag $nbt) : voidsetLastMoveTick()
public function setLastMoveTick(int $tick) : voidsetPendingPower()
public function setPendingPower(?bool $pendingPower) : voidsetSticky()
public function setSticky(bool $sticky) : voidstartMove()
public function startMove(bool $extending, array $attachedBlocks, array $breakBlocks) : voidStarts a movement: the arm's progress goes from 0 to 1 (extending) or 1 to 0 (retracting).
step()
public function step() : boolAdvances the arm by one game tick. Returns true once the arm reached the end of its movement.
writeSaveData() protected
protected function writeSaveData(\pocketmine\nbt\tag\CompoundTag $nbt) : void