Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #1 from Andbeav/v1.0.1
Browse files Browse the repository at this point in the history
Feature toggle session persistence and cleaning up config
  • Loading branch information
Andbeav authored Jan 8, 2022
2 parents cf23bc6 + 70552b6 commit 5d515d3
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 14 deletions.
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
# SafeTweaks

QOL tweaks that should be safe for any normal servers to allow
QOL tweaks that should be safe for servers. Think [Tweakeroo](https://github.com/maruohon/tweakeroo) without the 'hacky' features.

## Requirements

I believe it's only ModMenu/ClothConfig
* [ModMenu](https://github.com/TerraformersMC/ModMenu)
* [ClothConfig](https://github.com/shedaniel/cloth-config)

## Current tweaks

Expand All @@ -13,4 +14,4 @@ I believe it's only ModMenu/ClothConfig

## Usage

Accessing the SafeTweaks menu in the mod menu should give you the options.
Assuming you have the required mods, the Mod menu button on the main/pause screen should list SafeTweaks and the given options.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ org.gradle.jvmargs=-Xmx1G
loader_version=0.12.12

# Mod Properties
mod_version = 1.0.0
mod_version = 1.0.1
maven_group = com.safetweaks
archives_base_name = safetweaks

Expand Down
8 changes: 7 additions & 1 deletion src/main/java/net/fabricmc/safetweaks/InitializerMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ public void onInitialize() {
// However, some things (like resources) may still be uninitialized.
// Proceed with mild caution.

FeatureFlagManager.getInstance().set("renderDistanceFogToggle", false);
initializeFeatureFlags();

LOGGER.info("SafeTweaks init!");
}

private void initializeFeatureFlags() {
FeatureFlagManager featureFlags = FeatureFlagManager.getInstance();
featureFlags.set("renderDistanceFogToggle", false);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public Boolean get(String key) throws FeatureMissingException {
if(FeatureFlags.keySet().contains(key)) {
return FeatureFlags.get(key);
} else {
throw new FeatureMissingException("Key does not found in features: " + key);
throw new FeatureMissingException("Key not found in features: " + key);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,10 @@ public static ConfigBuilder getConfigBuilderWithOptions() {

// Gamma tweak
Double gamma = client.options.gamma;
tweaks.addEntry(entryBuilder.startDoubleField(new TranslatableText("config.safetweaks.gamma"), gamma).setDefaultValue(gamma).setSaveConsumer(newVal -> client.options.gamma = newVal).build());
tweaks.addEntry(entryBuilder.startDoubleField(new TranslatableText("config.safetweaks.gamma"), gamma).setDefaultValue(0.0).setSaveConsumer(newVal -> client.options.gamma = newVal).build());

// Render distance fog override tweak
tweaks.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.safetweaks.render-distance-fog"), false).setDefaultValue(false).setSaveConsumer((newVal) -> { featureFlags.set("renderDistanceFogToggle", newVal); }).build());

// On save
// builder.setSavingRunnable(() -> {
// });
tweaks.addEntry(entryBuilder.startBooleanToggle(new TranslatableText("config.safetweaks.render-distance-fog"), featureFlags.get("renderDistanceFogToggle")).setDefaultValue(false).setSaveConsumer((newVal) -> { featureFlags.set("renderDistanceFogToggle", newVal); }).build());

// Returning the builder
builder.transparentBackground();
Expand Down
4 changes: 2 additions & 2 deletions src/main/resources/fabric.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
"Andbeav"
],
"contact": {
"homepage": "https://fabricmc.net/",
"sources": "https://github.com/FabricMC/fabric-example-mod"
"homepage": "https://github.com/Andbeav/SafeTweaks",
"sources": "https://github.com/Andbeav/SafeTweaks"
},

"license": "CC0-1.0",
Expand Down

0 comments on commit 5d515d3

Please sign in to comment.