MinecartCommandBlock 5.46.0
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
public const ACTIVATION_DELAY = 4Minimum ticks between two runs on an activator rail.
MAX_OUTPUT_LENGTH
public const MAX_OUTPUT_LENGTH = 1024TAG_COMMAND
public const TAG_COMMAND = "Command"TAG_LAST_OUTPUT
public const TAG_LAST_OUTPUT = "LastOutput"TAG_SUCCESS_COUNT
public const TAG_SUCCESS_COUNT = "SuccessCount"TAG_TRACK_OUTPUT
public const TAG_TRACK_OUTPUT = "TrackOutput"Properties
$command protected
protected string $command$lastOutput protected
protected string $lastOutput$successCount protected
protected int $successCount$trackOutput protected
protected bool $trackOutputMethods
canEdit()
public function canEdit(\pocketmine\player\Player $player) : boolWhether the player may edit the command (vanilla: operators in creative mode).
getCommand()
public function getCommand() : stringgetCommandSender()
public function getCommandSender() : \pocketmine\entity\vehicle\MinecartCommandSenderReturns the sender the command runs as.
getLastOutput()
public function getLastOutput() : stringgetMinecartType()
public function getMinecartType() : \pocketmine\entity\vehicle\MinecartTypegetName()
public function getName() : stringgetNetworkTypeId()
public static function getNetworkTypeId() : stringgetSuccessCount()
public function getSuccessCount() : intReturns 1 if the last run succeeded, 0 otherwise (vanilla SuccessCount).
initEntity() protected
protected function initEntity(\pocketmine\nbt\tag\CompoundTag $nbt) : voidisTrackingOutput()
public function isTrackingOutput() : boolonActivatorRail() protected
protected function onActivatorRail(bool $powered) : voidonInteract()
public function onInteract(\pocketmine\player\Player $player, \pocketmine\math\Vector3 $clickPos) : boolrunCommand()
public function runCommand() : boolRuns the command now. Returns whether it ran successfully.
saveNBT()
public function saveNBT() : \pocketmine\nbt\tag\CompoundTagsetCommand()
public function setCommand(string $command) : voidSets the command run by the cart (with or without the leading slash).
setLastOutput()
public function setLastOutput(string $output) : voidsetTrackOutput()
public function setTrackOutput(bool $trackOutput) : voidsyncNetworkData() protected
protected function syncNetworkData(\pocketmine\network\mcpe\protocol\types\entity\EntityMetadataCollection $properties) : void