mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-10-19 04:15:04 +00:00
Convert ItemFactory to singleton
This commit is contained in:
@@ -176,7 +176,7 @@ class Banner extends Transparent{
|
||||
}
|
||||
|
||||
public function asItem() : Item{
|
||||
return ItemFactory::get(ItemIds::BANNER, $this->baseColor->getInvertedMagicNumber());
|
||||
return ItemFactory::getInstance()->get(ItemIds::BANNER, $this->baseColor->getInvertedMagicNumber());
|
||||
}
|
||||
|
||||
public function getDropsForCompatibleTool(Item $item) : array{
|
||||
|
@@ -193,7 +193,7 @@ class Bed extends Transparent{
|
||||
}
|
||||
|
||||
public function asItem() : Item{
|
||||
return ItemFactory::get($this->idInfo->getItemId(), $this->color->getMagicNumber());
|
||||
return ItemFactory::getInstance()->get($this->idInfo->getItemId(), $this->color->getMagicNumber());
|
||||
}
|
||||
|
||||
public function getAffectedBlocks() : array{
|
||||
|
@@ -104,7 +104,7 @@ class Block{
|
||||
}
|
||||
|
||||
public function asItem() : Item{
|
||||
return ItemFactory::get($this->idInfo->getItemId(), $this->idInfo->getVariant());
|
||||
return ItemFactory::getInstance()->get($this->idInfo->getItemId(), $this->idInfo->getVariant());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -130,7 +130,7 @@ class Leaves extends Transparent{
|
||||
|
||||
$drops = [];
|
||||
if(mt_rand(1, 20) === 1){ //Saplings
|
||||
$drops[] = ItemFactory::get(ItemIds::SAPLING, $this->treeType->getMagicNumber());
|
||||
$drops[] = ItemFactory::getInstance()->get(ItemIds::SAPLING, $this->treeType->getMagicNumber());
|
||||
}
|
||||
if(($this->treeType->equals(TreeType::OAK()) or $this->treeType->equals(TreeType::DARK_OAK())) and mt_rand(1, 200) === 1){ //Apples
|
||||
$drops[] = VanillaItems::APPLE();
|
||||
|
@@ -111,6 +111,6 @@ class Skull extends Flowable{
|
||||
}
|
||||
|
||||
public function asItem() : Item{
|
||||
return ItemFactory::get(ItemIds::SKULL, $this->skullType->getMagicNumber());
|
||||
return ItemFactory::getInstance()->get(ItemIds::SKULL, $this->skullType->getMagicNumber());
|
||||
}
|
||||
}
|
||||
|
@@ -169,7 +169,7 @@ class Furnace extends Spawnable implements Container, Nameable{
|
||||
++$this->cookTime;
|
||||
|
||||
if($this->cookTime >= 200){ //10 seconds
|
||||
$product = ItemFactory::get($smelt->getResult()->getId(), $smelt->getResult()->getMeta(), $product->getCount() + 1);
|
||||
$product = ItemFactory::getInstance()->get($smelt->getResult()->getId(), $smelt->getResult()->getMeta(), $product->getCount() + 1);
|
||||
|
||||
$ev = new FurnaceSmeltEvent($this, $raw, $product);
|
||||
$ev->call();
|
||||
|
Reference in New Issue
Block a user