mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 09:49:50 +00:00
Fixes for Chest & Furnace
This commit is contained in:
parent
274f972b58
commit
ffa3e8a0aa
@ -2057,12 +2057,11 @@ class Player extends Human implements CommandSender, InventoryHolder, IPlayer{
|
||||
}
|
||||
$this->craftingItems = [];
|
||||
}
|
||||
break;
|
||||
}else{
|
||||
$this->toCraft = [];
|
||||
$this->craftingItems = [];
|
||||
}
|
||||
if(!isset($this->windowIndex[$packet->windowid])){
|
||||
if($packet->windowid == 0 or !isset($this->windowIndex[$packet->windowid])){
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user