TypeConverter
Methods
__construct()
public function __construct()cleanupUnnecessaryItemNBT() protected
protected function cleanupUnnecessaryItemNBT(\pocketmine\nbt\tag\CompoundTag $original) : \pocketmine\nbt\tag\CompoundTagTODO: 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()
public function coreItemStackToNet(\pocketmine\item\Item $itemStack, ?int $bundleContainerId = null) : \pocketmine\network\mcpe\protocol\types\inventory\ItemStackcoreRecipeIngredientToNet()
public function coreRecipeIngredientToNet(?\pocketmine\crafting\RecipeIngredient $ingredient) : \pocketmine\network\mcpe\protocol\types\recipe\RecipeIngredientdeserializeItemStackExtraData()
public function deserializeItemStackExtraData(string $extraData, int $id) : \pocketmine\network\mcpe\protocol\types\inventory\ItemStackExtraDatagetBlockTranslator()
public function getBlockTranslator() : \pocketmine\network\mcpe\convert\BlockTranslatorgetItemTranslator()
public function getItemTranslator() : \pocketmine\network\mcpe\convert\ItemTranslatorgetItemTypeDictionary()
public function getItemTypeDictionary() : \pocketmine\network\mcpe\protocol\serializer\ItemTypeDictionarygetSkinAdapter()
public function getSkinAdapter() : \pocketmine\network\mcpe\convert\SkinAdapterhashNBT() protected
protected function hashNBT(\pocketmine\nbt\tag\Tag $tag) : stringComputes 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()
public function netItemStackToCore(\pocketmine\network\mcpe\protocol\types\inventory\ItemStack $itemStack) : \pocketmine\item\ItemWARNING: 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()
public function netRecipeIngredientToCore(\pocketmine\network\mcpe\protocol\types\recipe\RecipeIngredient $ingredient) : ?\pocketmine\crafting\RecipeIngredientprotocolGameModeToCore()
public function protocolGameModeToCore(int $gameMode) : ?\pocketmine\player\GameModesetSkinAdapter()
public function setSkinAdapter(\pocketmine\network\mcpe\convert\SkinAdapter $skinAdapter) : voidstripBlockEntityNBT() protected
protected function stripBlockEntityNBT(\pocketmine\nbt\tag\CompoundTag $tag) : boolStrips 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
protected function stripContainedItemNonVisualNBT(\pocketmine\nbt\tag\CompoundTag $tag) : boolStrips 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.
