fixed second half of double chest items getting deleted, close #1477

This commit is contained in:
Dylan K. Taylor 2017-10-18 12:29:57 +01:00
parent 3e3157cbe1
commit 2c34648c3d
3 changed files with 15 additions and 3 deletions

View File

@ -51,4 +51,9 @@ interface Container{
* @return Inventory
*/
public function getInventory();
/**
* @return Inventory
*/
public function getRealInventory();
}

View File

@ -45,7 +45,7 @@ trait ContainerTrait{
/**
* @return Inventory
*/
abstract public function getInventory();
abstract public function getRealInventory();
/**
* @param $index
@ -118,7 +118,7 @@ trait ContainerTrait{
$this->getNBT()->setTag(new ListTag(Container::TAG_ITEMS, [], NBT::TAG_Compound));
}
$inventory = $this->getInventory();
$inventory = $this->getRealInventory();
for($i = 0, $size = $this->getSize(); $i < $size; ++$i){
$inventory->setItem($i, $this->getItem($i));
}
@ -127,7 +127,7 @@ trait ContainerTrait{
protected function saveItems() : void{
$this->getNBT()->setTag(new ListTag(Container::TAG_ITEMS, [], NBT::TAG_Compound));
$inventory = $this->getInventory();
$inventory = $this->getRealInventory();
for($i = 0, $size = $this->getSize(); $i < $size; ++$i){
$this->setItem($i, $inventory->getItem($i));
}

View File

@ -118,6 +118,13 @@ class Furnace extends Spawnable implements InventoryHolder, Container, Nameable{
return $this->inventory;
}
/**
* @return FurnaceInventory
*/
public function getRealInventory(){
return $this->getInventory();
}
protected function checkFuel(Item $fuel){
$this->server->getPluginManager()->callEvent($ev = new FurnaceBurnEvent($this, $fuel, $fuel->getFuelTime()));