Mirror von
https://github.com/IntellectualSites/FastAsyncWorldEdit.git
synchronisiert 2024-11-03 01:50:07 +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:
Ursprung
a3afd9d5b3
Commit
3a6b3dc75c
@ -83,18 +83,17 @@ 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);
|
||||||
BlockType type = BlockTypes.get(paletteEntry.getString("Name"));
|
BlockType type = BlockTypes.get(paletteEntry.getString("Name"));
|
||||||
if(type == null) {
|
if (type == null) {
|
||||||
throw new InvalidFormatException("Invalid block type: " + paletteEntry.getString("Name"));
|
throw new InvalidFormatException("Invalid block type: " + paletteEntry.getString("Name"));
|
||||||
}
|
}
|
||||||
BlockState blockState = type.getDefaultState();
|
BlockState blockState = type.getDefaultState();
|
||||||
@ -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;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren