RegionWorldProvider: Show a more specific message on missing required ByteArrayTags

This commit is contained in:
Dylan K. Taylor 2021-11-23 01:39:35 +00:00
parent 020cd7b966
commit fb0eebc0dc
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -173,6 +173,9 @@ abstract class RegionWorldProvider extends BaseWorldProvider{
protected static function readFixedSizeByteArray(CompoundTag $chunk, string $tagName, int $length) : string{
$tag = $chunk->getTag($tagName);
if(!($tag instanceof ByteArrayTag)){
if($tag === null){
throw new CorruptedChunkException("'$tagName' key is missing from chunk NBT");
}
throw new CorruptedChunkException("Expected TAG_ByteArray for '$tagName'");
}
$data = $tag->getValue();