Skip to content

Piston 5.46.0 ​

class · pocketmine\block\Piston · source

Extends Opaque
Implements AnyFacing

Piston and sticky piston (Bedrock behaviour).

  • Powered from any side except its front (no quasi-connectivity in Bedrock); redstone wire next to it powers it even when it doesn't point into it.
  • Starts moving one redstone tick (2 game ticks) after its power changes, and the arm takes 2 game ticks to move. Power changes during a movement are only looked at once it ends.
  • Pushes up to 12 blocks (slime and honey blocks drag the blocks stuck to them), destroys blocks which break when pushed, and a sticky piston pulls the block in front of its head back when it retracts.
  • Moved blocks keep their block entity data (chests, furnaces...).

The moving blocks are moving_block blocks with a MovingBlock block entity at their destination, and the PistonArm block entity of the piston carries the animation state; see TilePistonArm and TileMovingBlock.

Constants ​

START_DELAY_TICKS ​

php
public const START_DELAY_TICKS = \pocketmine\world\redstone\RedstoneEngine::REDSTONE_TICK

Delay between a power change and the start of the movement.

Methods ​

describeBlockOnlyState() protected ​

php
protected function describeBlockOnlyState(\pocketmine\data\runtime\RuntimeDataDescriber $w) : void

finishMovement() ​

php
public function finishMovement(\pocketmine\block\tile\PistonArm $arm) : void

Puts the moved blocks in place and ends the movement.

getAffectedBlocks() ​

php
public function getAffectedBlocks() : array

getArm() protected ​

php
protected function getArm() : ?\pocketmine\block\tile\PistonArm

getPistonPushReaction() ​

php
public function getPistonPushReaction() : \pocketmine\block\utils\PistonPushReaction

isExtended() ​

php
public function isExtended() : bool

Returns whether the piston's arm is out (or moving).

isReceivingPower() ​

php
public function isReceivingPower() : bool

Returns whether the piston receives power from any side except its front.

isRedstoneConductor() ​

php
public function isRedstoneConductor() : bool

isSticky() ​

php
public function isSticky() : bool

onBreak() ​

php
public function onBreak(\pocketmine\item\Item $item, ?\pocketmine\player\Player $player = null, array &$returnedItems = []) : bool

onNearbyBlockChange() ​

php
public function onNearbyBlockChange() : void

onScheduledUpdate() ​

php
public function onScheduledUpdate() : void

place() ​

php
public function place(\pocketmine\world\BlockTransaction $tx, \pocketmine\item\Item $item, \pocketmine\block\Block $blockReplace, \pocketmine\block\Block $blockClicked, int $face, \pocketmine\math\Vector3 $clickVector, ?\pocketmine\player\Player $player = null) : bool

startMovement() ​

php
public function startMovement(\pocketmine\block\tile\PistonArm $arm, bool $extending) : bool

Starts extending or retracting the arm. Returns false if the blocks in front can't be pushed.

writeStateToWorld() ​

php
public function writeStateToWorld() : void

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