diff --git a/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilder.java b/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilder.java index ee75e0542..f28e20560 100644 --- a/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilder.java +++ b/src/main/java/com/seibel/lod/builders/lodBuilding/LodBuilder.java @@ -94,6 +94,10 @@ public class LodBuilder public static final ConcurrentMap toTint = new ConcurrentHashMap<>(); public static final ConcurrentMap shapeMap = new ConcurrentHashMap<>(); + public static final ConcurrentMap notFullBlock = new ConcurrentHashMap<>(); + public static final ConcurrentMap smallBlock = new ConcurrentHashMap<>(); + + public static final ModelDataMap dataMap = new ModelDataMap.Builder().build(); /** If no blocks are found in the area in determineBottomPointForArea return this */ @@ -422,9 +426,24 @@ public class LodBuilder colorInt = getColorForBlock(chunk, blockPos); } + // if we are skipping non-full and non-solid blocks that means we ignore + // snow, flowers, etc. Get the above block so we can still get the color + // of the snow, flower, etc. that may be above this block + int aboveColorInt = 0; + if (LodConfig.CLIENT.worldGenerator.avoidNonFullBlock.get() || LodConfig.CLIENT.worldGenerator.avoidBlockWithNoCollision.get()) + { + blockPos.set(chunk.getPos().getMinBlockX() + xRel, sectionIndex * CHUNK_DATA_WIDTH + yRel + 1, chunk.getPos().getMinBlockZ() + zRel); + aboveColorInt = getColorForBlock(chunk, blockPos); + } + if (colorInt == 0 && yAbs > 0) // if this block is invisible, check the block below it colorInt = generateLodColor(chunk, config, xRel, yAbs - 1, zRel, blockPos); + + // override this block's color if there was a block above this + // and we were avoiding non-full/non-solid blocks + if (aboveColorInt != 0) + colorInt = aboveColorInt; } return colorInt; @@ -760,9 +779,6 @@ public class LodBuilder return colorInt; } - public static final ConcurrentMap notFullBlock = new ConcurrentHashMap<>(); - public static final ConcurrentMap smallBlock = new ConcurrentHashMap<>(); - /** Is the block at the given blockPos a valid LOD point? */ private boolean isLayerValidLodPoint(IChunk chunk, BlockPos.Mutable blockPos) { @@ -777,9 +793,7 @@ public class LodBuilder if (avoidNonFullBlock) { - if (!notFullBlock.containsKey(blockState.getBlock()) - || notFullBlock.get(blockState.getBlock()) == null - ) + if (!notFullBlock.containsKey(blockState.getBlock()) || notFullBlock.get(blockState.getBlock()) == null) { VoxelShape voxelShape = blockState.getShape(chunk, blockPos); if (!blockState.getFluidState().isEmpty()) @@ -810,9 +824,7 @@ public class LodBuilder if (avoidBlockWithNoCollision) { - if (!smallBlock.containsKey(blockState.getBlock()) - || smallBlock.get(blockState.getBlock()) == null - ) + if (!smallBlock.containsKey(blockState.getBlock()) || smallBlock.get(blockState.getBlock()) == null) { if(!blockState.getFluidState().isEmpty()) smallBlock.put(blockState.getBlock(), false); diff --git a/src/main/java/com/seibel/lod/config/LodConfig.java b/src/main/java/com/seibel/lod/config/LodConfig.java index f8a879032..20401e249 100644 --- a/src/main/java/com/seibel/lod/config/LodConfig.java +++ b/src/main/java/com/seibel/lod/config/LodConfig.java @@ -344,7 +344,7 @@ public class LodConfig .comment("\n\n" + " If true LODs will only show full bocks when generating. \n" + " Turning this on will make plains smoother since the tall grass won't be used. \n") - .define("avoid Non Full Block", false); + .define("avoid Non Full Block", true); builder.pop(); } }