mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-04 17:20:02 +00:00
Tile: remove server field
it would be nice to get rid of the server dependency entirely... perhaps craftingmanager should be a singleton? it's contextless after all...
This commit is contained in:
parent
d8ea8fa0f0
commit
d0e2cdb54c
@ -174,7 +174,7 @@ class Furnace extends Spawnable implements InventoryHolder, Container, Nameable{
|
|||||||
$fuel = $this->inventory->getFuel();
|
$fuel = $this->inventory->getFuel();
|
||||||
$raw = $this->inventory->getSmelting();
|
$raw = $this->inventory->getSmelting();
|
||||||
$product = $this->inventory->getResult();
|
$product = $this->inventory->getResult();
|
||||||
$smelt = $this->server->getCraftingManager()->matchFurnaceRecipe($raw);
|
$smelt = $this->level->getServer()->getCraftingManager()->matchFurnaceRecipe($raw);
|
||||||
$canSmelt = ($smelt instanceof FurnaceRecipe and $raw->getCount() > 0 and (($smelt->getResult()->equals($product) and $product->getCount() < $product->getMaxStackSize()) or $product->isNull()));
|
$canSmelt = ($smelt instanceof FurnaceRecipe and $raw->getCount() > 0 and (($smelt->getResult()->equals($product) and $product->getCount() < $product->getMaxStackSize()) or $product->isNull()));
|
||||||
|
|
||||||
if($this->burnTime <= 0 and $canSmelt and $fuel->getFuelTime() > 0 and $fuel->getCount() > 0){
|
if($this->burnTime <= 0 and $canSmelt and $fuel->getFuelTime() > 0 and $fuel->getCount() > 0){
|
||||||
|
@ -69,8 +69,6 @@ abstract class Tile extends Position{
|
|||||||
public $name;
|
public $name;
|
||||||
/** @var bool */
|
/** @var bool */
|
||||||
public $closed = false;
|
public $closed = false;
|
||||||
/** @var Server */
|
|
||||||
protected $server;
|
|
||||||
/** @var TimingsHandler */
|
/** @var TimingsHandler */
|
||||||
protected $timings;
|
protected $timings;
|
||||||
|
|
||||||
@ -140,7 +138,6 @@ abstract class Tile extends Position{
|
|||||||
public function __construct(Level $level, CompoundTag $nbt){
|
public function __construct(Level $level, CompoundTag $nbt){
|
||||||
$this->timings = Timings::getTileEntityTimings($this);
|
$this->timings = Timings::getTileEntityTimings($this);
|
||||||
|
|
||||||
$this->server = $level->getServer();
|
|
||||||
$this->name = "";
|
$this->name = "";
|
||||||
|
|
||||||
parent::__construct($nbt->getInt(self::TAG_X), $nbt->getInt(self::TAG_Y), $nbt->getInt(self::TAG_Z), $level);
|
parent::__construct($nbt->getInt(self::TAG_X), $nbt->getInt(self::TAG_Y), $nbt->getInt(self::TAG_Z), $level);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user