mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-07 12:18:46 +00:00
Tile: remove unnecessary removeTag() calls
these CompoundTags are now ephemeral, so it's not necessary to remove potential garbage from them anymore.
This commit is contained in:
parent
fa21cd96c5
commit
4c1d29cdf7
@ -64,8 +64,6 @@ class Chest extends Spawnable implements InventoryHolder, Container, Nameable{
|
|||||||
if($this->isPaired()){
|
if($this->isPaired()){
|
||||||
$nbt->setInt(self::TAG_PAIRX, $this->pairX);
|
$nbt->setInt(self::TAG_PAIRX, $this->pairX);
|
||||||
$nbt->setInt(self::TAG_PAIRZ, $this->pairZ);
|
$nbt->setInt(self::TAG_PAIRZ, $this->pairZ);
|
||||||
}else{
|
|
||||||
$nbt->removeTag(self::TAG_PAIRX, self::TAG_PAIRZ);
|
|
||||||
}
|
}
|
||||||
$this->saveName($nbt);
|
$this->saveName($nbt);
|
||||||
$this->saveItems($nbt);
|
$this->saveItems($nbt);
|
||||||
|
@ -40,13 +40,11 @@ class Sign extends Spawnable{
|
|||||||
if($nbt->hasTag(self::TAG_TEXT_BLOB, StringTag::class)){ //MCPE 1.2 save format
|
if($nbt->hasTag(self::TAG_TEXT_BLOB, StringTag::class)){ //MCPE 1.2 save format
|
||||||
$this->text = array_pad(explode("\n", $nbt->getString(self::TAG_TEXT_BLOB)), 4, "");
|
$this->text = array_pad(explode("\n", $nbt->getString(self::TAG_TEXT_BLOB)), 4, "");
|
||||||
assert(count($this->text) === 4, "Too many lines!");
|
assert(count($this->text) === 4, "Too many lines!");
|
||||||
$nbt->removeTag(self::TAG_TEXT_BLOB);
|
|
||||||
}else{
|
}else{
|
||||||
for($i = 1; $i <= 4; ++$i){
|
for($i = 1; $i <= 4; ++$i){
|
||||||
$textKey = sprintf(self::TAG_TEXT_LINE, $i);
|
$textKey = sprintf(self::TAG_TEXT_LINE, $i);
|
||||||
if($nbt->hasTag($textKey, StringTag::class)){
|
if($nbt->hasTag($textKey, StringTag::class)){
|
||||||
$this->text[$i - 1] = $nbt->getString($textKey);
|
$this->text[$i - 1] = $nbt->getString($textKey);
|
||||||
$nbt->removeTag($textKey);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user