Tentative fix for heightmap data being null

This commit is contained in:
Lukas Rieger (Blue) 2024-02-23 23:55:01 +01:00
parent ec101feb94
commit 9e8dc8e5a8
No known key found for this signature in database
GPG Key ID: AA33883B1BBA03E6
4 changed files with 13 additions and 14 deletions

View File

@ -24,13 +24,12 @@
*/
package de.bluecolored.bluemap.core.logger;
import java.util.concurrent.TimeUnit;
import com.github.benmanes.caffeine.cache.Cache;
import com.github.benmanes.caffeine.cache.Caffeine;
import de.bluecolored.bluemap.core.BlueMap;
import java.util.concurrent.TimeUnit;
public abstract class AbstractLogger extends Logger {
private static final Object DUMMY = new Object();
@ -40,7 +39,7 @@ public abstract class AbstractLogger extends Logger {
public AbstractLogger() {
noFloodCache = Caffeine.newBuilder()
.executor(BlueMap.THREAD_POOL)
.expireAfterWrite(1, TimeUnit.HOURS)
.expireAfterWrite(10, TimeUnit.MINUTES)
.maximumSize(10000)
.build();
}

View File

@ -280,14 +280,14 @@ public static class Level {
@Getter
@SuppressWarnings("FieldMayBeFinal")
protected static class HeightmapsData {
public static class HeightmapsData {
@NBTName("WORLD_SURFACE") private long[] worldSurface = EMPTY_LONG_ARRAY;
@NBTName("OCEAN_FLOOR") private long[] oceanFloor = EMPTY_LONG_ARRAY;
}
@Getter
@SuppressWarnings("FieldMayBeFinal")
protected static class SectionData {
public static class SectionData {
private int y = 0;
private byte[] blockLight = EMPTY_BYTE_ARRAY;
private byte[] skyLight = EMPTY_BYTE_ARRAY;

View File

@ -268,14 +268,14 @@ public static class Level {
@Getter
@SuppressWarnings("FieldMayBeFinal")
protected static class HeightmapsData {
public static class HeightmapsData {
@NBTName("WORLD_SURFACE") private long[] worldSurface = EMPTY_LONG_ARRAY;
@NBTName("OCEAN_FLOOR") private long[] oceanFloor = EMPTY_LONG_ARRAY;
}
@Getter
@SuppressWarnings("FieldMayBeFinal")
protected static class SectionData {
public static class SectionData {
private int y = 0;
private byte[] blockLight = EMPTY_BYTE_ARRAY;
private byte[] skyLight = EMPTY_BYTE_ARRAY;

View File

@ -221,7 +221,7 @@ public BlockState getBlockState(int x, int y, int z) {
int id = blocks.get((y & 0xF) << 8 | (z & 0xF) << 4 | x & 0xF);
if (id >= blockPalette.length) {
Logger.global.noFloodWarning("palette-warning", "Got block-palette id " + id + " but palette has size of " + blockPalette.length + "! (Future occasions of this error will not be logged)");
Logger.global.noFloodWarning("palette-warning", "Got block-palette id " + id + " but palette has size of " + blockPalette.length + ". (Chunk");
return BlockState.MISSING;
}
@ -234,7 +234,7 @@ public String getBiome(int x, int y, int z) {
int id = biomes.get((y & 0b1100) << 2 | z & 0b1100 | (x & 0b1100) >> 2);
if (id >= biomePalette.length) {
Logger.global.noFloodWarning("biome-palette-warning", "Got biome-palette id " + id + " but palette has size of " + biomePalette.length + "! (Future occasions of this error will not be logged)");
Logger.global.noFloodWarning("biome-palette-warning", "Got biome-palette id " + id + " but palette has size of " + biomePalette.length + ".");
return Biome.DEFAULT.getValue();
}
@ -271,14 +271,14 @@ public static class Data extends MCAChunk.Data {
@Getter
@SuppressWarnings("FieldMayBeFinal")
protected static class HeightmapsData {
public static class HeightmapsData {
@NBTName("WORLD_SURFACE") private long[] worldSurface = EMPTY_LONG_ARRAY;
@NBTName("OCEAN_FLOOR") private long[] oceanFloor = EMPTY_LONG_ARRAY;
}
@Getter
@SuppressWarnings("FieldMayBeFinal")
protected static class SectionData {
public static class SectionData {
private int y = 0;
private byte[] blockLight = EMPTY_BYTE_ARRAY;
private byte[] skyLight = EMPTY_BYTE_ARRAY;
@ -288,14 +288,14 @@ protected static class SectionData {
@Getter
@SuppressWarnings("FieldMayBeFinal")
protected static class BlockStatesData {
public static class BlockStatesData {
private BlockState[] palette = EMPTY_BLOCKSTATE_ARRAY;
private long[] data = EMPTY_LONG_ARRAY;
}
@Getter
@SuppressWarnings("FieldMayBeFinal")
protected static class BiomesData {
public static class BiomesData {
private String[] palette = EMPTY_STRING_ARRAY;
private long[] data = EMPTY_LONG_ARRAY;
}