Check if state is null

This commit is contained in:
Brady 2019-12-18 10:27:34 -06:00
parent 5c9f028103
commit b4ddf38116
No known key found for this signature in database
GPG Key ID: 73A788379A197567
1 changed files with 7 additions and 2 deletions

View File

@ -106,7 +106,7 @@ public enum SpongeParser implements ISchematicParser {
if (buffer.readableBytes() > 0) {
blockData[i] = buffer.readVarInt();
} else {
throw new IllegalArgumentException("Not enough");
throw new IllegalArgumentException("Buffer has no remaining bytes");
}
}
@ -114,7 +114,12 @@ public enum SpongeParser implements ISchematicParser {
for (int z = 0; z < this.z; z++) {
for (int x = 0; x < this.x; x++) {
int index = (y * this.z + z) * this.x + x;
this.states[x][z][y] = palette.get(blockData[index]);
IBlockState state = palette.get(blockData[index]);
if (state == null) {
throw new IllegalArgumentException("Invalid Palette Index " + index);
}
this.states[x][z][y] = state;
}
}
}