From 79224bdca37da5d3d5a05c4db9dfa7e15b1f37bd Mon Sep 17 00:00:00 2001 From: CodeF53 <37855219+CodeF53@users.noreply.github.com> Date: Sun, 1 May 2022 09:59:36 -0600 Subject: [PATCH] Add a toggle for avoided blocks tint. Close #281 This is off by default Additional comments in #tech-talk: https://discord.com/channels/881614130614767666/902896965354930217/970351193928921139 --- src/main/java/com/seibel/lod/core/Config.java | 5 +++++ .../lod/core/builders/lodBuilding/LodBuilder.java | 6 +++--- .../config/ILodConfigWrapperSingleton.java | 9 +++++++++ .../config/LodConfigWrapperSingleton.java | 11 +++++++++++ src/main/resources/assets/lod/lang/en_us.json | 4 ++++ 5 files changed, 32 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/seibel/lod/core/Config.java b/src/main/java/com/seibel/lod/core/Config.java index dd407d38d..c992a84e5 100644 --- a/src/main/java/com/seibel/lod/core/Config.java +++ b/src/main/java/com/seibel/lod/core/Config.java @@ -322,6 +322,11 @@ public class Config .comment(IWorldGenerator.BLOCKS_TO_AVOID_DESC) .set(IWorldGenerator.BLOCKS_TO_AVOID_DEFAULT) .build(); + + public static ConfigEntry tintWithAvoidedBlocks = new ConfigEntry.Builder() + .comment(IWorldGenerator.TINT_WITH_AVOIDED_BLOCKS_DESC) + .set(IWorldGenerator.TINT_WITH_AVOIDED_BLOCKS_DEFAULT) + .build(); } diff --git a/src/main/java/com/seibel/lod/core/builders/lodBuilding/LodBuilder.java b/src/main/java/com/seibel/lod/core/builders/lodBuilding/LodBuilder.java index 9081e31ac..7e985b039 100644 --- a/src/main/java/com/seibel/lod/core/builders/lodBuilding/LodBuilder.java +++ b/src/main/java/com/seibel/lod/core/builders/lodBuilding/LodBuilder.java @@ -393,8 +393,8 @@ public class LodBuilder if (strictEdge) { IBlockDetailWrapper blockAbove = chunk.getBlockDetail(xAbs, yAbs + 1, zAbs); - if (blockAbove != null && !blockAbove.shouldRender(config.client().worldGenerator().getBlocksToAvoid())) - { // The above block is skipped. Lets use its skipped color for currrent block + if (blockAbove != null && config.client().worldGenerator().getTintWithAvoidedBlocks() && !blockAbove.shouldRender(config.client().worldGenerator().getBlocksToAvoid())) + { // The above block is skipped. Lets use its skipped color for current block currentBlockDetail = blockAbove; } if (currentBlockDetail == null) currentBlockDetail = chunk.getBlockDetail(xAbs, yAbs, zAbs); @@ -457,7 +457,7 @@ public class LodBuilder colorInt = 0; if (chunk.blockPosInsideChunk(x, y+1, z)) { IBlockDetailWrapper blockAbove = chunk.getBlockDetail(x, y+1, z); - if (blockAbove != null && !blockAbove.shouldRender(config.client().worldGenerator().getBlocksToAvoid())) + if (blockAbove != null && config.client().worldGenerator().getTintWithAvoidedBlocks() && !blockAbove.shouldRender(config.client().worldGenerator().getBlocksToAvoid())) { // The above block is skipped. Lets use its skipped color for currrent block colorInt = blockAbove.getAndResolveFaceColor(null, chunk, FACTORY.createBlockPos(x, y+1, z)); } diff --git a/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java b/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java index c47344d0f..488b67318 100644 --- a/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java +++ b/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java @@ -742,6 +742,15 @@ public interface ILodConfigWrapperSingleton extends IBindable + " This wont't affect performance."; BlocksToAvoid getBlocksToAvoid(); void setBlockToAvoid(BlocksToAvoid newBlockToAvoid); + + //TODO: improve wording + Boolean TINT_WITH_AVOIDED_BLOCKS_DEFAULT = true; + String TINT_WITH_AVOIDED_BLOCKS_DESC = "" + + " Should the blocks underneath avoided blocks gain the color of the avoided block? \n" + + " True: a red flower on grass will tint the grass below it red" + + " False: skipped blocks will not change color of surface below them"; + Boolean getTintWithAvoidedBlocks(); + void setTintWithAvoidedBlocks(Boolean shouldTint); } diff --git a/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/LodConfigWrapperSingleton.java b/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/LodConfigWrapperSingleton.java index 96764d9c3..cba032b74 100644 --- a/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/LodConfigWrapperSingleton.java +++ b/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/LodConfigWrapperSingleton.java @@ -573,6 +573,17 @@ public class LodConfigWrapperSingleton implements ILodConfigWrapperSingleton { Config.Client.WorldGenerator.blocksToAvoid.set(newBlockToAvoid); } + + + @Override + public Boolean getTintWithAvoidedBlocks() { + return Config.Client.WorldGenerator.tintWithAvoidedBlocks.get(); + } + @Override + public void setTintWithAvoidedBlocks(Boolean shouldTint) { + Config.Client.WorldGenerator.tintWithAvoidedBlocks.set(shouldTint); + } + @Override public boolean getEnableDistantGeneration() { diff --git a/src/main/resources/assets/lod/lang/en_us.json b/src/main/resources/assets/lod/lang/en_us.json index 42a17888a..ea3ae5bc9 100644 --- a/src/main/resources/assets/lod/lang/en_us.json +++ b/src/main/resources/assets/lod/lang/en_us.json @@ -194,6 +194,10 @@ "Block to avoid", "lod.config.client.worldGenerator.blocksToAvoid.@tooltip": "Defines the types of blocks to ignore when generating fake chunks.", + "lod.config.client.worldGenerator.tintWithAvoidedBlocks": + "Tint with avoided blocks", + "lod.config.client.worldGenerator.tintWithAvoidedBlocks.@tooltip": + "§4Warning makes snow, carpet, and trapdoors look really bad§r\nShould the blocks underneath avoided blocks gain the color of the avoided block?\n§6True:§r a red flower on grass will tint the grass below it red\n§6False:§r skipped blocks will not change color of surface below them", "lod.config.client.worldGenerator.enableDistantGeneration": "Enable Distant Generation", "lod.config.client.worldGenerator.enableDistantGeneration.@tooltip":