Skip to content

TypeConverter ​

class · pocketmine\network\mcpe\convert\TypeConverter · source

Methods ​

__construct() ​

php
public function __construct()

cleanupUnnecessaryItemNBT() protected ​

php
protected function cleanupUnnecessaryItemNBT(\pocketmine\nbt\tag\CompoundTag $original) : \pocketmine\nbt\tag\CompoundTag

TODO: HACK! Creates a copy of an item's NBT with non-viewable data stripped. This is a pretty yucky hack that's mainly needed because of inventories inside blockitems containing blockentity data. There isn't really a good way to deal with this due to the way tiles currently require a position, otherwise we could just keep a copy of the tile context and ask it for persistent vs network NBT as needed. Unfortunately, making this nice will require significant BC breaks, so this will have to do for now.

coreItemStackToNet() ​

php
public function coreItemStackToNet(\pocketmine\item\Item $itemStack, ?int $bundleContainerId = null) : \pocketmine\network\mcpe\protocol\types\inventory\ItemStack

coreRecipeIngredientToNet() ​

php
public function coreRecipeIngredientToNet(?\pocketmine\crafting\RecipeIngredient $ingredient) : \pocketmine\network\mcpe\protocol\types\recipe\RecipeIngredient

deserializeItemStackExtraData() ​

php
public function deserializeItemStackExtraData(string $extraData, int $id) : \pocketmine\network\mcpe\protocol\types\inventory\ItemStackExtraData

getBlockTranslator() ​

php
public function getBlockTranslator() : \pocketmine\network\mcpe\convert\BlockTranslator

getItemTranslator() ​

php
public function getItemTranslator() : \pocketmine\network\mcpe\convert\ItemTranslator

getItemTypeDictionary() ​

php
public function getItemTypeDictionary() : \pocketmine\network\mcpe\protocol\serializer\ItemTypeDictionary

getSkinAdapter() ​

php
public function getSkinAdapter() : \pocketmine\network\mcpe\convert\SkinAdapter

hashNBT() protected ​

php
protected function hashNBT(\pocketmine\nbt\tag\Tag $tag) : string

Computes a hash of an item's server-side NBT. This is baked into an item's network NBT to make sure the client doesn't try to stack items with the same network NBT but different server-side NBT.

netItemStackToCore() ​

php
public function netItemStackToCore(\pocketmine\network\mcpe\protocol\types\inventory\ItemStack $itemStack) : \pocketmine\item\Item

WARNING: Avoid this in server-side code. If you need to compare ItemStacks provided by the client to the server, prefer encoding the server's itemstack and comparing the serialized ItemStack, instead of converting the client's ItemStack to a core Item. This method will fully decode the item's extra data, which can be very costly if the item has a lot of NBT data.

netRecipeIngredientToCore() ​

php
public function netRecipeIngredientToCore(\pocketmine\network\mcpe\protocol\types\recipe\RecipeIngredient $ingredient) : ?\pocketmine\crafting\RecipeIngredient

protocolGameModeToCore() ​

php
public function protocolGameModeToCore(int $gameMode) : ?\pocketmine\player\GameMode

setSkinAdapter() ​

php
public function setSkinAdapter(\pocketmine\network\mcpe\convert\SkinAdapter $skinAdapter) : void

stripBlockEntityNBT() protected ​

php
protected function stripBlockEntityNBT(\pocketmine\nbt\tag\CompoundTag $tag) : bool

Strips unnecessary block actor NBT from items that have it. This tag can potentially be extremely large, and is not read by the client anyway.

stripContainedItemNonVisualNBT() protected ​

php
protected function stripContainedItemNonVisualNBT(\pocketmine\nbt\tag\CompoundTag $tag) : bool

Strips non-viewable data from shulker boxes and similar blocks The lore for shulker boxes only requires knowing the type & count of items and possibly custom name We don't need to, and should not allow, sending nested inventories across the network.

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