PocketMine-MP 5.41.1 git-dec84fe67dc3319e33f5066e5d03b16f00f2ff4c
Loading...
Searching...
No Matches
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, private BlockItemIdMap $blockItemIdMap, private BlockStateDictionary $blockStateDictionary)
 
 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,
private BlockItemIdMap $blockItemIdMap,
private BlockStateDictionary $blockStateDictionary )

Definition at line 44 of file ItemDataUpgrader.php.

Member Function Documentation

◆ getIdMetaUpgrader()

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

Definition at line 202 of file ItemDataUpgrader.php.

◆ upgradeItemStackNbt()

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

Definition at line 173 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 92 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 61 of file ItemDataUpgrader.php.


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