mirror of
https://github.com/webbukkit/dynmap.git
synced 2025-03-09 13:09:17 +01:00
improve info on statelist length mismatch
This commit is contained in:
parent
128d356655
commit
5e7d00e438
@ -126,6 +126,17 @@ public class ChunkSnapshot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class StateListException extends Exception {
|
public static class StateListException extends Exception {
|
||||||
|
private static boolean loggedOnce = false;
|
||||||
|
|
||||||
|
public StateListException(int x, int z, int expectedLength, int actualLength) {
|
||||||
|
if (Log.verbose || !loggedOnce) {
|
||||||
|
loggedOnce = true;
|
||||||
|
Log.info("Skipping chunk at x=" + x + ",z=" + z + ". Expected statelist of length " + expectedLength + " but got " + actualLength + ". This can happen if the chunk was not yet converted to the 1.16 format which can be fixed by visiting the chunk.");
|
||||||
|
if (!Log.verbose) {
|
||||||
|
Log.info("You will only see this message once. Turn on verbose logging in the configuration to see all messages.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChunkSnapshot(CompoundTag nbt, int worldheight) throws StateListException {
|
public ChunkSnapshot(CompoundTag nbt, int worldheight) throws StateListException {
|
||||||
@ -189,12 +200,8 @@ 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) {
|
||||||
Log.warning("Got statelist of length " + statelist.length + " but expected a length of " + expectedStatelistLength + " at ChunkPos(x=" + x + ",z=" + z + ")");
|
throw new StateListException(x, z, expectedStatelistLength, statelist.length);
|
||||||
throw new StateListException();
|
|
||||||
/*long[] expandedStatelist = new long[expectedStatelistLength];
|
|
||||||
System.arraycopy(statelist, 0, expandedStatelist, 0, statelist.length);
|
|
||||||
statelist = expandedStatelist;*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PackedIntegerArray db = new PackedIntegerArray(bitsperblock, 4096, statelist);
|
PackedIntegerArray db = new PackedIntegerArray(bitsperblock, 4096, statelist);
|
||||||
|
@ -126,6 +126,17 @@ public class ChunkSnapshot {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static class StateListException extends Exception {
|
public static class StateListException extends Exception {
|
||||||
|
private static boolean loggedOnce = false;
|
||||||
|
|
||||||
|
public StateListException(int x, int z, int expectedLength, int actualLength) {
|
||||||
|
if (Log.verbose || !loggedOnce) {
|
||||||
|
loggedOnce = true;
|
||||||
|
Log.info("Skipping chunk at x=" + x + ",z=" + z + ". Expected statelist of length " + expectedLength + " but got " + actualLength + ". This can happen if the chunk was not yet converted to the 1.16 format which can be fixed by visiting the chunk.");
|
||||||
|
if (!Log.verbose) {
|
||||||
|
Log.info("You will only see this message once. Turn on verbose logging in the configuration to see all messages.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public ChunkSnapshot(CompoundTag nbt, int worldheight) throws StateListException {
|
public ChunkSnapshot(CompoundTag nbt, int worldheight) throws StateListException {
|
||||||
@ -189,12 +200,8 @@ 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) {
|
||||||
Log.warning("Got statelist of length " + statelist.length + " but expected a length of " + expectedStatelistLength + " at ChunkPos(x=" + x + ",z=" + z + ")");
|
throw new StateListException(x, z, expectedStatelistLength, statelist.length);
|
||||||
throw new StateListException();
|
|
||||||
/*long[] expandedStatelist = new long[expectedStatelistLength];
|
|
||||||
System.arraycopy(statelist, 0, expandedStatelist, 0, statelist.length);
|
|
||||||
statelist = expandedStatelist;*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
PackedIntegerArray db = new PackedIntegerArray(bitsperblock, 4096, statelist);
|
PackedIntegerArray db = new PackedIntegerArray(bitsperblock, 4096, statelist);
|
||||||
|
Loading…
Reference in New Issue
Block a user