mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 01:37:37 +00:00
Fix restore for 1.14 chunk format.
Top-most chunk can now have lighting without have a palette or blocks.
This commit is contained in:
parent
a3afd9d5b3
commit
3a6b3dc75c
@ -83,13 +83,12 @@ public class AnvilChunk13 implements Chunk {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
int blocksPerChunkSection = 16 * 16 * 16;
|
|
||||||
BlockState[] chunkSectionBlocks = new BlockState[blocksPerChunkSection];
|
|
||||||
blocks[y] = chunkSectionBlocks;
|
|
||||||
|
|
||||||
// parse palette
|
// parse palette
|
||||||
List<CompoundTag> paletteEntries = sectionTag.getList("Palette", CompoundTag.class);
|
List<CompoundTag> paletteEntries = sectionTag.getList("Palette", CompoundTag.class);
|
||||||
int paletteSize = paletteEntries.size();
|
int paletteSize = paletteEntries.size();
|
||||||
|
if (paletteSize == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
BlockState[] palette = new BlockState[paletteSize];
|
BlockState[] palette = new BlockState[paletteSize];
|
||||||
for (int paletteEntryId = 0; paletteEntryId < paletteSize; paletteEntryId++) {
|
for (int paletteEntryId = 0; paletteEntryId < paletteSize; paletteEntryId++) {
|
||||||
CompoundTag paletteEntry = paletteEntries.get(paletteEntryId);
|
CompoundTag paletteEntry = paletteEntries.get(paletteEntryId);
|
||||||
@ -121,11 +120,16 @@ public class AnvilChunk13 implements Chunk {
|
|||||||
|
|
||||||
// parse block states
|
// parse block states
|
||||||
long[] blockStatesSerialized = NBTUtils.getChildTag(sectionTag.getValue(), "BlockStates", LongArrayTag.class).getValue();
|
long[] blockStatesSerialized = NBTUtils.getChildTag(sectionTag.getValue(), "BlockStates", LongArrayTag.class).getValue();
|
||||||
|
|
||||||
|
int blocksPerChunkSection = 16 * 16 * 16;
|
||||||
|
BlockState[] chunkSectionBlocks = new BlockState[blocksPerChunkSection];
|
||||||
|
blocks[y] = chunkSectionBlocks;
|
||||||
|
|
||||||
long currentSerializedValue = 0;
|
long currentSerializedValue = 0;
|
||||||
int nextSerializedItem = 0;
|
int nextSerializedItem = 0;
|
||||||
int remainingBits = 0;
|
int remainingBits = 0;
|
||||||
for (int blockPos = 0; blockPos < blocksPerChunkSection; blockPos++) {
|
for (int blockPos = 0; blockPos < blocksPerChunkSection; blockPos++) {
|
||||||
int localBlockId = 0;
|
int localBlockId;
|
||||||
if (remainingBits < paletteBits) {
|
if (remainingBits < paletteBits) {
|
||||||
int bitsNextLong = paletteBits - remainingBits;
|
int bitsNextLong = paletteBits - remainingBits;
|
||||||
localBlockId = (int) currentSerializedValue;
|
localBlockId = (int) currentSerializedValue;
|
||||||
|
Loading…
Reference in New Issue
Block a user