Fix loading schematic files with block data values >127

Minecraft 1.3 introduces several blocks with data values
over 127, such as sandstone stairs (128).  Since byte
is signed, implicit conversion to short results in
negative block data values that cause later IndexOutOfBounds
exceptions.  This change explicitly masks off the extended
sign bits so the result is positive.
This commit is contained in:
snaxson 2012-08-05 22:41:48 -07:00 committed by TomyLobo
parent 5e4c809f66
commit 00e6a3aa65

View File

@ -121,7 +121,7 @@ public class MCEditSchematicFormat extends SchematicFormat {
}
} else {
for (int i = 0; i < rawBlocks.length; ++i) {
blocks[i] = rawBlocks[i];
blocks[i] = (short) (rawBlocks[i] & 0xFF);
}
}