Skip to content

MinecartCommandBlock 5.46.0 ​

class · pocketmine\entity\vehicle\MinecartCommandBlock · source

Extends AbstractMinecart

Minecart with command block (vanilla minecraft:command_block_minecart). PocketMine has no command blocks, so this cart carries a minimal one: on a powered activator rail it runs its command every 4 ticks (vanilla MinecartCommandBlock.ACTIVATION_DELAY) as a console-like operator sender whose target selectors and relative coordinates start from the cart (@s is the cart). Operators in creative mode edit it by interacting with it (the client's command block screen); plugins use MinecartCommandBlock::setCommand().

Constants ​

ACTIVATION_DELAY ​

php
public const ACTIVATION_DELAY = 4

Minimum ticks between two runs on an activator rail.

MAX_OUTPUT_LENGTH ​

php
public const MAX_OUTPUT_LENGTH = 1024

TAG_COMMAND ​

php
public const TAG_COMMAND = "Command"

TAG_LAST_OUTPUT ​

php
public const TAG_LAST_OUTPUT = "LastOutput"

TAG_SUCCESS_COUNT ​

php
public const TAG_SUCCESS_COUNT = "SuccessCount"

TAG_TRACK_OUTPUT ​

php
public const TAG_TRACK_OUTPUT = "TrackOutput"

Properties ​

$command protected ​

php
protected string $command

$lastOutput protected ​

php
protected string $lastOutput

$successCount protected ​

php
protected int $successCount

$trackOutput protected ​

php
protected bool $trackOutput

Methods ​

canEdit() ​

php
public function canEdit(\pocketmine\player\Player $player) : bool

Whether the player may edit the command (vanilla: operators in creative mode).

getCommand() ​

php
public function getCommand() : string

getCommandSender() ​

php
public function getCommandSender() : \pocketmine\entity\vehicle\MinecartCommandSender

Returns the sender the command runs as.

getLastOutput() ​

php
public function getLastOutput() : string

getMinecartType() ​

php
public function getMinecartType() : \pocketmine\entity\vehicle\MinecartType

getName() ​

php
public function getName() : string

getNetworkTypeId() ​

php
public static function getNetworkTypeId() : string

getSuccessCount() ​

php
public function getSuccessCount() : int

Returns 1 if the last run succeeded, 0 otherwise (vanilla SuccessCount).

initEntity() protected ​

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

isTrackingOutput() ​

php
public function isTrackingOutput() : bool

onActivatorRail() protected ​

php
protected function onActivatorRail(bool $powered) : void

onInteract() ​

php
public function onInteract(\pocketmine\player\Player $player, \pocketmine\math\Vector3 $clickPos) : bool

runCommand() ​

php
public function runCommand() : bool

Runs the command now. Returns whether it ran successfully.

saveNBT() ​

php
public function saveNBT() : \pocketmine\nbt\tag\CompoundTag

setCommand() ​

php
public function setCommand(string $command) : void

Sets the command run by the cart (with or without the leading slash).

setLastOutput() ​

php
public function setLastOutput(string $output) : void

setTrackOutput() ​

php
public function setTrackOutput(bool $trackOutput) : void

syncNetworkData() protected ​

php
protected function syncNetworkData(\pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection $properties) : void

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