Stopgag patch: support block IDs from 128 to 255

Got my head out of my butt and figured how I was casting bytes to ints
all wrong. War map format can support block ids up to 255 now with this
ugly patch. This is just to tide people over until a format switch to
something that will supports custom blocks and items.
This commit is contained in:
taoneill 2012-09-04 23:16:47 -04:00
parent 39a8becdfe
commit d71adaa8ab
1 changed files with 6 additions and 1 deletions

View File

@ -210,8 +210,13 @@ public class ZoneVolumeMapper {
worldBlock.setType(Material.getMaterial(diskBlockType));
worldBlock.setData(diskBlockData);
} else {
// The larger than 127 block types were stored as bytes,
// but now -128 to -1 are the result of the bad cast from byte
// to int array above. To make matters worse let's make this
// quick a dirty patch. Anyway everything will break horribly
// once block ids get higher than 255.
War.war.getLogger().warning("Bad block type:" + diskBlockType + " data:" + diskBlockData + " at x:" + x + " y:" + y + " z:" + z);
worldBlock.setType(Material.getMaterial(Math.abs(diskBlockType)));
worldBlock.setType(Material.getMaterial(256 + diskBlockType));
worldBlock.setData(diskBlockData);
}
}