mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-02 00:02:57 +00:00
Fix furnace NBT assertion errors and inventory not working
This commit is contained in:
parent
23f3097390
commit
ad64a074cb
@ -44,6 +44,17 @@ class Furnace extends Spawnable implements InventoryHolder, Container, Nameable{
|
|||||||
protected $inventory;
|
protected $inventory;
|
||||||
|
|
||||||
public function __construct(FullChunk $chunk, CompoundTag $nbt){
|
public function __construct(FullChunk $chunk, CompoundTag $nbt){
|
||||||
|
if(!isset($nbt->BurnTime) or $nbt["BurnTime"] < 0){
|
||||||
|
$nbt->BurnTime = new ShortTag("BurnTime", 0);
|
||||||
|
}
|
||||||
|
if(!isset($nbt->CookTime) or $nbt["CookTime"] < 0 or ($nbt["BurnTime"] === 0 and $nbt["CookTime"] > 0)){
|
||||||
|
$nbt->CookTime = new ShortTag("CookTime", 0);
|
||||||
|
}
|
||||||
|
if(!isset($nbt->MaxTime)){
|
||||||
|
$nbt->MaxTime = new ShortTag("BurnTime", $nbt["BurnTime"]);
|
||||||
|
$nbt->BurnTicks = new ShortTag("BurnTicks", 0);
|
||||||
|
}
|
||||||
|
|
||||||
parent::__construct($chunk, $nbt);
|
parent::__construct($chunk, $nbt);
|
||||||
$this->inventory = new FurnaceInventory($this);
|
$this->inventory = new FurnaceInventory($this);
|
||||||
|
|
||||||
@ -56,16 +67,6 @@ class Furnace extends Spawnable implements InventoryHolder, Container, Nameable{
|
|||||||
$this->inventory->setItem($i, $this->getItem($i));
|
$this->inventory->setItem($i, $this->getItem($i));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!isset($this->namedtag->BurnTime) or $this->namedtag["BurnTime"] < 0){
|
|
||||||
$this->namedtag->BurnTime = new ShortTag("BurnTime", 0);
|
|
||||||
}
|
|
||||||
if(!isset($this->namedtag->CookTime) or $this->namedtag["CookTime"] < 0 or ($this->namedtag["BurnTime"] === 0 and $this->namedtag["CookTime"] > 0)){
|
|
||||||
$this->namedtag->CookTime = new ShortTag("CookTime", 0);
|
|
||||||
}
|
|
||||||
if(!isset($this->namedtag->MaxTime)){
|
|
||||||
$this->namedtag->MaxTime = new ShortTag("BurnTime", $this->namedtag["BurnTime"]);
|
|
||||||
$this->namedtag->BurnTicks = new ShortTag("BurnTicks", 0);
|
|
||||||
}
|
|
||||||
if($this->namedtag["BurnTime"] > 0){
|
if($this->namedtag["BurnTime"] > 0){
|
||||||
$this->scheduleUpdate();
|
$this->scheduleUpdate();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user