Allow Item (de)serializer to accept dynamic BlockState(De)Serializer

This commit is contained in:
Dylan K. Taylor
2022-06-08 16:22:35 +01:00
parent c8e318df8c
commit 301b0aba82
4 changed files with 20 additions and 15 deletions

View File

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