Fixes for Chest & Furnace

This commit is contained in:
Shoghi Cervantes
2014-05-26 10:46:30 +02:00
parent 274f972b58
commit ffa3e8a0aa
3 changed files with 17 additions and 14 deletions

View File

@ -60,8 +60,8 @@ class Furnace extends Tile implements InventoryHolder, Container{
}
public function saveNBT(){
$this->namedtag->Inventory = new Enum("Inventory", []);
$this->namedtag->Inventory->setTagType(NBT::TAG_Compound);
$this->namedtag->Items = new Enum("Inventory", []);
$this->namedtag->Items->setTagType(NBT::TAG_Compound);
for($index = 0; $index < $this->getSize(); ++$index){
$this->setItem($index, $this->inventory->getItem($index));
}
@ -115,9 +115,6 @@ class Furnace extends Tile 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()),
@ -131,7 +128,12 @@ class Furnace extends Tile 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;
}