Skip to content

ItemTranslator ​

final class · pocketmine\network\mcpe\convert\ItemTranslator · source

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 = 0

Methods ​

__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\Item

getTypeTag() 5.46.0 ​

php
public function getTypeTag(\pocketmine\item\Item $item) : ?\pocketmine\nbt\tag\CompoundTag

Returns 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) : array

toNetworkIdAndNbt() 5.46.0 ​

php
public function toNetworkIdAndNbt(\pocketmine\item\Item $item) : array

Like 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) : ?array

toNetworkIdQuiet() ​

php
public function toNetworkIdQuiet(\pocketmine\item\Item $item) : ?array

toNetworkNbt() ​

php
public function toNetworkNbt(\pocketmine\item\Item $item) : \pocketmine\nbt\tag\CompoundTag

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