Item factory refactor and added capability to register custom items

This commit is contained in:
Dylan K. Taylor
2017-08-20 19:11:21 +01:00
parent 604d11a8fd
commit 876659cc73
66 changed files with 491 additions and 347 deletions

View File

@ -24,6 +24,7 @@ declare(strict_types=1);
namespace pocketmine\inventory;
use pocketmine\item\Item;
use pocketmine\item\ItemFactory;
use pocketmine\math\Vector2;
use pocketmine\Server;
use pocketmine\utils\UUID;
@ -141,7 +142,7 @@ class ShapedRecipe implements Recipe{
if($ingredient !== null){
$ingredients[$y][$x] = clone $ingredient;
}else{
$ingredients[$y][$x] = Item::get(Item::AIR);
$ingredients[$y][$x] = ItemFactory::get(Item::AIR);
}
}
}
@ -156,7 +157,7 @@ class ShapedRecipe implements Recipe{
* @return Item
*/
public function getIngredient(int $x, int $y) : Item{
return $this->ingredients[$y][$x] ?? Item::get(Item::AIR);
return $this->ingredients[$y][$x] ?? ItemFactory::get(Item::AIR);
}
/**