Added LevelPosUtil, now the node are added using it and not with the LevelPos object

This commit is contained in:
Leonardo
2021-09-01 15:15:23 +02:00
parent 4c7ca395c6
commit 1360edb459
6 changed files with 274 additions and 69 deletions
@@ -25,6 +25,7 @@ import com.seibel.lod.enums.DistanceGenerationMode;
import com.seibel.lod.enums.LodDetail;
import com.seibel.lod.handlers.LodConfig;
import com.seibel.lod.objects.DataPoint;
import com.seibel.lod.objects.LevelPosUtil;
import com.seibel.lod.objects.LodDimension;
import com.seibel.lod.objects.LodWorld;
import com.seibel.lod.objects.LevelPos.LevelPos;
@@ -163,7 +164,7 @@ public class LodBuilder
short[] color;
short height;
short depth;
LevelPos levelPos = new LevelPos((byte) 0, 0, 0);
int[] levelPos;
short[] data;
try
{
@@ -186,20 +187,23 @@ public class LodBuilder
startZ, endX, endZ);
depth = 0;
}
levelPos.changeParameters((byte) 0,
chunk.getPos().x * 16 + startX,
chunk.getPos().z * 16 + startZ);
levelPos.convert(detail.detailLevel);
levelPos = LevelPosUtil.convert(
LevelPosUtil.createLevelPos((byte) 0,
chunk.getPos().x * 16 + startX,
chunk.getPos().z * 16 + startZ),
detail.detailLevel
);
boolean isServer = config.distanceGenerationMode == DistanceGenerationMode.SERVER;
data = DataPoint.createDataPoint(height, depth, color[0], color[1], color[2]);
lodDim.addData(levelPos,
boolean added = lodDim.addData(levelPos,
data,
false,
isServer);
System.out.println(added);
}
//levelPos.changeParameters(LodUtil.CHUNK_DETAIL_LEVEL, chunk.getPos().x, chunk.getPos().z);
lodDim.updateData(new LevelPos(LodUtil.CHUNK_DETAIL_LEVEL, chunk.getPos().x, chunk.getPos().z));
lodDim.updateData(LevelPosUtil.createLevelPos(LodUtil.CHUNK_DETAIL_LEVEL, chunk.getPos().x, chunk.getPos().z));
} catch (Exception e)
{
//e.printStackTrace();
@@ -432,12 +436,10 @@ public class LodBuilder
Color tmp = LodUtil.intToColor(biome.getGrassColor(x, z));
tmp = tmp.darker();
colorInt = LodUtil.colorToInt(tmp);
}
else if (blockState == Blocks.STONE.defaultBlockState())
} else if (blockState == Blocks.STONE.defaultBlockState())
{
colorInt = LodUtil.STONE_COLOR_INT;
}
else if (blockState == Blocks.MYCELIUM.defaultBlockState())
} else if (blockState == Blocks.MYCELIUM.defaultBlockState())
{
colorInt = LodUtil.MYCELIUM_COLOR_INT;
}