mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 01:46:04 +00:00
Fixes for Chest & Furnace
This commit is contained in:
@ -55,8 +55,8 @@ class Chest extends Spawnable implements InventoryHolder, Container{
|
||||
}
|
||||
|
||||
public function saveNBT(){
|
||||
$this->namedtag->Inventory = new Enum("Inventory", []);
|
||||
$this->namedtag->Inventory->setTagType(NBT::TAG_Compound);
|
||||
$this->namedtag->Items = new Enum("Items", []);
|
||||
$this->namedtag->Items->setTagType(NBT::TAG_Compound);
|
||||
for($index = 0; $index < $this->getSize(); ++$index){
|
||||
$this->setItem($index, $this->inventory->getItem($index));
|
||||
}
|
||||
@ -110,9 +110,6 @@ class Chest extends Spawnable implements InventoryHolder, Container{
|
||||
*/
|
||||
public function setItem($index, Item $item){
|
||||
$i = $this->getSlotIndex($index);
|
||||
if($i < 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
$d = new Compound(false, array(
|
||||
new Byte("Count", $item->getCount()),
|
||||
@ -126,7 +123,12 @@ class Chest extends Spawnable implements InventoryHolder, Container{
|
||||
unset($this->namedtag->Items[$i]);
|
||||
}
|
||||
}elseif($i < 0){
|
||||
$this->namedtag->Items[] = $d;
|
||||
for($i = 0; $i <= $this->getSize(); ++$i){
|
||||
if(!isset($this->namedtag->Items[$i])){
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->namedtag->Items[$i] = $d;
|
||||
}else{
|
||||
$this->namedtag->Items[$i] = $d;
|
||||
}
|
||||
|
Reference in New Issue
Block a user