Sign: Pad exploded blob to appropriate size

I'm not sure how it's possible to get one of these blobs with less newlines than expected, but whatever I guess
closes #2152
This commit is contained in:
Dylan K. Taylor 2018-05-04 23:29:32 +01:00
parent dd1dfefd83
commit 396056c636

View File

@ -42,7 +42,7 @@ class Sign extends Spawnable{
public function __construct(Level $level, CompoundTag $nbt){
if($nbt->hasTag(self::TAG_TEXT_BLOB, StringTag::class)){ //MCPE 1.2 save format
$this->text = explode("\n", $nbt->getString(self::TAG_TEXT_BLOB));
$this->text = array_pad(explode("\n", $nbt->getString(self::TAG_TEXT_BLOB)), 4, "");
assert(count($this->text) === 4, "Too many lines!");
$nbt->removeTag(self::TAG_TEXT_BLOB);
}else{