Fix null pointers in DhApiChunk

This commit is contained in:
James Seibel
2023-12-22 07:19:20 -06:00
parent 798a5c6c96
commit fa12443cb1
@@ -44,7 +44,7 @@ public class DhApiChunk
public final int topYBlockPos;
public final int bottomYBlockPos;
private final List<List<DhApiTerrainDataPoint>> dataPoints = new ArrayList<>(16 * 16); // 256
private final List<List<DhApiTerrainDataPoint>> dataPoints;
@@ -58,6 +58,13 @@ public class DhApiChunk
this.chunkPosZ = chunkPosZ;
this.topYBlockPos = topYBlockPos;
this.bottomYBlockPos = bottomYBlockPos;
// populate the array to prevent null pointers
this.dataPoints = new ArrayList<>(16 * 16); // 256
for (int i = 0; i < (16*16); i++)
{
this.dataPoints.add(i, null);
}
}