ItemTranslator
This class handles translation between network item ID+metadata to PocketMine-MP internal ID+metadata and vice versa.
Constants
NO_BLOCK_RUNTIME_ID
php
public const NO_BLOCK_RUNTIME_ID = 0Methods
__construct()
php
public function __construct(\pocketmine\network\mcpe\protocol\serializer\ItemTypeDictionary $itemTypeDictionary, \pocketmine\network\mcpe\convert\BlockStateDictionary $blockStateDictionary, \pocketmine\data\bedrock\item\ItemSerializer $itemSerializer, \pocketmine\data\bedrock\item\ItemDeserializer $itemDeserializer, \pocketmine\data\bedrock\item\BlockItemIdMap $blockItemIdMap)fromNetworkId()
php
public function fromNetworkId(int $networkId, int $networkMeta, int $networkBlockRuntimeId, ?\pocketmine\nbt\tag\CompoundTag $nbt = null) : \pocketmine\item\ItemgetTypeTag() 5.46.0
php
public function getTypeTag(\pocketmine\item\Item $item) : ?\pocketmine\nbt\tag\CompoundTagReturns the tag the serializer keeps the type of the item in (e.g. Type 1 for ominous banners), without the item's own named tag, or null if the type has none.
toNetworkId()
php
public function toNetworkId(\pocketmine\item\Item $item) : arraytoNetworkIdAndNbt() 5.46.0
php
public function toNetworkIdAndNbt(\pocketmine\item\Item $item) : arrayLike ItemTranslator::toNetworkId(), also returning the NBT clients need: the item's named tag merged with the tag the item type is saved in (e.g. Type 1 for ominous banners), or null if there is none.
toNetworkIdAndNbtQuiet() 5.46.0
php
public function toNetworkIdAndNbtQuiet(\pocketmine\item\Item $item) : ?arraytoNetworkIdQuiet()
php
public function toNetworkIdQuiet(\pocketmine\item\Item $item) : ?arraytoNetworkNbt()
php
public function toNetworkNbt(\pocketmine\item\Item $item) : \pocketmine\nbt\tag\CompoundTag