Centralize all conversion-related stuff under TypeConverter

instead of having singletons for everything, which are a nightmare to manage for multi version
This commit is contained in:
Dylan K. Taylor
2023-05-03 16:33:17 +01:00
parent 5e462db0f8
commit 01f340985a
26 changed files with 88 additions and 130 deletions

View File

@ -30,7 +30,6 @@ use pocketmine\crafting\ShapedRecipe;
use pocketmine\crafting\ShapelessRecipe;
use pocketmine\crafting\ShapelessRecipeType;
use pocketmine\item\Item;
use pocketmine\network\mcpe\convert\GlobalItemTypeDictionary;
use pocketmine\network\mcpe\convert\TypeConverter;
use pocketmine\network\mcpe\protocol\CraftingDataPacket;
use pocketmine\network\mcpe\protocol\types\inventory\ItemStack;
@ -173,7 +172,7 @@ final class CraftingDataCache{
}
$potionContainerChangeRecipes = [];
$itemTypeDictionary = GlobalItemTypeDictionary::getInstance()->getDictionary();
$itemTypeDictionary = TypeConverter::getInstance()->getItemTypeDictionary();
foreach($manager->getPotionContainerChangeRecipes() as $recipe){
$input = $itemTypeDictionary->fromStringId($recipe->getInputItemId());
$ingredient = $converter->coreRecipeIngredientToNet($recipe->getIngredient())->getDescriptor();