CompoundTag sectionTag = new CompoundTag();
sectionTag.putByte("Y", i);
byte[] rawTypes = new byte[sec.types.length];
NibbleArray extTypes = null;
NibbleArray data = new NibbleArray(sec.types.length);
for (int j = 0; j < sec.types.length; j++) {
rawTypes[j] = (byte) ((sec.types[j] >> 4) & 0xFF);
byte extType = (byte) (sec.types[j] >> 12);
if (extType > 0) {
if (extTypes == null) {
extTypes = new NibbleArray(sec.types.length);
}
extTypes.set(j, extType);
}
data.set(j, (byte) (sec.types[j] & 0xF));
}
sectionTag.putByteArray("Blocks", rawTypes);
if (extTypes != null) {
sectionTag.putByteArray("Add", extTypes.getRawData());
}
sectionTag.putByteArray("Data", data.getRawData());
sectionTag.putByteArray("BlockLight", sec.blockLight.getRawData());
sectionTag.putByteArray("SkyLight", sec.skyLight.getRawData());
sectionTags.add(sectionTag);
}