CommandBlock 5.47.0
Extends Opaque
Implements AnyFacing
Impulse, repeating and chain command blocks (https://minecraft.wiki/w/Command_Block). The command and the settings live in the block entity (TileCommandBlock); the block state holds the facing and the conditional flag.
- Impulse: runs once, TickDelay ticks after a redstone signal turns on (or after "Always Active" is turned on).
- Repeating: runs every TickDelay ticks (at least 1) while powered or always active; with ExecuteOnFirstTick it runs at once when it becomes active.
- Chain: runs right after the command block pointing into it ran (after its own TickDelay if it has one), when it is powered or always active. The chain stops after maxcommandchainlength chain blocks.
A conditional command block only runs if the command block behind it (opposite to its facing) succeeded on its last run. Nothing runs when the commandblocksenabled game rule is off. Only operators in creative mode can place command blocks or open their screen; they never drop.
Constants
MAX_RUNS_PER_TICK
public const MAX_RUNS_PER_TICK = 4096Most command block runs (impulse, repeating and chain) per world and tick: the others wait for the next tick, so that a contraption of repeating command blocks can't stall the server.
Properties
$conditional protected
protected bool $conditionalMethods
__construct()
public function __construct(\pocketmine\block\BlockIdentifier $idInfo, string $name, \pocketmine\block\BlockTypeInfo $typeInfo, \pocketmine\block\utils\CommandBlockType $commandBlockType)describeBlockOnlyState() protected
protected function describeBlockOnlyState(\pocketmine\data\runtime\RuntimeDataDescriber $w) : voidgetCommandBlockType()
public function getCommandBlockType() : \pocketmine\block\utils\CommandBlockTypegetDropsForCompatibleTool()
public function getDropsForCompatibleTool(\pocketmine\item\Item $item) : arrayisAffectedBySilkTouch()
public function isAffectedBySilkTouch() : boolisConditional()
public function isConditional() : boolWhether it only runs when the command block behind it succeeded (Bedrock "conditional_bit").
onInteract()
public function onInteract(\pocketmine\item\Item $item, int $face, \pocketmine\math\Vector3 $clickVector, ?\pocketmine\player\Player $player = null, array &$returnedItems = []) : boolonNearbyBlockChange()
public function onNearbyBlockChange() : voidonScheduledUpdate()
public function onScheduledUpdate() : voidpausesScheduledUpdatesOutsideTickingChunks()
public function pausesScheduledUpdatesOutsideTickingChunks() : boolplace()
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) : boolsetConditional()
public function setConditional(bool $conditional) : selfwriteStateToWorld()
public function writeStateToWorld() : void