Skip to content

Commit

Permalink
Add dimension Blacklist/Whitelist for cloud rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
michelegargiulo committed Apr 5, 2024
1 parent d4fab4b commit 1990f64
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ public static class CloudsConfig {

public boolean enabled = true;

public int[] dimensionList = {};

public boolean dimensionListIsBlacklist = true;

public int height = 256;
@Config.RangeInt(min = 4)
public int renderDistance = 32;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

import javax.annotation.Nonnull;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.function.Predicate;

import static dev.redstudio.valkyrie.Valkyrie.MC;
Expand Down Expand Up @@ -203,7 +204,8 @@ private boolean isBuilt() {
}

public void updateSettings() {
final boolean enabled = ValkyrieConfig.graphics.clouds.enabled && MC.world != null && MC.world.provider.isSurfaceWorld();
final boolean enabled = ValkyrieConfig.graphics.clouds.enabled && MC.world != null && MC.world.provider.isSurfaceWorld() &&
(Arrays.stream(ValkyrieConfig.graphics.clouds.dimensionList).anyMatch(n -> n == MC.world.provider.getDimension()) != ValkyrieConfig.graphics.clouds.dimensionListIsBlacklist);

if (isBuilt() && (!enabled || ValkyrieConfig.graphics.clouds.renderDistance != renderDistance || ValkyrieConfig.graphics.clouds.layers != layers))
dispose();
Expand Down
4 changes: 4 additions & 0 deletions src/main/resources/assets/valkyrie/lang/en_us.lang
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ valkyrie.general.graphics.clouds.tooltip=Configuration for the clouds

valkyrie.general.graphics.clouds.enabled=Enabled
valkyrie.general.graphics.clouds.enabled.tooltip=Whether or not clouds are enabled
valkyrie.general.graphics.clouds.dimensionlist=Dimension List
valkyrie.general.graphics.clouds.dimensionlist.tooltip=Dimension List where clouds are whitelisted/blacklisted
valkyrie.general.graphics.clouds.dimensionlistisblacklist=Dimension List is Blacklist
valkyrie.general.graphics.clouds.dimensionlistisblacklist.tooltip=If True, Dimension List will be treated as a Blacklist instead of a Whitelist
valkyrie.general.graphics.clouds.height=Height
valkyrie.general.graphics.clouds.height.tooltip=The height of the clouds
valkyrie.general.graphics.clouds.renderdistance=Render Distance
Expand Down

0 comments on commit 1990f64

Please sign in to comment.