Merge branch 'main' of gitlab.com:jeseibel/distant-horizons-core
This commit is contained in:
@@ -22,6 +22,7 @@ package com.seibel.lod.core.builders.lodBuilding;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import com.seibel.lod.core.api.ClientApi;
|
||||
import com.seibel.lod.core.enums.config.DistanceGenerationMode;
|
||||
import com.seibel.lod.core.enums.config.HorizontalResolution;
|
||||
import com.seibel.lod.core.objects.lod.LodDimension;
|
||||
@@ -62,9 +63,11 @@ public class LodBuilder
|
||||
private static final IVersionConstants VERSION_CONSTANTS = SingletonHandler.get(IVersionConstants.class);
|
||||
|
||||
/** If no blocks are found in the area in determineBottomPointForArea return this */
|
||||
public static final short DEFAULT_DEPTH = (short) VERSION_CONSTANTS.getMinimumWorldHeight();
|
||||
public static final short DEFAULT_DEPTH = 0;//(short) VERSION_CONSTANTS.getMinimumWorldHeight();
|
||||
/** If no blocks are found in the area in determineHeightPointForArea return this */
|
||||
public static final short DEFAULT_HEIGHT = (short) VERSION_CONSTANTS.getMinimumWorldHeight();
|
||||
public static final short DEFAULT_HEIGHT = 0;//(short) VERSION_CONSTANTS.getMinimumWorldHeight();
|
||||
|
||||
public static final short MIN_WORLD_HEIGHT = (short)VERSION_CONSTANTS.getMinimumWorldHeight();
|
||||
/** Minecraft's max light value */
|
||||
public static final short DEFAULT_MAX_LIGHT = 15;
|
||||
|
||||
@@ -109,8 +112,8 @@ public class LodBuilder
|
||||
Thread thread = new Thread(() ->
|
||||
{
|
||||
//noinspection GrazieInspection
|
||||
try
|
||||
{
|
||||
//try
|
||||
//{
|
||||
// we need a loaded client world in order to
|
||||
// get the textures for blocks
|
||||
if (MC.getWrappedClientWorld() == null)
|
||||
@@ -133,14 +136,14 @@ public class LodBuilder
|
||||
lodDim = lodWorld.getLodDimension(dim);
|
||||
}
|
||||
generateLodNodeFromChunk(lodDim, chunk, new LodBuilderConfig(generationMode));
|
||||
}
|
||||
catch (IllegalArgumentException | NullPointerException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
// if the world changes while LODs are being generated
|
||||
// they will throw errors as they try to access things that no longer
|
||||
// exist.
|
||||
}
|
||||
//}
|
||||
//catch (IllegalArgumentException | NullPointerException e)
|
||||
//{
|
||||
// e.printStackTrace();
|
||||
// // if the world changes while LODs are being generated
|
||||
// // they will throw errors as they try to access things that no longer
|
||||
// // exist.
|
||||
//}
|
||||
});
|
||||
lodGenThreadPool.execute(thread);
|
||||
}
|
||||
@@ -269,12 +272,14 @@ public class LodBuilder
|
||||
{
|
||||
yAbs = depth;
|
||||
light = getLightValue(chunk, xAbs,yAbs,zAbs, true, hasSkyLight, true);
|
||||
color = generateLodColor(chunk, config, xAbs, yAbs, zAbs);
|
||||
//TODO don't ask me why, but apparently it works
|
||||
color = generateLodColor(chunk, config, xAbs, yAbs - MIN_WORLD_HEIGHT, zAbs);
|
||||
}
|
||||
else
|
||||
{
|
||||
light = getLightValue(chunk, xAbs, yAbs, zAbs, hasCeiling, hasSkyLight, topBlock);
|
||||
color = generateLodColor(chunk, config, xAbs, yAbs, zAbs);
|
||||
//TODO don't ask me why, but apparently it works
|
||||
color = generateLodColor(chunk, config, xAbs, yAbs - MIN_WORLD_HEIGHT, zAbs);
|
||||
}
|
||||
lightBlock = light & 0b1111;
|
||||
lightSky = (light >> 4) & 0b1111;
|
||||
@@ -469,27 +474,19 @@ public class LodBuilder
|
||||
int colorOfBlock;
|
||||
int colorInt;
|
||||
|
||||
IBlockShapeWrapper blockShapeWrapper;
|
||||
IBlockColorWrapper blockColorWrapper;
|
||||
try
|
||||
{
|
||||
blockShapeWrapper = chunk.getBlockShapeWrapper(x, y, z);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
//TODO fix the cause of the bug, bot it's symptoms
|
||||
//ClientApi.LOGGER.error(LodBuilder.class.getSimpleName() + ": ran into an error: " + e.getMessage());
|
||||
//e.printStackTrace();
|
||||
IBlockShapeWrapper blockShapeWrapper = chunk.getBlockShapeWrapper(x, y, z);
|
||||
|
||||
if (blockShapeWrapper == null || blockShapeWrapper.isToAvoid())
|
||||
return 0;
|
||||
}
|
||||
|
||||
IBlockColorWrapper blockColorWrapper;
|
||||
|
||||
if (chunk.isWaterLogged(x, y, z))
|
||||
blockColorWrapper = BLOCK_COLOR.getWaterColor();
|
||||
else
|
||||
blockColorWrapper = chunk.getBlockColorWrapper(x, y, z);
|
||||
|
||||
if (blockShapeWrapper.isToAvoid())
|
||||
return 0;
|
||||
|
||||
|
||||
colorOfBlock = blockColorWrapper.getColor();
|
||||
|
||||
@@ -525,6 +522,7 @@ public class LodBuilder
|
||||
boolean noCollisionAvoidance = config.client().worldGenerator().getBlocksToAvoid().noCollision;
|
||||
|
||||
IBlockShapeWrapper block = chunk.getBlockShapeWrapper(x, y, z);
|
||||
if (block == null) return false;
|
||||
return !block.isToAvoid()
|
||||
&& !(nonFullAvoidance && block.isNonFull())
|
||||
&& !(noCollisionAvoidance && block.hasNoCollision());
|
||||
|
||||
@@ -165,7 +165,7 @@ public class LodWorldGenerator
|
||||
|
||||
|
||||
// add the far positions
|
||||
if (posToGenerate.getNthDetail(farIndex, false) != 0 && farIndex < posToGenerate.getNumberOfFarPos())
|
||||
if (farIndex < posToGenerate.getNumberOfFarPos() && posToGenerate.getNthDetail(farIndex, false) != 0)
|
||||
{
|
||||
detailLevel = (byte) (posToGenerate.getNthDetail(farIndex, false) - 1);
|
||||
posX = posToGenerate.getNthPosX(farIndex, false);
|
||||
@@ -232,9 +232,9 @@ public class LodWorldGenerator
|
||||
Runnable method = (() -> {generateChunk(newPos, newGenerationMode,
|
||||
newLodBuilder, newLodDimension, serverWorld);});
|
||||
|
||||
if (newGenerationMode == DistanceGenerationMode.FULL
|
||||
|| VERSION_CONSTANTS.isWorldGeneratorSingleThreaded(newGenerationMode))
|
||||
if (VERSION_CONSTANTS.isWorldGeneratorSingleThreaded(newGenerationMode))
|
||||
{
|
||||
// --Note: This is now using version constants--
|
||||
// if we are using FULL generation there is no reason
|
||||
// to queue up a bunch of generation requests,
|
||||
// because MC's internal server (as of 1.16.5) only
|
||||
@@ -268,7 +268,7 @@ public class LodWorldGenerator
|
||||
// be added to the current LodDimension
|
||||
|
||||
if (lodDim.regionIsInRange(pos.getX() / LodUtil.REGION_WIDTH_IN_CHUNKS, pos.getZ() / LodUtil.REGION_WIDTH_IN_CHUNKS))
|
||||
{
|
||||
{
|
||||
switch (generationMode)
|
||||
{
|
||||
case NONE:
|
||||
|
||||
Reference in New Issue
Block a user