Archived
0

убираем костыли в сериализации чанков

This commit is contained in:
2018-11-11 02:55:56 +03:00
parent bc1748632d
commit 74e17d4c83

View File

@@ -151,14 +151,15 @@ public class ChunkDataPacket implements SCPacket {
for (int y = 0; y < 16; y++) { for (int y = 0; y < 16; y++) {
for (int z = 0; z < 16; z++) { for (int z = 0; z < 16; z++) {
for (int x = 15; x >= 0; x--) { for (int x = 0; x < 16; x++) {
palettedChunkSection.addBlock(chunkSection.getBlockLocal(x, y, z)); palettedChunkSection.addBlock(
palettedChunkSection.addBlockLight(15-x, y, z, chunkSection.getBlockLocal(15-x, y, z).getLight()); chunkSection.getBlockLocal(x, y, z),
palettedChunkSection.addSkyLight(15-x, y, z, chunkSection.getSkyLightLocal(15-x, y, z)); chunkSection.getSkyLightLocal(x, y, z)
);
if (biomeWrite) { if (biomeWrite) {
biomes.writeByte(chunkSection.getBiomeLocal(x, z).getId()); biomes.writeByte(chunkSection.getBiomeLocal(x, z).getId());
if (x == 0 && z == 15) { if (x == 15 && z == 15) {
biomeWrite = false; biomeWrite = false;
} }
} }
@@ -219,17 +220,11 @@ public class ChunkDataPacket implements SCPacket {
return (byte) idx; return (byte) idx;
} }
void addBlockLight(int x, int y, int z, int value) { void addBlock(Block block, int skyLight) {
blockLight.set(x, y, z, value);
}
void addSkyLight(int x, int y, int z, int value) {
skyLight.set(x, y, z, value);
}
void addBlock(Block block) {
BlockLocation location = block.getLocation().toLocal(); BlockLocation location = block.getLocation().toLocal();
blocks[coordsToIndex(location)] = addBlockType(block.getBlockType()); blocks[coordsToIndex(location)] = addBlockType(block.getBlockType());
blockLight.set(location, block.getLight());
this.skyLight.set(location, skyLight);
} }
void writeToNetStream(final NetOutputStream netOutputStream) { void writeToNetStream(final NetOutputStream netOutputStream) {