PocketMine-MP 5.15.1 git-fb9a74e8799c71ed8292cfa53abe7a4c9204629d
pocketmine\data\bedrock\item\upgrade\ItemDataUpgrader Class Reference
+ Collaboration diagram for pocketmine\data\bedrock\item\upgrade\ItemDataUpgrader:

Public Member Functions

 __construct (private ItemIdMetaUpgrader $idMetaUpgrader, private LegacyItemIdToStringIdMap $legacyIntToStringIdMap, private R12ItemIdToBlockIdMap $r12ItemIdToBlockIdMap, private BlockDataUpgrader $blockDataUpgrader,)
 
 getIdMetaUpgrader ()
 
 upgradeItemStackNbt (CompoundTag $tag)
 
 upgradeItemTypeDataInt (int $legacyNumericId, int $meta, int $count, ?CompoundTag $nbt)
 
 upgradeItemTypeDataString (string $rawNameId, int $meta, int $count, ?CompoundTag $nbt)
 

Detailed Description

Definition at line 41 of file ItemDataUpgrader.php.

Constructor & Destructor Documentation

◆ __construct()

pocketmine\data\bedrock\item\upgrade\ItemDataUpgrader::__construct ( private ItemIdMetaUpgrader  $idMetaUpgrader,
private LegacyItemIdToStringIdMap  $legacyIntToStringIdMap,
private R12ItemIdToBlockIdMap  $r12ItemIdToBlockIdMap,
private BlockDataUpgrader  $blockDataUpgrader 
)

Definition at line 44 of file ItemDataUpgrader.php.

Member Function Documentation

◆ getIdMetaUpgrader()

pocketmine\data\bedrock\item\upgrade\ItemDataUpgrader::getIdMetaUpgrader ( )

Definition at line 209 of file ItemDataUpgrader.php.

◆ upgradeItemStackNbt()

pocketmine\data\bedrock\item\upgrade\ItemDataUpgrader::upgradeItemStackNbt ( CompoundTag  $tag)
Exceptions
SavedDataLoadingException

Definition at line 180 of file ItemDataUpgrader.php.

◆ upgradeItemTypeDataInt()

pocketmine\data\bedrock\item\upgrade\ItemDataUpgrader::upgradeItemTypeDataInt ( int  $legacyNumericId,
int  $meta,
int  $count,
?CompoundTag  $nbt 
)

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

Exceptions
SavedDataLoadingExceptionif the legacy numeric ID doesn't map to a string ID

Definition at line 90 of file ItemDataUpgrader.php.

◆ upgradeItemTypeDataString()

pocketmine\data\bedrock\item\upgrade\ItemDataUpgrader::upgradeItemTypeDataString ( string  $rawNameId,
int  $meta,
int  $count,
?CompoundTag  $nbt 
)

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.

See also
ItemDataUpgrader::upgradeItemTypeDataInt()

Definition at line 59 of file ItemDataUpgrader.php.


The documentation for this class was generated from the following file: