LootItemConverter 5.46.0
Converts loot stacks (Java item ids and components) to PocketMine items, using GeyserMC's Java -> Bedrock item mappings from the vanilla data cache. Stacks of items PocketMine does not have are dropped (null).
Methods
bedrockItem()
public static function bedrockItem(string $javaId) : arrayBedrock item id and meta of a Java item.
bedrockToItem()
public static function bedrockToItem(string $bedrockId, int $meta) : ?\pocketmine\item\ItemA PocketMine item from a Bedrock item id and meta, or null if PocketMine has no such item.
Ordinary items are deserialized directly. Block items cannot be: on disk and on the network they carry their block state, which the mappings do not have (and GeyserMC's meta of a block item is its legacy one). Those are looked up in a table of the item ids PocketMine serializes its own blocks and items to.
enchantment()
public static function enchantment(string $javaId) : ?\pocketmine\item\enchantment\EnchantmentThe PocketMine enchantment of a Java enchantment id, or null if PocketMine does not have it.
enchantmentLevel()
public static function enchantmentLevel(\pocketmine\item\Item $item, string $javaEnchantmentId) : intLevel of a Java enchantment on a PocketMine item.
fromItem()
public static function fromItem(\pocketmine\item\Item $item) : \pocketmine\loot\LootStackA PocketMine item as a loot stack (Java id and enchantments), e.g. the tool of a loot context.
potionType()
public static function potionType(string $javaPotion) : ?\pocketmine\item\PotionTypetoItem()
public static function toItem(\pocketmine\loot\LootStack $stack) : ?\pocketmine\item\ItemConverts a loot stack to a PocketMine item, or returns null if PocketMine has no such item (or the stack is empty).
