LegacyStringToItemParser
Deprecated
This class is deprecated.
This class replaces the functionality that used to be provided by ItemFactory::fromString(), but in a more dynamic way. Avoid using this wherever possible. Unless you need to parse item strings containing meta (e.g. "dye:4", "351:4") or item IDs (e.g. "351"), you should prefer the newer StringToItemParser, which is much more user-friendly, more flexible, and also supports registering custom aliases for any item in any state.
WARNING: This class does NOT support items added during or after PocketMine-MP 5.0.0. Use StringToItemParser for modern items.
Methods
__construct()
php
public function __construct(\pocketmine\data\bedrock\item\upgrade\ItemDataUpgrader $itemDataUpgrader, \pocketmine\data\bedrock\item\ItemDeserializer $itemDeserializer)addMapping()
php
public function addMapping(string $alias, string $id) : voidgetMappings()
php
public function getMappings() : arrayparse()
php
public function parse(string $input) : \pocketmine\item\ItemTries to parse the specified string into Item types.
Example accepted formats:
diamond_pickaxe:5minecraft:string351:4 (lapis lazuli ID:meta)
reprocess() protected
php
protected function reprocess(string $input) : string