mirror of
https://github.com/webbukkit/dynmap.git
synced 2025-01-27 10:01:37 +01:00
Handle pre 1.16.1 and current chunk encodings
This commit is contained in:
parent
11cc04320c
commit
17cbfb97ec
@ -25,6 +25,7 @@ import net.minecraft.server.v1_16_R1.ChunkCoordIntPair;
|
|||||||
import net.minecraft.server.v1_16_R1.ChunkRegionLoader;
|
import net.minecraft.server.v1_16_R1.ChunkRegionLoader;
|
||||||
import net.minecraft.server.v1_16_R1.ChunkStatus;
|
import net.minecraft.server.v1_16_R1.ChunkStatus;
|
||||||
import net.minecraft.server.v1_16_R1.DataBits;
|
import net.minecraft.server.v1_16_R1.DataBits;
|
||||||
|
import net.minecraft.server.v1_16_R1.DataBitsPacked;
|
||||||
import net.minecraft.server.v1_16_R1.NBTTagCompound;
|
import net.minecraft.server.v1_16_R1.NBTTagCompound;
|
||||||
import net.minecraft.server.v1_16_R1.NBTTagList;
|
import net.minecraft.server.v1_16_R1.NBTTagList;
|
||||||
|
|
||||||
@ -208,19 +209,28 @@ public class MapChunkCache115 extends AbstractMapChunkCache {
|
|||||||
palette[pi] = DynmapBlockState.AIR;
|
palette[pi] = DynmapBlockState.AIR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int bitsperblock = (statelist.length * 64) / 4096;
|
int recsperblock = (4096 + statelist.length - 1) / statelist.length;
|
||||||
DataBits db = new DataBits(bitsperblock, 4096, statelist);
|
int bitsperblock = 64 / recsperblock;
|
||||||
if (bitsperblock > 8) { // Not palette
|
DataBits db = null;
|
||||||
for (int j = 0; j < 4096; j++) {
|
DataBitsPacked dbp = null;
|
||||||
states[j] = DynmapBlockState.getStateByGlobalIndex(db.a(j));
|
try {
|
||||||
}
|
db = new DataBits(bitsperblock, 4096, statelist);
|
||||||
}
|
} catch (Exception x) { // Handle legacy encoded
|
||||||
else {
|
bitsperblock = (statelist.length * 64) / 4096;
|
||||||
for (int j = 0; j < 4096; j++) {
|
dbp = new DataBitsPacked(bitsperblock, 4096, statelist);
|
||||||
int v = db.a(j);
|
|
||||||
states[j] = (v < palette.length) ? palette[v] : DynmapBlockState.AIR;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
if (bitsperblock > 8) { // Not palette
|
||||||
|
for (int j = 0; j < 4096; j++) {
|
||||||
|
int v = (db != null) ? db.a(j) : dbp.a(j);
|
||||||
|
states[j] = DynmapBlockState.getStateByGlobalIndex(v);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
for (int j = 0; j < 4096; j++) {
|
||||||
|
int v = (db != null) ? db.a(j) : dbp.a(j);
|
||||||
|
states[j] = (v < palette.length) ? palette[v] : DynmapBlockState.AIR;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (sec.hasKey("BlockLight")) {
|
if (sec.hasKey("BlockLight")) {
|
||||||
cursect.emitlight = dataCopy(sec.getByteArray("BlockLight"));
|
cursect.emitlight = dataCopy(sec.getByteArray("BlockLight"));
|
||||||
|
Loading…
Reference in New Issue
Block a user