Skip to content

Commit

Permalink
Puzzle 1.4.0 - Fixes, Integrations & Tooltip
Browse files Browse the repository at this point in the history
- Fixed #41 (ETF 4.0+ crashing)
- Fixed #39 (Broken update checker)
- Fixed slider widgets being broken
- Hide buttons when options are empty (Closes #10)
- More mod integrations (Closes #20)
  - DynamicFPS
  - Borderless Mining
  - Colormatic
- Added tooltips for all Puzzle options
- Made everything translatable
- Improve German translations
  • Loading branch information
Motschen committed Aug 2, 2022
1 parent 94afc8b commit f89fc08
Show file tree
Hide file tree
Showing 14 changed files with 245 additions and 87 deletions.
4 changes: 4 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ dependencies {
modCompileOnly ("maven.modrinth:cit-resewn:${project.cit_resewn_version}")
modImplementation ("maven.modrinth:continuity:${project.continuity_version}")
modImplementation ("maven.modrinth:animatica:${project.animatica_version}")
modImplementation ("maven.modrinth:colormatic:${project.colormatic_version}")
modImplementation ("maven.modrinth:borderless-mining:${project.borderless_mining_version}")
modImplementation ("maven.modrinth:dynamic-fps:${project.dynamic_fps_version}")
modImplementation("com.moandjiezana.toml:toml4j:${project.toml4j_version}")
modImplementation ("maven.modrinth:entitytexturefeatures:${project.entitytexturefeatures_version}")
modImplementation ("maven.modrinth:cem:${project.cem_version}")
modImplementation "com.gitlab.Lortseam:completeconfig:${project.complete_config_version}"
Expand Down
8 changes: 6 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx4G
loader_version=0.14.8

# Mod Properties
mod_version = 1.3.4
mod_version = 1.4.0-1.19
maven_group = net.puzzlemc
archives_base_name = puzzle

Expand All @@ -23,7 +23,11 @@ org.gradle.jvmargs=-Xmx4G
iris_version = 1.19.x-v1.2.5
continuity_version = 2.0.0+1.19
animatica_version = 0.5+1.19
cit_resewn_version = 1.0.1+1.18.2
colormatic_version = 3.1.2
borderless_mining_version = 1.1.5+1.19
dynamic_fps_version = 2.2.0
toml4j_version = 0.7.2
cit_resewn_version = 1.1.1+1.19
cem_version = 0.7.1-1.19
complete_config_version = 1.0.0
spruceui_version=4.0.0+1.19
Expand Down
3 changes: 3 additions & 0 deletions puzzle-gui/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ dependencies {
modImplementation ("maven.modrinth:lambdabettergrass:${project.lbg_version}")
modImplementation ("maven.modrinth:iris:${project.iris_version}")
modImplementation ("maven.modrinth:cit-resewn:${project.cit_resewn_version}")
modImplementation ("maven.modrinth:colormatic:${project.colormatic_version}")
modImplementation ("maven.modrinth:borderless-mining:${project.borderless_mining_version}")
modImplementation ("maven.modrinth:dynamic-fps:${project.dynamic_fps_version}")
modImplementation ("maven.modrinth:entitytexturefeatures:${project.entitytexturefeatures_version}")
modImplementation ("maven.modrinth:cem:${project.cem_version}")
modImplementation "com.gitlab.Lortseam:completeconfig:${project.complete_config_version}"
Expand Down
6 changes: 4 additions & 2 deletions puzzle-gui/src/main/java/net/puzzlemc/gui/IrisCompat.java
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
package net.puzzlemc.gui;

import eu.midnightdust.lib.util.MidnightColorUtil;
import net.fabricmc.loader.api.FabricLoader;
import net.irisshaders.iris.api.v0.IrisApi;
import net.irisshaders.iris.api.v0.IrisApiConfig;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.text.Style;
import net.minecraft.text.Text;
import net.puzzlemc.gui.screen.widget.PuzzleWidget;

public class IrisCompat {
public static void init() {
if (FabricLoader.getInstance().isModLoaded("iris")) {
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.of("Iris")));
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.of("Enable Shaders"), (button) -> button.setMessage(IrisApi.getInstance().getConfig().areShadersEnabled() ? PuzzleClient.YES : PuzzleClient.NO), (button) -> {
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("iris.puzzle.option.enableShaders"), (button) -> button.setMessage(IrisApi.getInstance().getConfig().areShadersEnabled() ? PuzzleClient.YES : PuzzleClient.NO), (button) -> {
IrisApiConfig irisConfig = IrisApi.getInstance().getConfig();
irisConfig.setShadersEnabledAndApply(!irisConfig.areShadersEnabled());
}));
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("options.iris.shaderPackSelection.title"), (button) -> button.setMessage(Text.of("OPEN")), (button) -> {
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.translatable("options.iris.shaderPackSelection.title"), (button) -> button.setMessage(Text.literal("➥ ").append(Text.translatable("iris.puzzle.option.open").setStyle(Style.EMPTY.withColor(MidnightColorUtil.radialRainbow(0.5f, 1).getRGB())))), (button) -> {
MinecraftClient client = MinecraftClient.getInstance();
client.setScreen((Screen) IrisApi.getInstance().openMainIrisScreenObj(client.currentScreen));
}));
Expand Down
126 changes: 107 additions & 19 deletions puzzle-gui/src/main/java/net/puzzlemc/gui/PuzzleClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
import dev.lambdaurora.lambdabettergrass.LambdaBetterGrass;
import dev.lambdaurora.lambdynlights.DynamicLightsConfig;
import dev.lambdaurora.lambdynlights.LambDynLights;
import dynamicfps.DynamicFPSConfig;
import dynamicfps.DynamicFPSMod;
import eu.midnightdust.core.MidnightLibClient;
import eu.midnightdust.cullleaves.config.CullLeavesConfig;
import io.github.kvverti.colormatic.Colormatic;
import io.github.kvverti.colormatic.ColormaticConfigController;
import link.infra.borderlessmining.config.ConfigHandler;
import me.pepperbell.continuity.client.config.ContinuityConfig;
import me.pepperbell.continuity.client.config.Option;
import net.dorianpb.cem.internal.config.CemConfig;
Expand All @@ -22,6 +28,7 @@
import shcm.shsupercm.fabric.citresewn.config.CITResewnConfig;
import traben.entity_texture_features.ETFApi;
import traben.entity_texture_features.config.ETFConfig;
import io.github.kvverti.colormatic.ColormaticConfig;

public class PuzzleClient implements ClientModInitializer {

Expand All @@ -31,6 +38,7 @@ public class PuzzleClient implements ClientModInitializer {

@Override
public void onInitializeClient() {
MidnightLibClient.hiddenMods.add("puzzle");
MinecraftClient client = MinecraftClient.getInstance();
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.of("Puzzle")));
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.translatable("puzzle.option.check_for_updates"), (button) -> button.setMessage(PuzzleConfig.checkUpdates ? YES : NO), (button) -> {
Expand Down Expand Up @@ -65,12 +73,102 @@ public void onInitializeClient() {
}
if (FabricLoader.getInstance().isModLoaded("cullleaves") && !PuzzleConfig.disabledIntegrations.contains("cullleaves")) {
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(Text.of("CullLeaves")));
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(Text.of("Cull Leaves"), (button) -> button.setMessage(CullLeavesConfig.enabled ? YES : NO), (button) -> {
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(Text.translatable("cullleaves.puzzle.option.enabled"), (button) -> button.setMessage(CullLeavesConfig.enabled ? YES : NO), (button) -> {
CullLeavesConfig.enabled = !CullLeavesConfig.enabled;
CullLeavesConfig.write("cullleaves");
MinecraftClient.getInstance().worldRenderer.reload();
}));
}
if (FabricLoader.getInstance().isModLoaded("colormatic") && !PuzzleConfig.disabledIntegrations.contains("colormatic")) {
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Colormatic")));
ColormaticConfig colormaticConfig = Colormatic.config();
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("colormatic.config.option.clearSky"), (button) -> button.setMessage(colormaticConfig.clearSky ? YES : NO), (button) -> {
colormaticConfig.clearSky = !colormaticConfig.clearSky;
ColormaticConfigController.persist(colormaticConfig);
}));
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("colormatic.config.option.clearVoid"), (button) -> button.setMessage(colormaticConfig.clearVoid ? YES : NO), (button) -> {
colormaticConfig.clearVoid = !colormaticConfig.clearVoid;
ColormaticConfigController.persist(colormaticConfig);
}));
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("colormatic.config.option.blendSkyLight"), (button) -> button.setMessage(colormaticConfig.blendSkyLight ? YES : NO), (button) -> {
colormaticConfig.blendSkyLight = !colormaticConfig.blendSkyLight;
ColormaticConfigController.persist(colormaticConfig);
}));
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("colormatic.config.option.flickerBlockLight"), (button) -> button.setMessage(colormaticConfig.flickerBlockLight ? YES : NO), (button) -> {
colormaticConfig.flickerBlockLight = !colormaticConfig.flickerBlockLight;
ColormaticConfigController.persist(colormaticConfig);
}));
PuzzleApi.addToResourceOptions(new PuzzleWidget(0, 100, Text.translatable("colormatic.config.option.relativeBlockLightIntensity"),
() -> (int) (100*(1.0 - colormaticConfig.relativeBlockLightIntensityExponent / -16.0)),
(button) -> button.setMessage(Text.translatable("colormatic.config.option.relativeBlockLightIntensity")
.append(": ")
.append(Text.literal(String.valueOf((int)(100 * Math.exp(ColormaticConfig.scaled(colormaticConfig.relativeBlockLightIntensityExponent))))).append("%"))),
(slider) -> {
try {
colormaticConfig.relativeBlockLightIntensityExponent = ((1.00 - ((slider.getInt())/100f)) * -16.0);
ColormaticConfigController.persist(colormaticConfig);
}
catch (NumberFormatException ignored) {}
}));
}
if (FabricLoader.getInstance().isModLoaded("dynamicfps") && !PuzzleConfig.disabledIntegrations.contains("dynamicfps")) {
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(Text.of("Dynamic FPS")));
DynamicFPSConfig fpsConfig = DynamicFPSMod.config;
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(Text.translatable("config.dynamicfps.reduce_when_unfocused"), (button) -> button.setMessage(fpsConfig.reduceFPSWhenUnfocused ? YES : NO), (button) -> {
fpsConfig.reduceFPSWhenUnfocused = !fpsConfig.reduceFPSWhenUnfocused;
fpsConfig.save();
}));
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(0, 60,Text.translatable("config.dynamicfps.unfocused_fps"), () -> fpsConfig.unfocusedFPS,
(button) -> button.setMessage(Text.of(fpsConfig.unfocusedFPS + " FPS")),
(slider) -> {
try {
fpsConfig.unfocusedFPS = slider.getInt();
}
catch (NumberFormatException ignored) {}
finally {fpsConfig.save();}
}));
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(Text.translatable("config.dynamicfps.restore_when_hovered"), (button) -> button.setMessage(fpsConfig.restoreFPSWhenHovered ? YES : NO), (button) -> {
fpsConfig.restoreFPSWhenHovered = !fpsConfig.restoreFPSWhenHovered;
fpsConfig.save();
}));
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(Text.translatable("config.dynamicfps.run_gc_on_unfocus"), (button) -> button.setMessage(fpsConfig.runGCOnUnfocus ? YES : NO), (button) -> {
fpsConfig.runGCOnUnfocus = !fpsConfig.runGCOnUnfocus;
fpsConfig.save();
}));
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(0, 100,Text.translatable("config.dynamicfps.unfocused_volume"), () -> ((Number)(fpsConfig.unfocusedVolumeMultiplier * 100)).intValue(),
(button) -> button.setMessage(Text.of(((Number)(fpsConfig.unfocusedVolumeMultiplier * 100)).intValue() + "%")),
(slider) -> {
try {
fpsConfig.unfocusedVolumeMultiplier = ((Number)slider.getInt()).floatValue() / 100;
}
catch (NumberFormatException ignored) {}
finally {fpsConfig.save();}
}));
PuzzleApi.addToPerformanceOptions(new PuzzleWidget(0, 100,Text.translatable("config.dynamicfps.hidden_volume"), () -> ((Number)(fpsConfig.hiddenVolumeMultiplier * 100)).intValue(),
(button) -> button.setMessage(Text.of(((Number)(fpsConfig.hiddenVolumeMultiplier * 100)).intValue() + "%")),
(slider) -> {
try {
fpsConfig.hiddenVolumeMultiplier = ((Number)slider.getInt()).floatValue() / 100;
}
catch (NumberFormatException ignored) {}
finally {fpsConfig.save();}
}));
}
if (FabricLoader.getInstance().isModLoaded("borderlessmining") && !PuzzleConfig.disabledIntegrations.contains("borderlessmining")) {
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.of("Borderless Mining")));
ConfigHandler bmConfig = ConfigHandler.getInstance();
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.translatable("config.borderlessmining.general.enabled"), (button) -> button.setMessage(bmConfig.isEnabledOrPending() ? YES : NO), (button) -> {
bmConfig.setEnabledPending(!bmConfig.isEnabledOrPending());
bmConfig.save();
}));
if (MinecraftClient.IS_SYSTEM_MAC) {
PuzzleApi.addToMiscOptions(new PuzzleWidget(Text.translatable("config.borderlessmining.general.enabledmac"), (button) -> button.setMessage(bmConfig.enableMacOS ? YES : NO), (button) -> {
bmConfig.enableMacOS = !bmConfig.enableMacOS;
bmConfig.setEnabledPending(bmConfig.isEnabled());
bmConfig.save();
}));
}
}
if (FabricLoader.getInstance().isModLoaded("iris") && !PuzzleConfig.disabledIntegrations.contains("iris")) {
IrisCompat.init();
}
Expand Down Expand Up @@ -108,7 +206,7 @@ public static void lateInit() { // Some mods are initialized after Puzzle, so we
citConfig.broken_paths = !citConfig.broken_paths;
citConfig.write();
}));
PuzzleApi.addToResourceOptions(new PuzzleWidget(0, 100,Text.translatable("config.citresewn.cache_ms.title"), (slider) -> slider.setInt(citConfig.cache_ms),
PuzzleApi.addToResourceOptions(new PuzzleWidget(0, 100,Text.translatable("config.citresewn.cache_ms.title"), () -> citConfig.cache_ms,
(button) -> button.setMessage(message(citConfig)),
(slider) -> {
try {
Expand Down Expand Up @@ -157,38 +255,28 @@ public static void lateInit() { // Some mods are initialized after Puzzle, so we
});
}
if (FabricLoader.getInstance().isModLoaded("entity_texture_features") && !PuzzleConfig.disabledIntegrations.contains("entity_texture_features")) {
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.etf.title")));
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.title")));
ETFConfig etfConfig = ETFApi.getETFConfigObject;
//ETFConfigScreen etfConfigScreen = new ETFConfigScreen();
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.etf.enable_custom_textures.title"), (button) -> button.setMessage(etfConfig.enableCustomTextures ? YES : NO), (button) -> {
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.enable_custom_textures.title"), (button) -> button.setMessage(etfConfig.enableCustomTextures ? YES : NO), (button) -> {
etfConfig.enableCustomTextures = !etfConfig.enableCustomTextures;
ETFApi.saveETFConfigChangesAndResetETF();
//etfConfigScreen.saveConfig();
//etfConfigScreen.resetVisuals();
}));
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.etf.enable_emissive_textures.title"), (button) -> button.setMessage(etfConfig.enableEmissiveTextures ? YES : NO), (button) -> {
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.enable_emissive_textures.title"), (button) -> button.setMessage(etfConfig.enableEmissiveTextures ? YES : NO), (button) -> {
etfConfig.enableEmissiveTextures = !etfConfig.enableEmissiveTextures;
ETFApi.saveETFConfigChangesAndResetETF();
//etfConfigScreen.saveConfig();
//etfConfigScreen.resetVisuals();
}));
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Emissive Texture Rendering Mode"), (button) -> button.setMessage(etfConfig.fullBrightEmissives ? Text.of("Brighter") : Text.of("Default")), (button) -> {
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.full_bright_emissives.title"), (button) -> button.setMessage(
etfConfig.fullBrightEmissives ? Text.translatable("entity_texture_features.puzzle.emissive_type.brighter") : Text.translatable("entity_texture_features.puzzle.emissive_type.default")), (button) -> {
etfConfig.fullBrightEmissives = !etfConfig.fullBrightEmissives ;
ETFApi.saveETFConfigChangesAndResetETF();
//etfConfigScreen.saveConfig();
//etfConfigScreen.resetVisuals();
}));
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.etf.blinking_mob_settings.title"), (button) -> button.setMessage(etfConfig.enableBlinking ? YES : NO), (button) -> {
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.blinking_mob_settings.title"), (button) -> button.setMessage(etfConfig.enableBlinking ? YES : NO), (button) -> {
etfConfig.enableBlinking = !etfConfig.enableBlinking;
ETFApi.saveETFConfigChangesAndResetETF();
//etfConfigScreen.saveConfig();
//etfConfigScreen.resetVisuals();
}));
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Enable Player Skin Features"), (button) -> button.setMessage(etfConfig.skinFeaturesEnabled ? YES : NO), (button) -> {
PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.translatable("config.entity_texture_features.player_skin_features.title"), (button) -> button.setMessage(etfConfig.skinFeaturesEnabled ? YES : NO), (button) -> {
etfConfig.skinFeaturesEnabled = !etfConfig.skinFeaturesEnabled;
ETFApi.saveETFConfigChangesAndResetETF();
//etfConfigScreen.saveConfig();
//etfConfigScreen.resetVisuals();
}));
}
lateInitDone = true;
Expand Down
17 changes: 0 additions & 17 deletions puzzle-gui/src/main/java/net/puzzlemc/gui/screen/IrisButton.java

This file was deleted.

Loading

0 comments on commit f89fc08

Please sign in to comment.