Use VanillaItems::AIR() instead of ItemFactory

This commit is contained in:
Dylan K. Taylor
2022-05-24 15:47:27 +01:00
parent 9a5a03ef83
commit 227f28a6d2
2 changed files with 4 additions and 3 deletions

View File

@ -36,6 +36,7 @@ use pocketmine\item\Durable;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\item\ItemIds;
use pocketmine\item\VanillaItems;
use pocketmine\nbt\NbtException;
use pocketmine\nbt\tag\CompoundTag;
use pocketmine\nbt\tag\IntTag;
@ -126,7 +127,7 @@ class TypeConverter{
public function recipeIngredientToCoreItemStack(RecipeIngredient $ingredient) : Item{
if($ingredient->getId() === 0){
return ItemFactory::getInstance()->get(ItemIds::AIR, 0, 0);
return VanillaItems::AIR();
}
[$id, $meta] = ItemTranslator::getInstance()->fromNetworkIdWithWildcardHandling($ingredient->getId(), $ingredient->getMeta());
return ItemFactory::getInstance()->get($id, $meta, $ingredient->getCount());
@ -202,7 +203,7 @@ class TypeConverter{
*/
public function netItemStackToCore(ItemStack $itemStack) : Item{
if($itemStack->getId() === 0){
return ItemFactory::getInstance()->get(ItemIds::AIR, 0, 0);
return VanillaItems::AIR();
}
$compound = $itemStack->getNbt();