Skip to content

ItemDataUpgrader ​

final class · pocketmine\data\bedrock\item\upgrade\ItemDataUpgrader · source

Methods ​

__construct() ​

php
public function __construct(\pocketmine\data\bedrock\item\upgrade\ItemIdMetaUpgrader $idMetaUpgrader, \pocketmine\data\bedrock\item\upgrade\LegacyItemIdToStringIdMap $legacyIntToStringIdMap, \pocketmine\data\bedrock\item\upgrade\R12ItemIdToBlockIdMap $r12ItemIdToBlockIdMap, \pocketmine\data\bedrock\block\upgrade\BlockDataUpgrader $blockDataUpgrader, \pocketmine\data\bedrock\item\BlockItemIdMap $bl …

getIdMetaUpgrader() ​

php
public function getIdMetaUpgrader() : \pocketmine\data\bedrock\item\upgrade\ItemIdMetaUpgrader

upgradeItemStackNbt() ​

php
public function upgradeItemStackNbt(\pocketmine\nbt\tag\CompoundTag $tag) : ?\pocketmine\data\bedrock\item\SavedItemStackData

upgradeItemTypeDataInt() ​

php
public function upgradeItemTypeDataInt(int $legacyNumericId, int $meta, int $count, ?\pocketmine\nbt\tag\CompoundTag $nbt) : \pocketmine\data\bedrock\item\SavedItemStackData

This function replaces the legacy ItemFactory::get().

upgradeItemTypeDataString() ​

php
public function upgradeItemTypeDataString(string $rawNameId, int $meta, int $count, ?\pocketmine\nbt\tag\CompoundTag $nbt) : \pocketmine\data\bedrock\item\SavedItemStackData

This function replaces the legacy ItemFactory::get().

Unlike ItemFactory::get(), it returns a SavedItemStackData which you can do with as you please. If you want to deserialize it into a PocketMine-MP itemstack, pass it to the ItemDeserializer.

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