mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-05-14 17:59:41 +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 = [];
|
$this->craftingItems = [];
|
||||||
}
|
}
|
||||||
break;
|
|
||||||
}else{
|
}else{
|
||||||
$this->toCraft = [];
|
$this->toCraft = [];
|
||||||
$this->craftingItems = [];
|
$this->craftingItems = [];
|
||||||
}
|
}
|
||||||
if(!isset($this->windowIndex[$packet->windowid])){
|
if($packet->windowid == 0 or !isset($this->windowIndex[$packet->windowid])){
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,8 +55,8 @@ class Chest extends Spawnable implements InventoryHolder, Container{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function saveNBT(){
|
public function saveNBT(){
|
||||||
$this->namedtag->Inventory = new Enum("Inventory", []);
|
$this->namedtag->Items = new Enum("Items", []);
|
||||||
$this->namedtag->Inventory->setTagType(NBT::TAG_Compound);
|
$this->namedtag->Items->setTagType(NBT::TAG_Compound);
|
||||||
for($index = 0; $index < $this->getSize(); ++$index){
|
for($index = 0; $index < $this->getSize(); ++$index){
|
||||||
$this->setItem($index, $this->inventory->getItem($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){
|
public function setItem($index, Item $item){
|
||||||
$i = $this->getSlotIndex($index);
|
$i = $this->getSlotIndex($index);
|
||||||
if($i < 0){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$d = new Compound(false, array(
|
$d = new Compound(false, array(
|
||||||
new Byte("Count", $item->getCount()),
|
new Byte("Count", $item->getCount()),
|
||||||
@ -126,7 +123,12 @@ class Chest extends Spawnable implements InventoryHolder, Container{
|
|||||||
unset($this->namedtag->Items[$i]);
|
unset($this->namedtag->Items[$i]);
|
||||||
}
|
}
|
||||||
}elseif($i < 0){
|
}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{
|
}else{
|
||||||
$this->namedtag->Items[$i] = $d;
|
$this->namedtag->Items[$i] = $d;
|
||||||
}
|
}
|
||||||
|
@ -60,8 +60,8 @@ class Furnace extends Tile implements InventoryHolder, Container{
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function saveNBT(){
|
public function saveNBT(){
|
||||||
$this->namedtag->Inventory = new Enum("Inventory", []);
|
$this->namedtag->Items = new Enum("Inventory", []);
|
||||||
$this->namedtag->Inventory->setTagType(NBT::TAG_Compound);
|
$this->namedtag->Items->setTagType(NBT::TAG_Compound);
|
||||||
for($index = 0; $index < $this->getSize(); ++$index){
|
for($index = 0; $index < $this->getSize(); ++$index){
|
||||||
$this->setItem($index, $this->inventory->getItem($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){
|
public function setItem($index, Item $item){
|
||||||
$i = $this->getSlotIndex($index);
|
$i = $this->getSlotIndex($index);
|
||||||
if($i < 0){
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
$d = new Compound(false, array(
|
$d = new Compound(false, array(
|
||||||
new Byte("Count", $item->getCount()),
|
new Byte("Count", $item->getCount()),
|
||||||
@ -131,7 +128,12 @@ class Furnace extends Tile implements InventoryHolder, Container{
|
|||||||
unset($this->namedtag->Items[$i]);
|
unset($this->namedtag->Items[$i]);
|
||||||
}
|
}
|
||||||
}elseif($i < 0){
|
}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{
|
}else{
|
||||||
$this->namedtag->Items[$i] = $d;
|
$this->namedtag->Items[$i] = $d;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user