add get fresh methods to TheadMapUtil

the getFresh versions create/clear the data for the given map.
This commit is contained in:
James Seibel
2021-09-25 11:48:05 -05:00
parent 430a908829
commit 1a3e1dfa8c
6 changed files with 197 additions and 91 deletions
@@ -1,7 +1,5 @@
package com.seibel.lod.util;
import java.util.Arrays;
import com.seibel.lod.enums.DistanceGenerationMode;
import net.minecraft.client.renderer.texture.NativeImage;
@@ -279,31 +277,12 @@ public class DataPointUtil
{
int size = dataToMerge.length / inputVerticalData;
//We initialise the arrays that are going to be used
short[] projection = ThreadMapUtil.getProjectionShort();
short[] heightAndDepth = ThreadMapUtil.getHeightAndDepth();
long[] singleDataToMerge = ThreadMapUtil.getSingleAddDataToMerge();
long[] dataPoint = ThreadMapUtil.verticalDataArray();
// We initialize the arrays that are going to be used
short[] projection = ThreadMapUtil.getFreshProjectionArray((worldHeight) / 16 + 1);
short[] heightAndDepth = ThreadMapUtil.getFreshHeightAndDepth((worldHeight + 1) * 2);
long[] singleDataToMerge = ThreadMapUtil.getFreshSingleAddDataToMerge(size);
long[] dataPoint = ThreadMapUtil.getFreshVerticalDataArray(worldHeight + 1);
if (projection == null || projection.length != (worldHeight) / 16 + 1)
projection = new short[(worldHeight) / 16 + 1];
else
Arrays.fill(projection, (short) 0);
if (heightAndDepth == null || heightAndDepth.length != (worldHeight + 1) * 2)
heightAndDepth = new short[(worldHeight + 1) * 2];
else
Arrays.fill(heightAndDepth, (short) 0);
if (singleDataToMerge == null || singleDataToMerge.length != size)
singleDataToMerge = new long[size];
else
Arrays.fill(singleDataToMerge, EMPTY_DATA);
if (dataPoint == null || dataPoint.length != worldHeight + 1)
dataPoint = new long[worldHeight + 1];
else
Arrays.fill(dataPoint, EMPTY_DATA);
int genMode = DistanceGenerationMode.SERVER.complexity;
boolean allEmpty = true;