3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-11-05 02:50:05 +01:00

Fix restore for 1.14 chunk format.

Top-most chunk can now have lighting without have a palette or blocks.
Dieser Commit ist enthalten in:
wizjany 2019-06-02 21:50:07 -04:00
Ursprung a3afd9d5b3
Commit 3a6b3dc75c

Datei anzeigen

@ -83,18 +83,17 @@ public class AnvilChunk13 implements Chunk {
continue;
}
int blocksPerChunkSection = 16 * 16 * 16;
BlockState[] chunkSectionBlocks = new BlockState[blocksPerChunkSection];
blocks[y] = chunkSectionBlocks;
// parse palette
List<CompoundTag> paletteEntries = sectionTag.getList("Palette", CompoundTag.class);
int paletteSize = paletteEntries.size();
if (paletteSize == 0) {
continue;
}
BlockState[] palette = new BlockState[paletteSize];
for (int paletteEntryId = 0; paletteEntryId < paletteSize; paletteEntryId++) {
CompoundTag paletteEntry = paletteEntries.get(paletteEntryId);
BlockType type = BlockTypes.get(paletteEntry.getString("Name"));
if(type == null) {
if (type == null) {
throw new InvalidFormatException("Invalid block type: " + paletteEntry.getString("Name"));
}
BlockState blockState = type.getDefaultState();
@ -121,11 +120,16 @@ public class AnvilChunk13 implements Chunk {
// parse block states
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;
int nextSerializedItem = 0;
int remainingBits = 0;
for (int blockPos = 0; blockPos < blocksPerChunkSection; blockPos++) {
int localBlockId = 0;
int localBlockId;
if (remainingBits < paletteBits) {
int bitsNextLong = paletteBits - remainingBits;
localBlockId = (int) currentSerializedValue;