Chunk's Add section stores the first block in the lowest nibble

Dieser Commit ist enthalten in:
Albert Pham 2013-02-23 22:39:59 -08:00
Ursprung 02abf41b83
Commit e17a35bb15

Datei anzeigen

@ -117,11 +117,14 @@ public class AnvilChunk implements Chunk {
try { try {
int addId = 0; int addId = 0;
// 4 bits, so we have to divide by 2 and get the right 4 bits // The block ID is the combination of the Blocks byte array with the
// Add byte array. 'Blocks' stores the lowest 8 bits of a block's ID, and
// 'Add' stores the highest 4 bits of the ID. The first block is stored
// in the lowest nibble in the Add byte array.
if (index % 2 == 0) { if (index % 2 == 0) {
addId = (blocksAdd[section][index / 2] & 0xF0) << 4; addId = (blocksAdd[section][index >> 1] & 0x0F) << 8;
} else { } else {
addId = (blocksAdd[section][index / 2] & 0x0F) << 8; addId = (blocksAdd[section][index >> 1] & 0xF0) << 4;
} }
return blocks[section][index] & 0xFF + addId; return blocks[section][index] & 0xFF + addId;