Skip to content

CommandItemParser 5.46.0 ​

final class · pocketmine\command\utils\CommandItemParser · source

Parses item arguments of commands: PocketMine's item names (StringToItemParser), the vanilla Bedrock item IDs the server supports (with or without "minecraft:", e.g. white_terracotta or cut_copper, which have no item name of their own) and legacy IDs (e.g. 35:14).

Methods ​

getVanillaIds() ​

php
public static function getVanillaIds() : array

Vanilla item IDs (without minecraft:) of every item type the server can create from a name, sorted. All of them are accepted by parse().

parse() ​

php
public static function parse(string $input) : \pocketmine\item\Item

withData() ​

php
public static function withData(\pocketmine\item\Item $item, int $data) : ?\pocketmine\item\Item

Applies a Bedrock data value (the [data] argument of /give and /clear, e.g. the potion type) to the item, like vanilla does for items whose ID takes metadata. Returns null if the item has no variant with that data value. Data 0 and block items are returned unchanged.

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