Actually fix NPE when loading chunks sometimes

This commit is contained in:
Lukas Rieger (Blue) 2024-02-24 23:51:23 +01:00
parent 0d36a0f70b
commit 5bb7a77fb9
No known key found for this signature in database
GPG Key ID: AA33883B1BBA03E6
3 changed files with 7 additions and 17 deletions

View File

@ -38,9 +38,6 @@
public class Chunk_1_13 extends MCAChunk {
private static final Level EMPTY_LEVEL = new Level();
private static final HeightmapsData EMPTY_HEIGHTMAPS_DATA = new HeightmapsData();
private static final Key STATUS_EMPTY = new Key("minecraft", "empty");
private static final Key STATUS_FULL = new Key("minecraft", "full");
private static final Key STATUS_FULLCHUNK = new Key("minecraft", "fullchunk");
@ -265,7 +262,7 @@ public int getSectionY() {
@Getter
@SuppressWarnings("FieldMayBeFinal")
public static class Data extends MCAChunk.Data {
private Level level = EMPTY_LEVEL;
private Level level = new Level();
}
@Getter
@ -273,7 +270,7 @@ public static class Data extends MCAChunk.Data {
public static class Level {
private Key status = STATUS_EMPTY;
private long inhabitedTime = 0;
private HeightmapsData heightmaps = EMPTY_HEIGHTMAPS_DATA;
private HeightmapsData heightmaps = new HeightmapsData();
private SectionData @Nullable [] sections = null;
private int[] biomes = EMPTY_INT_ARRAY;
}

View File

@ -39,9 +39,6 @@
public class Chunk_1_16 extends MCAChunk {
private static final Level EMPTY_LEVEL = new Level();
private static final HeightmapsData EMPTY_HEIGHTMAPS_DATA = new HeightmapsData();
private static final Key STATUS_EMPTY = new Key("minecraft", "empty");
private static final Key STATUS_FULL = new Key("minecraft", "full");
@ -253,7 +250,7 @@ public int getSectionY() {
@Getter
@SuppressWarnings("FieldMayBeFinal")
public static class Data extends MCAChunk.Data {
private Level level = EMPTY_LEVEL;
private Level level = new Level();
}
@Getter
@ -261,7 +258,7 @@ public static class Data extends MCAChunk.Data {
public static class Level {
private Key status = STATUS_EMPTY;
private long inhabitedTime = 0;
private HeightmapsData heightmaps = EMPTY_HEIGHTMAPS_DATA;
private HeightmapsData heightmaps = new HeightmapsData();
private SectionData @Nullable [] sections = null;
private int[] biomes = EMPTY_INT_ARRAY;
}

View File

@ -39,10 +39,6 @@
public class Chunk_1_18 extends MCAChunk {
private static final BlockStatesData EMPTY_BLOCKSTATESDATA = new BlockStatesData();
private static final BiomesData EMPTY_BIOMESDATA = new BiomesData();
private static final HeightmapsData EMPTY_HEIGHTMAPS_DATA = new HeightmapsData();
private static final Key STATUS_EMPTY = new Key("minecraft", "empty");
private static final Key STATUS_FULL = new Key("minecraft", "full");
@ -265,7 +261,7 @@ public int getSectionY() {
public static class Data extends MCAChunk.Data {
private Key status = STATUS_EMPTY;
private long inhabitedTime = 0;
private HeightmapsData heightmaps = EMPTY_HEIGHTMAPS_DATA;
private HeightmapsData heightmaps = new HeightmapsData();
private SectionData @Nullable [] sections = null;
}
@ -282,8 +278,8 @@ public static class SectionData {
private int y = 0;
private byte[] blockLight = EMPTY_BYTE_ARRAY;
private byte[] skyLight = EMPTY_BYTE_ARRAY;
@NBTName("block_states") private BlockStatesData blockStates = EMPTY_BLOCKSTATESDATA;
private BiomesData biomes = EMPTY_BIOMESDATA;
@NBTName("block_states") private BlockStatesData blockStates = new BlockStatesData();
private BiomesData biomes = new BiomesData();
}
@Getter