Added the tree cutter

This commit is contained in:
Leonardo
2021-08-23 11:12:23 +02:00
parent fdd8204a46
commit 9840c594e6
7 changed files with 201 additions and 174 deletions
@@ -1,6 +1,7 @@
package com.seibel.lod.builders;
import com.seibel.lod.enums.DistanceGenerationMode;
import com.seibel.lod.enums.LodDetail;
import com.seibel.lod.objects.LevelPos;
import com.seibel.lod.util.LodUtil;
import net.minecraft.util.math.ChunkPos;
@@ -13,11 +14,13 @@ public class GenerationRequest
{
public final LevelPos levelPos;
public final DistanceGenerationMode generationMode;
public final LodDetail detail;
public GenerationRequest(LevelPos levelPos, DistanceGenerationMode generationMode)
public GenerationRequest(LevelPos levelPos, DistanceGenerationMode generationMode, LodDetail detail)
{
this.levelPos = levelPos;
this.generationMode = generationMode;
this.detail = detail;
}
public ChunkPos getChunkPos()
@@ -28,6 +28,7 @@ import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.concurrent.locks.ReentrantLock;
import java.util.logging.Level;
import org.lwjgl.opengl.GL11;
@@ -172,15 +173,16 @@ public class LodBufferBuilder
Thread thread = new Thread(() ->
{
bufferLock.lock();
lodDim.treeCutter(playerBlockPosRounded.getX(), playerBlockPosRounded.getZ());
try
{
long startTime = System.currentTimeMillis();
ArrayList<ChunkPos> chunksToGen = new ArrayList<>(maxChunkGenRequests);
ArrayList<GenerationRequest> chunksToGen = new ArrayList<>(maxChunkGenRequests);
// if we don't have a full number of chunks to generate in chunksToGen
// we can top it off from the reserve
ArrayList<ChunkPos> chunksToGenReserve = new ArrayList<>(maxChunkGenRequests);
ArrayList<GenerationRequest> chunksToGenReserve = new ArrayList<>(maxChunkGenRequests);
ArrayList<Callable<Boolean>> builderThreads = new ArrayList<>(lodDim.regions.length * lodDim.regions.length);
startBuffers();
@@ -289,6 +291,7 @@ public class LodBufferBuilder
List<LevelPos> posListToGenerate = new ArrayList<>();
List<GenerationRequest> generationRequestList = new ArrayList<>();
/**TODO can give a totally different generation*/
/*
@@ -319,45 +322,49 @@ public class LodBufferBuilder
for (byte detailGen = LodConfig.CLIENT.maxGenerationDetail.get().detailLevel; detailGen <= LodUtil.REGION_DETAIL_LEVEL; detailGen++)
{
if (requesting == 0) break;
posListToGenerate.addAll(lodDim.getDataToGenerate(
posListToGenerate = lodDim.getDataToGenerate(
playerBlockPosRounded.getX(),
playerBlockPosRounded.getZ(),
DetailUtil.getDistanceGeneration(detailGen),
DetailUtil.getDistanceGeneration(detailGen + 1),
LodConfig.CLIENT.distanceGenerationMode.get().complexity,
(byte) 7,
requesting));
requesting = maxChunkGenRequests - posListToGenerate.size();
(byte) 9,
requesting);
for(LevelPos levelPos : posListToGenerate){
generationRequestList.add(new GenerationRequest(levelPos,LodConfig.CLIENT.distanceGenerationMode.get(), DetailUtil.getLodDetail(detailGen)));
}
requesting = maxChunkGenRequests - generationRequestList.size();
}
//we then fill the world with the rest of the block
for (byte detailGen = LodConfig.CLIENT.maxGenerationDetail.get().detailLevel; detailGen <= LodUtil.REGION_DETAIL_LEVEL; detailGen++)
{
if (requesting == 0) break;
posListToGenerate.addAll(lodDim.getDataToGenerate(
posListToGenerate = lodDim.getDataToGenerate(
playerBlockPosRounded.getX(),
playerBlockPosRounded.getZ(),
DetailUtil.getDistanceGeneration(detailGen),
DetailUtil.getDistanceGeneration(detailGen + 1),
LodConfig.CLIENT.distanceGenerationMode.get().complexity,
LodConfig.CLIENT.maxGenerationDetail.get().detailLevel,
maxChunkGenRequests));
requesting = maxChunkGenRequests - posListToGenerate.size();
maxChunkGenRequests);
for(LevelPos levelPos : posListToGenerate){
generationRequestList.add(new GenerationRequest(levelPos,LodConfig.CLIENT.distanceGenerationMode.get(), DetailUtil.getLodDetail(detailGen)));
}
requesting = maxChunkGenRequests - generationRequestList.size();
}
// determine which points in the posListToGenerate
// should actually be queued up
for (LevelPos levelPos : posListToGenerate)
for (GenerationRequest generationRequest : generationRequestList)
{
LevelPos chunkLevelPos = levelPos.convert(LodUtil.CHUNK_DETAIL_LEVEL);
int chunkX = chunkLevelPos.posX;
int chunkZ = chunkLevelPos.posZ;
ChunkPos chunkPos = generationRequest.getChunkPos();
if (numberOfChunksWaitingToGenerate.get() < maxChunkGenRequests)
{
ChunkPos pos = new ChunkPos(chunkX, chunkZ);
if (positionWaitingToBeGenerated.contains(pos))
if (positionWaitingToBeGenerated.contains(chunkPos))
{
//ClientProxy.LOGGER.debug(pos + " asked to be generated again.");
continue;
@@ -365,7 +372,7 @@ public class LodBufferBuilder
// determine if this position is closer to the player
// than the previous
int newDistance = playerChunkPos.getChessboardDistance(pos);
int newDistance = playerChunkPos.getChessboardDistance(chunkPos);
if (newDistance < minChunkDist)
{
@@ -374,7 +381,7 @@ public class LodBufferBuilder
minChunkDist = newDistance;
// move all the old chunks into the reserve
ArrayList<ChunkPos> oldReserve = new ArrayList<>(chunksToGenReserve);
ArrayList<GenerationRequest> oldReserve = new ArrayList<>(chunksToGenReserve);
chunksToGenReserve.clear();
chunksToGenReserve.addAll(chunksToGen);
// top off reserve with whatever was in oldReerve
@@ -387,7 +394,7 @@ public class LodBufferBuilder
}
chunksToGen.clear();
chunksToGen.add(pos);
chunksToGen.add(generationRequest);
}
else if (newDistance == minChunkDist)
{
@@ -396,14 +403,14 @@ public class LodBufferBuilder
{
// we are still under the number of chunks to generate
// add this position to the list
chunksToGen.add(pos);
chunksToGen.add(generationRequest);
}
}
else
{
// this chunk is farther away than the minimum distance,
// add it to the reserve to make sure we always have a full reserve
chunksToGenReserve.add(pos);
chunksToGenReserve.add(generationRequest);
}
} // lod null and can generate more chunks
@@ -420,7 +427,7 @@ public class LodBufferBuilder
// make sure we have as many chunks to generate as we are allowed
if (chunksToGen.size() < maxChunkGenRequests)
{
Iterator<ChunkPos> reserveIterator = chunksToGenReserve.iterator();
Iterator<GenerationRequest> reserveIterator = chunksToGenReserve.iterator();
while (chunksToGen.size() < maxChunkGenRequests && reserveIterator.hasNext())
{
chunksToGen.add(reserveIterator.next());
@@ -428,10 +435,11 @@ public class LodBufferBuilder
}
// start chunk generation
for (ChunkPos chunkPos : chunksToGen)
for (GenerationRequest generationRequest : generationRequestList)
{
// don't add null chunkPos (which shouldn't happen anyway)
// or add more to the generation queue
ChunkPos chunkPos = generationRequest.getChunkPos();
if (chunkPos == null || numberOfChunksWaitingToGenerate.get() >= maxChunkGenRequests)
continue;
@@ -27,12 +27,10 @@ import java.nio.file.StandardCopyOption;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import com.seibel.lod.objects.LevelContainer;
import com.seibel.lod.objects.LodDimension;
import com.seibel.lod.objects.LodRegion;
import com.seibel.lod.objects.RegionPos;
import com.seibel.lod.objects.*;
import com.seibel.lod.proxy.ClientProxy;
import com.seibel.lod.util.LodThreadFactory;
import com.seibel.lod.util.LodUtil;
/**
* This object handles creating LodRegions
@@ -116,11 +114,12 @@ public class LodDimensionFileHandler
* Return the LodRegion region at the given coordinates.
* (null if the file doesn't exist)
*/
public LodRegion loadRegionFromFile(RegionPos regionPos)
public LodRegion loadRegionFromFile(LevelPos levelPos)
{
RegionPos regionPos = levelPos.getRegionPos();
int regionX = regionPos.x;
int regionZ = regionPos.z;
String fileName = getFileNameAndPathForRegion(regionX, regionZ);
String fileName = getFileNameAndPathForRegion(regionX, regionZ, levelPos.detailLevel);
// if the fileName was null that means the folder is inaccessible
// for some reason
@@ -246,88 +245,87 @@ public class LodDimensionFileHandler
// convert to region coordinates
int x = region.regionPosX;
int z = region.regionPosZ;
String fileName = getFileNameAndPathForRegion(x, z);
File oldFile = new File(fileName);
// if the fileName was null that means the folder is inaccessible
// for some reason
if (fileName == null)
{
ClientProxy.LOGGER.warn("Unable to save region [" + x + ", " + z + "] to file." );
return;
}
try
{
// make sure the file and folder exists
if (!oldFile.exists())
{
// the file doesn't exist,
// create it and the folder if need be
if (!oldFile.getParentFile().exists())
oldFile.getParentFile().mkdirs();
oldFile.createNewFile();
}
else
{
// the file exists, make sure it
// is the correct version.
// (to make sure we don't overwrite a newer
// version file if it exists)
BufferedReader br = new BufferedReader(new FileReader(oldFile));
String s = br.readLine();
int fileVersion = LOD_SAVE_FILE_VERSION;
if (s != null && !s.isEmpty())
{
// try to get the file version
try
{
fileVersion = Integer.parseInt(s.substring(s.indexOf(' ')).trim());
}
catch (NumberFormatException | StringIndexOutOfBoundsException e)
{
// this file doesn't have a correctly formated version
// just overwrite the file
}
}
br.close();
// check if this file can be written to by the file handler
if (fileVersion <= LOD_SAVE_FILE_VERSION)
{
// we are good to continue and overwrite the old file
}
else // if(fileVersion > LOD_SAVE_FILE_VERSION)
{
// the file we are reading is a newer version,
// don't write anything, we don't want to accidently
// delete anything the user may want.
return;
}
}
// the old file is good, now create a new save file
File newFile = new File(fileName + TMP_FILE_EXTENSION);
FileWriter fw = new FileWriter(newFile);
// add the version of this file
fw.write(LOD_FILE_VERSION_PREFIX + " " + LOD_SAVE_FILE_VERSION + "\n");
// add each LodChunk to the file
fw.write(region.getLevel(LodConfig.CLIENT.maxGenerationDetail.get().detailLevel).toString());
fw.close();
// overwrite the old file with the new one
Files.move(newFile.toPath(), oldFile.toPath(), StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING);
}
catch (Exception e)
{
ClientProxy.LOGGER.error("LOD file write error: ");
e.printStackTrace();
}
for(byte detailLevel = region.getMinDetailLevel(); detailLevel <= LodUtil.REGION_DETAIL_LEVEL; detailLevel++)
{
String fileName = getFileNameAndPathForRegion(x, z, detailLevel);
File oldFile = new File(fileName);
// if the fileName was null that means the folder is inaccessible
// for some reason
if (fileName == null)
{
ClientProxy.LOGGER.warn("Unable to save region [" + x + ", " + z + "] to file.");
return;
}
try
{
// make sure the file and folder exists
if (!oldFile.exists())
{
// the file doesn't exist,
// create it and the folder if need be
if (!oldFile.getParentFile().exists())
oldFile.getParentFile().mkdirs();
oldFile.createNewFile();
} else
{
// the file exists, make sure it
// is the correct version.
// (to make sure we don't overwrite a newer
// version file if it exists)
BufferedReader br = new BufferedReader(new FileReader(oldFile));
String s = br.readLine();
int fileVersion = LOD_SAVE_FILE_VERSION;
if (s != null && !s.isEmpty())
{
// try to get the file version
try
{
fileVersion = Integer.parseInt(s.substring(s.indexOf(' ')).trim());
} catch (NumberFormatException | StringIndexOutOfBoundsException e)
{
// this file doesn't have a correctly formated version
// just overwrite the file
}
}
br.close();
// check if this file can be written to by the file handler
if (fileVersion <= LOD_SAVE_FILE_VERSION)
{
// we are good to continue and overwrite the old file
} else // if(fileVersion > LOD_SAVE_FILE_VERSION)
{
// the file we are reading is a newer version,
// don't write anything, we don't want to accidently
// delete anything the user may want.
return;
}
}
// the old file is good, now create a new save file
File newFile = new File(fileName + TMP_FILE_EXTENSION);
FileWriter fw = new FileWriter(newFile);
// add the version of this file
fw.write(LOD_FILE_VERSION_PREFIX + " " + LOD_SAVE_FILE_VERSION + "\n");
// add each LodChunk to the file
fw.write(region.getLevel(detailLevel).toString());
fw.close();
// overwrite the old file with the new one
Files.move(newFile.toPath(), oldFile.toPath(), StandardCopyOption.ATOMIC_MOVE, StandardCopyOption.REPLACE_EXISTING);
} catch (Exception e)
{
ClientProxy.LOGGER.error("LOD file write error: ");
e.printStackTrace();
}
}
}
@@ -345,7 +343,7 @@ public class LodDimensionFileHandler
*
* Returns null if there is an IO Exception.
*/
private String getFileNameAndPathForRegion(int regionX, int regionZ)
private String getFileNameAndPathForRegion(int regionX, int regionZ, byte detailLevel)
{
try
{
@@ -353,7 +351,7 @@ public class LodDimensionFileHandler
// ".\Super Flat\DIM-1\data"
// or
// ".\Super Flat\data"
return dimensionDataSaveFolder.getCanonicalPath() + File.separatorChar + LodConfig.CLIENT.maxGenerationDetail.get().detailLevel + File.separatorChar +
return dimensionDataSaveFolder.getCanonicalPath() + detailLevel + File.separatorChar +
FILE_NAME_PREFIX + "." + regionX + "." + regionZ + FILE_EXTENSION;
}
catch (IOException | SecurityException e)
@@ -29,6 +29,7 @@ import com.seibel.lod.enums.DistanceGenerationMode;
import com.seibel.lod.handlers.LodConfig;
import com.seibel.lod.handlers.LodDimensionFileHandler;
import com.seibel.lod.proxy.ClientProxy;
import com.seibel.lod.util.DetailUtil;
import com.seibel.lod.util.LodUtil;
import net.minecraft.client.Minecraft;
@@ -229,8 +230,9 @@ public class LodDimension
* Returns null if the region doesn't exist
* or is outside the loaded area.
*/
public LodRegion getRegion(RegionPos regionPos)
public LodRegion getRegion(LevelPos levelPos)
{
RegionPos regionPos = levelPos.getRegionPos();
int xIndex = (regionPos.x - center.x) + halfWidth;
int zIndex = (regionPos.z - center.z) + halfWidth;
@@ -238,15 +240,20 @@ public class LodDimension
// out of range
return null;
if (regions[xIndex][zIndex] == null)
if (regions[xIndex][zIndex] == null || regions[xIndex][zIndex].getMinDetailLevel() > levelPos.detailLevel)
{
regions[xIndex][zIndex] = getRegionFromFile(regionPos);
regions[xIndex][zIndex] = getRegionFromFile(levelPos);
if (regions[xIndex][zIndex] == null)
{
/**TODO the value is currently 0 but should be determinated by the distance of the player)*/
regions[xIndex][zIndex] = new LodRegion(LodConfig.CLIENT.maxGenerationDetail.get().detailLevel, regionPos);
}
if (regions[xIndex][zIndex].getMinDetailLevel() > levelPos.detailLevel)
{
regions[xIndex][zIndex].expand(levelPos.detailLevel);
}
}
return regions[xIndex][zIndex];
@@ -273,11 +280,11 @@ public class LodDimension
/**
* this method creates all null regions
*/
public void initializeNullRegions()
public void treeCutter(int posX, int posZ)
{
int regionX;
int regionZ;
RegionPos regionPos;
LevelPos levelPos;
LodRegion region;
for (int x = 0; x < regions.length; x++)
@@ -286,14 +293,13 @@ public class LodDimension
{
regionX = (x + center.x) - halfWidth;
regionZ = (z + center.z) - halfWidth;
regionPos = new RegionPos(regionX, regionZ);
region = getRegion(regionPos);
if (region == null)
{
// if no region exists, create it
region = new LodRegion(LodConfig.CLIENT.maxGenerationDetail.get().detailLevel, regionPos);
addOrOverwriteRegion(region);
levelPos = new LevelPos(LodUtil.REGION_DETAIL_LEVEL, regionX, regionZ);
for(byte index = LodUtil.BLOCK_DETAIL_LEVEL; index <= LodUtil.REGION_DETAIL_LEVEL; index++){
if(DetailUtil.getDistanceGeneration(index+1) > levelPos.minDistance(posX, posZ)){
region = getRegion(levelPos.convert(DetailUtil.getLodDetail(index+1).detailLevel));
region.cuteTree(DetailUtil.getLodDetail(index).detailLevel);
break;
}
}
}
}
@@ -315,14 +321,8 @@ public class LodDimension
return false;
}
LodRegion region = getRegion(regionPos);
LodRegion region = getRegion(levelPos);
if (region == null)
{
// if no region exists, create it
region = new LodRegion(LodConfig.CLIENT.maxGenerationDetail.get().detailLevel, regionPos);
addOrOverwriteRegion(region);
}
boolean nodeAdded = region.setData(levelPos, lodDataPoint, generationMode.complexity, true);
// only save valid LODs to disk
if (!dontSave && fileHandler != null)
@@ -377,12 +377,7 @@ public class LodDimension
xIndex = (xRegion + center.x) - halfWidth;
zIndex = (zRegion + center.z) - halfWidth;
RegionPos regionPos = new RegionPos(xIndex, zIndex);
region = getRegion(regionPos);
if (region == null)
{
region = new LodRegion(LodConfig.CLIENT.maxGenerationDetail.get().detailLevel, regionPos);
addOrOverwriteRegion(region);
}
region = getRegion(new LevelPos(LodUtil.REGION_DETAIL_LEVEL, regionPos.x, regionPos.z).convert(detailLevel));
listOfData.addAll(region.getDataToGenerate(playerPosX, playerPosZ, start, end, generation, detailLevel, dataNumber));
}
}
@@ -419,7 +414,7 @@ public class LodDimension
xIndex = (xRegion + center.x) - halfWidth;
zIndex = (zRegion + center.z) - halfWidth;
RegionPos regionPos = new RegionPos(xIndex, zIndex);
region = getRegion(regionPos);
region = getRegion(new LevelPos(LodUtil.REGION_DETAIL_LEVEL, regionPos.x, regionPos.z).convert(detailLevel));
if (region == null)
{
region = new LodRegion(LodConfig.CLIENT.maxGenerationDetail.get().detailLevel, regionPos);
@@ -441,7 +436,7 @@ public class LodDimension
public List<LevelPos> getDataToRender(RegionPos regionPos, int playerPosX, int playerPosZ, int start, int end, byte detailLevel)
{
List<LevelPos> listOfData = new ArrayList<>();
LodRegion region = getRegion(regionPos);
LodRegion region = getRegion(new LevelPos(LodUtil.REGION_DETAIL_LEVEL, regionPos.x, regionPos.z).convert(detailLevel));
if (region == null)
{
try
@@ -474,7 +469,7 @@ public class LodDimension
if (levelPos.detailLevel > LodUtil.REGION_DETAIL_LEVEL)
throw new IllegalArgumentException("getLodFromCoordinates given a level of \"" + levelPos.detailLevel + "\" when \"" + LodUtil.REGION_DETAIL_LEVEL + "\" is the max.");
LodRegion region = getRegion(levelPos.getRegionPos());
LodRegion region = getRegion(levelPos);
if (region == null)
@@ -485,28 +480,13 @@ public class LodDimension
return region.getData(levelPos);
}
/**
* return true if and only if the node at that position exist
*/
public boolean hasThisPositionBeenGenerated(ChunkPos chunkPos)
{
LodRegion region = getRegion(LodUtil.convertGenericPosToRegionPos(chunkPos.x, chunkPos.z, LodUtil.CHUNK_DETAIL_LEVEL));
if (region == null)
{
return false;
}
return region.hasDataBeenGenerated(new LevelPos(LodUtil.CHUNK_DETAIL_LEVEL, chunkPos.x, chunkPos.z));
}
/**
* return true if and only if the node at that position exist
*/
public boolean hasThisPositionBeenGenerated(LevelPos levelPos)
{
LodRegion region = getRegion(levelPos.getRegionPos());
LodRegion region = getRegion(levelPos);
if (region == null)
{
@@ -521,7 +501,7 @@ public class LodDimension
*/
public boolean doesDataExist(LevelPos levelPos)
{
LodRegion region = getRegion(levelPos.getRegionPos());
LodRegion region = getRegion(levelPos);
if (region == null)
{
@@ -536,7 +516,7 @@ public class LodDimension
*/
public DistanceGenerationMode getGenerationMode(LevelPos levelPos)
{
LodRegion region = getRegion(levelPos.getRegionPos());
LodRegion region = getRegion(levelPos);
if (region == null)
{
@@ -550,10 +530,10 @@ public class LodDimension
* Get the region at the given X and Z coordinates from the
* RegionFileHandler.
*/
public LodRegion getRegionFromFile(RegionPos regionPos)
public LodRegion getRegionFromFile(LevelPos levelPos)
{
if (fileHandler != null)
return fileHandler.loadRegionFromFile(regionPos);
return fileHandler.loadRegionFromFile(levelPos);
else
return null;
}
@@ -607,17 +607,38 @@ public class LodRegion implements Serializable
}
/**
* @param lod
* @param detailLevel
*/
public void removeDetailLevel(byte lod)
public void cuteTree(byte detailLevel)
{
for (byte tempLod = 0; tempLod <= lod; tempLod++)
if(minDetailLevel < detailLevel)
{
colors[tempLod] = new byte[0][0][0];
height[tempLod] = new short[0][0];
depth[tempLod] = new short[0][0];
generationType[tempLod] = new byte[0][0];
dataExistence[tempLod] = new boolean[0][0];
for (byte tempLod = 0; tempLod < detailLevel; tempLod++)
{
colors[tempLod] = new byte[0][0][0];
height[tempLod] = new short[0][0];
depth[tempLod] = new short[0][0];
generationType[tempLod] = new byte[0][0];
dataExistence[tempLod] = new boolean[0][0];
}
minDetailLevel = detailLevel;
}
}
/**
* @param detailLevel
*/
public void expand(byte detailLevel)
{
if(detailLevel < minDetailLevel){
for(byte tempLod = detailLevel; tempLod < minDetailLevel; tempLod++){
int size = (short) Math.pow(2, LodUtil.REGION_DETAIL_LEVEL - tempLod);
colors[tempLod] = new byte[size][size][3];
height[tempLod] = new short[size][size];
depth[tempLod] = new short[size][size];
generationType[tempLod] = new byte[size][size];
dataExistence[tempLod] = new boolean[size][size];
}
}
}
@@ -139,10 +139,10 @@ public class ClientProxy
// LodConfig.CLIENT.drawLODs.set(true);
LodConfig.CLIENT.debugMode.set(false);
LodConfig.CLIENT.maxDrawDetail.set(LodDetail.SINGLE);
LodConfig.CLIENT.maxGenerationDetail.set(LodDetail.SINGLE);
LodConfig.CLIENT.maxDrawDetail.set(LodDetail.HALF);
LodConfig.CLIENT.maxGenerationDetail.set(LodDetail.FULL);
LodConfig.CLIENT.fogDistance.set(FogDistance.NEAR);
LodConfig.CLIENT.fogDistance.set(FogDistance.FAR);
LodConfig.CLIENT.fogDrawOverride.set(FogDrawOverride.ALWAYS_DRAW_FOG_FANCY);
LodConfig.CLIENT.shadingMode.set(ShadingMode.DARKEN_SIDES);
// LodConfig.CLIENT.brightnessMultiplier.set(1.0);
@@ -152,7 +152,7 @@ public class ClientProxy
LodConfig.CLIENT.allowUnstableFeatureGeneration.set(false);
LodConfig.CLIENT.lodChunkRenderDistance.set(128);
LodConfig.CLIENT.lodDistanceCalculatorType.set(DistanceCalculatorType.LINEAR);
LodConfig.CLIENT.lodQuality.set(2);
LodConfig.CLIENT.lodQuality.set(1);
LodConfig.CLIENT.allowUnstableFeatureGeneration.set(false);
LodConfig.CLIENT.numberOfWorldGenerationThreads.set(12);
@@ -1,6 +1,7 @@
package com.seibel.lod.util;
import com.seibel.lod.enums.DistanceGenerationMode;
import com.seibel.lod.enums.LodDetail;
import com.seibel.lod.handlers.LodConfig;
public class DetailUtil
@@ -22,6 +23,17 @@ public class DetailUtil
DistanceGenerationMode.SURFACE,
DistanceGenerationMode.SURFACE};
private static LodDetail[] lodDetails = {
LodDetail.FULL,
LodDetail.FULL,
LodDetail.HALF,
LodDetail.HALF,
LodDetail.QUAD,
LodDetail.QUAD,
LodDetail.DOUBLE,
LodDetail.DOUBLE,
LodDetail.SINGLE,
LodDetail.SINGLE};
public static int getDistanceRendering(int detail)
{
@@ -52,4 +64,9 @@ public class DetailUtil
{
return distancesGenerators[detail];
}
public static LodDetail getLodDetail(int detail)
{
return lodDetails[detail];
}
}