mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-04-23 00:55:57 +00:00
Use constructor parameter for ListTags instead of setTagType() and removed some unnecessary type setting
This commit is contained in:
parent
f5abed95ec
commit
cd8006e242
@ -49,8 +49,7 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
|
||||
$this->inventory = new ChestInventory($this);
|
||||
|
||||
if(!isset($this->namedtag->Items) or !($this->namedtag->Items instanceof ListTag)){
|
||||
$this->namedtag->Items = new ListTag("Items", []);
|
||||
$this->namedtag->Items->setTagType(NBT::TAG_Compound);
|
||||
$this->namedtag->Items = new ListTag("Items", [], NBT::TAG_Compound);
|
||||
}
|
||||
|
||||
for($i = 0; $i < $this->getSize(); ++$i){
|
||||
@ -81,7 +80,6 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
|
||||
|
||||
public function saveNBT(){
|
||||
$this->namedtag->Items->setValue([]);
|
||||
$this->namedtag->Items->setTagType(NBT::TAG_Compound);
|
||||
for($index = 0; $index < $this->getSize(); ++$index){
|
||||
$this->setItem($index, $this->inventory->getItem($index));
|
||||
}
|
||||
|
@ -66,8 +66,7 @@ class Furnace extends Spawnable implements InventoryHolder, Container, Nameable{
|
||||
$this->inventory = new FurnaceInventory($this);
|
||||
|
||||
if(!isset($this->namedtag->Items) or !($this->namedtag->Items instanceof ListTag)){
|
||||
$this->namedtag->Items = new ListTag("Items", []);
|
||||
$this->namedtag->Items->setTagType(NBT::TAG_Compound);
|
||||
$this->namedtag->Items = new ListTag("Items", [], NBT::TAG_Compound);
|
||||
}
|
||||
|
||||
for($i = 0; $i < $this->getSize(); ++$i){
|
||||
@ -110,7 +109,6 @@ class Furnace extends Spawnable implements InventoryHolder, Container, Nameable{
|
||||
|
||||
public function saveNBT(){
|
||||
$this->namedtag->Items->setValue([]);
|
||||
$this->namedtag->Items->setTagType(NBT::TAG_Compound);
|
||||
for($index = 0; $index < $this->getSize(); ++$index){
|
||||
$this->setItem($index, $this->inventory->getItem($index));
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user