mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-11-24 11:15:21 +01:00
fixes
This commit is contained in:
parent
e0439fe712
commit
128d356655
@ -125,7 +125,10 @@ public class ChunkSnapshot {
|
|||||||
this.inhabitedTicks = inhabitedTime;
|
this.inhabitedTicks = inhabitedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChunkSnapshot(CompoundTag nbt, int worldheight) {
|
public static class StateListException extends Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChunkSnapshot(CompoundTag nbt, int worldheight) throws StateListException {
|
||||||
this.x = nbt.getInt("xPos");
|
this.x = nbt.getInt("xPos");
|
||||||
this.z = nbt.getInt("zPos");
|
this.z = nbt.getInt("zPos");
|
||||||
this.captureFulltime = 0;
|
this.captureFulltime = 0;
|
||||||
@ -187,10 +190,11 @@ public class ChunkSnapshot {
|
|||||||
int bitsperblock = (statelist.length * 64) / 4096;
|
int bitsperblock = (statelist.length * 64) / 4096;
|
||||||
int expectedStatelistLength = (4096 + (64 / bitsperblock) - 1) / (64 / bitsperblock);
|
int expectedStatelistLength = (4096 + (64 / bitsperblock) - 1) / (64 / bitsperblock);
|
||||||
if (expectedStatelistLength > statelist.length) { // TODO: find out why this is happening and why it doesn't seem to happen on other platforms
|
if (expectedStatelistLength > statelist.length) { // TODO: find out why this is happening and why it doesn't seem to happen on other platforms
|
||||||
Log.warning("Got statelist of length " + statelist.length + " but expected a length of " + expectedStatelistLength);
|
Log.warning("Got statelist of length " + statelist.length + " but expected a length of " + expectedStatelistLength + " at ChunkPos(x=" + x + ",z=" + z + ")");
|
||||||
long[] expandedStatelist = new long[expectedStatelistLength];
|
throw new StateListException();
|
||||||
|
/*long[] expandedStatelist = new long[expectedStatelistLength];
|
||||||
System.arraycopy(statelist, 0, expandedStatelist, 0, statelist.length);
|
System.arraycopy(statelist, 0, expandedStatelist, 0, statelist.length);
|
||||||
statelist = expandedStatelist;
|
statelist = expandedStatelist;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
PackedIntegerArray db = new PackedIntegerArray(bitsperblock, 4096, statelist);
|
PackedIntegerArray db = new PackedIntegerArray(bitsperblock, 4096, statelist);
|
||||||
|
@ -996,7 +996,7 @@ public class FabricMapChunkCache extends MapChunkCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prep snapshot and add to cache
|
// Prep snapshot and add to cache
|
||||||
private SnapshotCache.SnapshotRec prepChunkSnapshot(DynmapChunk chunk, CompoundTag nbt) {
|
private SnapshotCache.SnapshotRec prepChunkSnapshot(DynmapChunk chunk, CompoundTag nbt) throws ChunkSnapshot.StateListException {
|
||||||
ChunkSnapshot ss = new ChunkSnapshot(nbt, dw.worldheight);
|
ChunkSnapshot ss = new ChunkSnapshot(nbt, dw.worldheight);
|
||||||
DynIntHashMap tileData = new DynIntHashMap();
|
DynIntHashMap tileData = new DynIntHashMap();
|
||||||
|
|
||||||
@ -1072,9 +1072,13 @@ public class FabricMapChunkCache extends MapChunkCache {
|
|||||||
if (vis) { // If visible
|
if (vis) { // If visible
|
||||||
CompoundTag nbt = ChunkSerializer.serialize((ServerWorld) w, cps.getWorldChunk(chunk.x, chunk.z, false));
|
CompoundTag nbt = ChunkSerializer.serialize((ServerWorld) w, cps.getWorldChunk(chunk.x, chunk.z, false));
|
||||||
if (nbt != null) nbt = nbt.getCompound("Level");
|
if (nbt != null) nbt = nbt.getCompound("Level");
|
||||||
SnapshotCache.SnapshotRec ssr = prepChunkSnapshot(chunk, nbt);
|
try {
|
||||||
ss = ssr.ss;
|
SnapshotCache.SnapshotRec ssr = prepChunkSnapshot(chunk, nbt);
|
||||||
tileData = ssr.tileData;
|
ss = ssr.ss;
|
||||||
|
tileData = ssr.tileData;
|
||||||
|
} catch (ChunkSnapshot.StateListException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (hidestyle == HiddenChunkStyle.FILL_STONE_PLAIN) {
|
if (hidestyle == HiddenChunkStyle.FILL_STONE_PLAIN) {
|
||||||
ss = STONE;
|
ss = STONE;
|
||||||
@ -1148,9 +1152,13 @@ public class FabricMapChunkCache extends MapChunkCache {
|
|||||||
tileData = new DynIntHashMap();
|
tileData = new DynIntHashMap();
|
||||||
} else {
|
} else {
|
||||||
// Prep snapshot
|
// Prep snapshot
|
||||||
SnapshotCache.SnapshotRec ssr = prepChunkSnapshot(chunk, nbt);
|
try {
|
||||||
ss = ssr.ss;
|
SnapshotCache.SnapshotRec ssr = prepChunkSnapshot(chunk, nbt);
|
||||||
tileData = ssr.tileData;
|
ss = ssr.ss;
|
||||||
|
tileData = ssr.tileData;
|
||||||
|
} catch (ChunkSnapshot.StateListException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
snaparray[chunkindex] = ss;
|
snaparray[chunkindex] = ss;
|
||||||
snaptile[chunkindex] = tileData;
|
snaptile[chunkindex] = tileData;
|
||||||
|
@ -50,8 +50,8 @@ public class FabricWorld extends DynmapWorld {
|
|||||||
public FabricWorld(WorldAccess w) {
|
public FabricWorld(WorldAccess w) {
|
||||||
this(getWorldName(w), w.getWorld().getHeight(),
|
this(getWorldName(w), w.getWorld().getHeight(),
|
||||||
w.getWorld().getSeaLevel(),
|
w.getWorld().getSeaLevel(),
|
||||||
w.getWorld().getRegistryKey() == World.END,
|
|
||||||
w.getWorld().getRegistryKey() == World.NETHER,
|
w.getWorld().getRegistryKey() == World.NETHER,
|
||||||
|
w.getWorld().getRegistryKey() == World.END,
|
||||||
w.getWorld().getRegistryKey().getValue().getPath());
|
w.getWorld().getRegistryKey().getValue().getPath());
|
||||||
setWorldLoaded(w);
|
setWorldLoaded(w);
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,10 @@ public class ChunkSnapshot {
|
|||||||
this.inhabitedTicks = inhabitedTime;
|
this.inhabitedTicks = inhabitedTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChunkSnapshot(CompoundTag nbt, int worldheight) {
|
public static class StateListException extends Exception {
|
||||||
|
}
|
||||||
|
|
||||||
|
public ChunkSnapshot(CompoundTag nbt, int worldheight) throws StateListException {
|
||||||
this.x = nbt.getInt("xPos");
|
this.x = nbt.getInt("xPos");
|
||||||
this.z = nbt.getInt("zPos");
|
this.z = nbt.getInt("zPos");
|
||||||
this.captureFulltime = 0;
|
this.captureFulltime = 0;
|
||||||
@ -187,10 +190,11 @@ public class ChunkSnapshot {
|
|||||||
int bitsperblock = (statelist.length * 64) / 4096;
|
int bitsperblock = (statelist.length * 64) / 4096;
|
||||||
int expectedStatelistLength = (4096 + (64 / bitsperblock) - 1) / (64 / bitsperblock);
|
int expectedStatelistLength = (4096 + (64 / bitsperblock) - 1) / (64 / bitsperblock);
|
||||||
if (expectedStatelistLength > statelist.length) { // TODO: find out why this is happening and why it doesn't seem to happen on other platforms
|
if (expectedStatelistLength > statelist.length) { // TODO: find out why this is happening and why it doesn't seem to happen on other platforms
|
||||||
Log.warning("Got statelist of length " + statelist.length + " but expected a length of " + expectedStatelistLength);
|
Log.warning("Got statelist of length " + statelist.length + " but expected a length of " + expectedStatelistLength + " at ChunkPos(x=" + x + ",z=" + z + ")");
|
||||||
long[] expandedStatelist = new long[expectedStatelistLength];
|
throw new StateListException();
|
||||||
|
/*long[] expandedStatelist = new long[expectedStatelistLength];
|
||||||
System.arraycopy(statelist, 0, expandedStatelist, 0, statelist.length);
|
System.arraycopy(statelist, 0, expandedStatelist, 0, statelist.length);
|
||||||
statelist = expandedStatelist;
|
statelist = expandedStatelist;*/
|
||||||
}
|
}
|
||||||
|
|
||||||
PackedIntegerArray db = new PackedIntegerArray(bitsperblock, 4096, statelist);
|
PackedIntegerArray db = new PackedIntegerArray(bitsperblock, 4096, statelist);
|
||||||
|
@ -1024,7 +1024,7 @@ public class FabricMapChunkCache extends MapChunkCache {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prep snapshot and add to cache
|
// Prep snapshot and add to cache
|
||||||
private SnapshotCache.SnapshotRec prepChunkSnapshot(DynmapChunk chunk, CompoundTag nbt) {
|
private SnapshotCache.SnapshotRec prepChunkSnapshot(DynmapChunk chunk, CompoundTag nbt) throws ChunkSnapshot.StateListException {
|
||||||
ChunkSnapshot ss = new ChunkSnapshot(nbt, dw.worldheight);
|
ChunkSnapshot ss = new ChunkSnapshot(nbt, dw.worldheight);
|
||||||
DynIntHashMap tileData = new DynIntHashMap();
|
DynIntHashMap tileData = new DynIntHashMap();
|
||||||
|
|
||||||
@ -1104,11 +1104,16 @@ public class FabricMapChunkCache extends MapChunkCache {
|
|||||||
} catch (NullPointerException e) {
|
} catch (NullPointerException e) {
|
||||||
// TODO: find out why this is happening and why it only seems to happen since 1.16.2
|
// TODO: find out why this is happening and why it only seems to happen since 1.16.2
|
||||||
Log.severe("ChunkSerializer.serialize threw a NullPointerException", e);
|
Log.severe("ChunkSerializer.serialize threw a NullPointerException", e);
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
if (nbt != null) nbt = nbt.getCompound("Level");
|
if (nbt != null) nbt = nbt.getCompound("Level");
|
||||||
SnapshotCache.SnapshotRec ssr = prepChunkSnapshot(chunk, nbt);
|
try {
|
||||||
ss = ssr.ss;
|
SnapshotCache.SnapshotRec ssr = prepChunkSnapshot(chunk, nbt);
|
||||||
tileData = ssr.tileData;
|
ss = ssr.ss;
|
||||||
|
tileData = ssr.tileData;
|
||||||
|
} catch (ChunkSnapshot.StateListException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (hidestyle == HiddenChunkStyle.FILL_STONE_PLAIN) {
|
if (hidestyle == HiddenChunkStyle.FILL_STONE_PLAIN) {
|
||||||
ss = STONE;
|
ss = STONE;
|
||||||
@ -1182,9 +1187,13 @@ public class FabricMapChunkCache extends MapChunkCache {
|
|||||||
tileData = new DynIntHashMap();
|
tileData = new DynIntHashMap();
|
||||||
} else {
|
} else {
|
||||||
// Prep snapshot
|
// Prep snapshot
|
||||||
SnapshotCache.SnapshotRec ssr = prepChunkSnapshot(chunk, nbt);
|
try {
|
||||||
ss = ssr.ss;
|
SnapshotCache.SnapshotRec ssr = prepChunkSnapshot(chunk, nbt);
|
||||||
tileData = ssr.tileData;
|
ss = ssr.ss;
|
||||||
|
tileData = ssr.tileData;
|
||||||
|
} catch (ChunkSnapshot.StateListException e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
snaparray[chunkindex] = ss;
|
snaparray[chunkindex] = ss;
|
||||||
snaptile[chunkindex] = tileData;
|
snaptile[chunkindex] = tileData;
|
||||||
|
@ -51,8 +51,8 @@ public class FabricWorld extends DynmapWorld {
|
|||||||
public FabricWorld(DynmapPlugin plugin, World w) {
|
public FabricWorld(DynmapPlugin plugin, World w) {
|
||||||
this(plugin, getWorldName(plugin, w), w.getHeight(),
|
this(plugin, getWorldName(plugin, w), w.getHeight(),
|
||||||
w.getSeaLevel(),
|
w.getSeaLevel(),
|
||||||
w.getRegistryKey() == World.END,
|
|
||||||
w.getRegistryKey() == World.NETHER,
|
w.getRegistryKey() == World.NETHER,
|
||||||
|
w.getRegistryKey() == World.END,
|
||||||
w.getRegistryKey().getValue().getPath());
|
w.getRegistryKey().getValue().getPath());
|
||||||
setWorldLoaded(w);
|
setWorldLoaded(w);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user