ItemTranslator: use GlobalItemDataHandlers

this ensures that plugin serializers will actually be used on the network.
This commit is contained in:
Dylan K. Taylor 2022-07-04 15:47:28 +01:00
parent e44a291697
commit 405e552efd
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -32,7 +32,7 @@ use pocketmine\item\Item;
use pocketmine\network\mcpe\protocol\serializer\ItemTypeDictionary; use pocketmine\network\mcpe\protocol\serializer\ItemTypeDictionary;
use pocketmine\utils\AssumptionFailedError; use pocketmine\utils\AssumptionFailedError;
use pocketmine\utils\SingletonTrait; use pocketmine\utils\SingletonTrait;
use pocketmine\world\format\io\GlobalBlockStateHandlers; use pocketmine\world\format\io\GlobalItemDataHandlers;
/** /**
* This class handles translation between network item ID+metadata to PocketMine-MP internal ID+metadata and vice versa. * This class handles translation between network item ID+metadata to PocketMine-MP internal ID+metadata and vice versa.
@ -46,8 +46,8 @@ final class ItemTranslator{
return new self( return new self(
GlobalItemTypeDictionary::getInstance()->getDictionary(), GlobalItemTypeDictionary::getInstance()->getDictionary(),
RuntimeBlockMapping::getInstance()->getBlockStateDictionary(), RuntimeBlockMapping::getInstance()->getBlockStateDictionary(),
new ItemSerializer(GlobalBlockStateHandlers::getSerializer()), GlobalItemDataHandlers::getSerializer(),
new ItemDeserializer(GlobalBlockStateHandlers::getDeserializer()) GlobalItemDataHandlers::getDeserializer()
); );
} }