Skip to content

PistonArm 5.46.0 ​

class · pocketmine\block\tile\PistonArm · source

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 ​

php
public const PROGRESS_STEP = 0.5

Progress made by the arm each game tick (a move takes 2 game ticks).

STATE_EXTENDED ​

php
public const STATE_EXTENDED = 2

STATE_EXTENDING ​

php
public const STATE_EXTENDING = 1

STATE_RETRACTED ​

php
public const STATE_RETRACTED = 0

STATE_RETRACTING ​

php
public const STATE_RETRACTING = 3

Methods ​

addAdditionalSpawnData() protected ​

php
protected function addAdditionalSpawnData(\pocketmine\nbt\tag\CompoundTag $nbt) : void

broadcastState() ​

php
public function broadcastState() : void

Sends the arm's current state to the players who can see it, so that their clients animate it.

finishMove() ​

php
public function finishMove(bool $extended) : void

Ends 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() ​

php
public function getAttachedBlocks() : array

Returns the starting positions of the blocks moved by the current movement.

getBreakBlocks() ​

php
public function getBreakBlocks() : array

getLastMoveTick() ​

php
public function getLastMoveTick() : int

getLastProgress() ​

php
public function getLastProgress() : float

getPendingPower() ​

php
public function getPendingPower() : ?bool

getProgress() ​

php
public function getProgress() : float

getState() ​

php
public function getState() : int

isExtending() ​

php
public function isExtending() : bool

isMoving() ​

php
public function isMoving() : bool

isSticky() ​

php
public function isSticky() : bool

readSaveData() ​

php
public function readSaveData(\pocketmine\nbt\tag\CompoundTag $nbt) : void

setLastMoveTick() ​

php
public function setLastMoveTick(int $tick) : void

setPendingPower() ​

php
public function setPendingPower(?bool $pendingPower) : void

setSticky() ​

php
public function setSticky(bool $sticky) : void

startMove() ​

php
public function startMove(bool $extending, array $attachedBlocks, array $breakBlocks) : void

Starts a movement: the arm's progress goes from 0 to 1 (extending) or 1 to 0 (retracting).

step() ​

php
public function step() : bool

Advances the arm by one game tick. Returns true once the arm reached the end of its movement.

writeSaveData() protected ​

php
protected function writeSaveData(\pocketmine\nbt\tag\CompoundTag $nbt) : void

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