mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-17 08:54:22 +00:00
fixed second half of double chest items getting deleted, close #1477
This commit is contained in:
parent
3e3157cbe1
commit
2c34648c3d
@ -51,4 +51,9 @@ interface Container{
|
|||||||
* @return Inventory
|
* @return Inventory
|
||||||
*/
|
*/
|
||||||
public function getInventory();
|
public function getInventory();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Inventory
|
||||||
|
*/
|
||||||
|
public function getRealInventory();
|
||||||
}
|
}
|
||||||
|
@ -45,7 +45,7 @@ trait ContainerTrait{
|
|||||||
/**
|
/**
|
||||||
* @return Inventory
|
* @return Inventory
|
||||||
*/
|
*/
|
||||||
abstract public function getInventory();
|
abstract public function getRealInventory();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $index
|
* @param $index
|
||||||
@ -118,7 +118,7 @@ trait ContainerTrait{
|
|||||||
$this->getNBT()->setTag(new ListTag(Container::TAG_ITEMS, [], NBT::TAG_Compound));
|
$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){
|
for($i = 0, $size = $this->getSize(); $i < $size; ++$i){
|
||||||
$inventory->setItem($i, $this->getItem($i));
|
$inventory->setItem($i, $this->getItem($i));
|
||||||
}
|
}
|
||||||
@ -127,7 +127,7 @@ trait ContainerTrait{
|
|||||||
protected function saveItems() : void{
|
protected function saveItems() : void{
|
||||||
$this->getNBT()->setTag(new ListTag(Container::TAG_ITEMS, [], NBT::TAG_Compound));
|
$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){
|
for($i = 0, $size = $this->getSize(); $i < $size; ++$i){
|
||||||
$this->setItem($i, $inventory->getItem($i));
|
$this->setItem($i, $inventory->getItem($i));
|
||||||
}
|
}
|
||||||
|
@ -118,6 +118,13 @@ class Furnace extends Spawnable implements InventoryHolder, Container, Nameable{
|
|||||||
return $this->inventory;
|
return $this->inventory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return FurnaceInventory
|
||||||
|
*/
|
||||||
|
public function getRealInventory(){
|
||||||
|
return $this->getInventory();
|
||||||
|
}
|
||||||
|
|
||||||
protected function checkFuel(Item $fuel){
|
protected function checkFuel(Item $fuel){
|
||||||
$this->server->getPluginManager()->callEvent($ev = new FurnaceBurnEvent($this, $fuel, $fuel->getFuelTime()));
|
$this->server->getPluginManager()->callEvent($ev = new FurnaceBurnEvent($this, $fuel, $fuel->getFuelTime()));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user