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
This commit is contained in:
CodeF53
2022-05-01 09:59:36 -06:00
parent 10943e0d7d
commit 79224bdca3
5 changed files with 32 additions and 3 deletions
@@ -322,6 +322,11 @@ public class Config
.comment(IWorldGenerator.BLOCKS_TO_AVOID_DESC)
.set(IWorldGenerator.BLOCKS_TO_AVOID_DEFAULT)
.build();
public static ConfigEntry<Boolean> tintWithAvoidedBlocks = new ConfigEntry.Builder<Boolean>()
.comment(IWorldGenerator.TINT_WITH_AVOIDED_BLOCKS_DESC)
.set(IWorldGenerator.TINT_WITH_AVOIDED_BLOCKS_DEFAULT)
.build();
}
@@ -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));
}
@@ -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);
}
@@ -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()
{
@@ -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":