|
PocketMine-MP 5.36.1 git-eaa7c4834c8fe2f379d24e7f0ee6cc63cfb18ccc
|
Collaboration diagram for pocketmine\item\LegacyStringToItemParser:Public Member Functions | |
| __construct (private ItemDataUpgrader $itemDataUpgrader, private ItemDeserializer $itemDeserializer) | |
| addMapping (string $alias, string $id) | |
| getMappings () | |
| parse (string $input) | |
Protected Member Functions | |
| reprocess (string $input) | |
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.
Definition at line 57 of file LegacyStringToItemParser.php.
| pocketmine\item\LegacyStringToItemParser::__construct | ( | private ItemDataUpgrader | $itemDataUpgrader, |
| private ItemDeserializer | $itemDeserializer ) |
Definition at line 85 of file LegacyStringToItemParser.php.
| pocketmine\item\LegacyStringToItemParser::addMapping | ( | string | $alias, |
| string | $id ) |
Definition at line 90 of file LegacyStringToItemParser.php.
| pocketmine\item\LegacyStringToItemParser::getMappings | ( | ) |
Definition at line 98 of file LegacyStringToItemParser.php.
| pocketmine\item\LegacyStringToItemParser::parse | ( | string | $input | ) |
Tries to parse the specified string into Item types.
Example accepted formats:
diamond_pickaxe:5minecraft:string351:4 (lapis lazuli ID:meta)| LegacyStringToItemParserException | if the given string cannot be parsed as an item identifier |
Definition at line 112 of file LegacyStringToItemParser.php.
|
protected |
Definition at line 144 of file LegacyStringToItemParser.php.