mirror of
https://github.com/PuzzleMC/Puzzle.git
synced 2025-12-15 19:35:10 +01:00
Puzzle 1.4.0 - Fixes, Integrations & Tooltip
- 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
This commit is contained in:
@@ -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}"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}"
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
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;
|
||||
|
||||
@@ -12,11 +14,11 @@ 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));
|
||||
}));
|
||||
|
||||
@@ -4,7 +4,13 @@ import dev.lambdaurora.lambdabettergrass.LBGConfig;
|
||||
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;
|
||||
@@ -22,6 +28,7 @@ import net.puzzlemc.splashscreen.PuzzleSplashScreen;
|
||||
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 {
|
||||
|
||||
@@ -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) -> {
|
||||
@@ -65,12 +73,102 @@ public class PuzzleClient implements ClientModInitializer {
|
||||
}
|
||||
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();
|
||||
}
|
||||
@@ -108,7 +206,7 @@ public class PuzzleClient implements ClientModInitializer {
|
||||
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 {
|
||||
@@ -157,38 +255,28 @@ public class PuzzleClient implements ClientModInitializer {
|
||||
});
|
||||
}
|
||||
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;
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package net.puzzlemc.gui.screen;
|
||||
|
||||
import net.coderbot.iris.gui.screen.ShaderPackScreen;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.DrawableHelper;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.client.gui.widget.ButtonWidget;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class IrisButton extends DrawableHelper {
|
||||
public static ButtonWidget getButton(int x, int y, int width, int height, Screen parent, MinecraftClient client) {
|
||||
ShaderPackScreen shaderPackPage = new ShaderPackScreen(parent);
|
||||
return new ButtonWidget(x, y, width, height, shaderPackPage.getTitle().copy().append("..."), (button) ->
|
||||
Objects.requireNonNull(client).setScreen(shaderPackPage));
|
||||
}
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
package net.puzzlemc.gui.screen;
|
||||
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
|
||||
public class LoadingScreenBackgrond {
|
||||
public static void render(MinecraftClient client, MatrixStack matrices, int width, int height, float delta) {
|
||||
// if (client.world != null) {
|
||||
// LogManager.getLogManager().getLogger("Puzzle").info(client.world.getDimension().toString());
|
||||
// }
|
||||
// client.getTextureManager().bindTexture(new Identifier("minecraft","optifine/gui/loading/background0.png"));
|
||||
// DrawableHelper.drawTexture(matrices,0,0,width,height,0,0,width,height,width,height);
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package net.puzzlemc.gui.screen;
|
||||
|
||||
import net.minecraft.screen.ScreenTexts;
|
||||
import net.minecraft.text.Text;
|
||||
import net.puzzlemc.gui.PuzzleApi;
|
||||
import net.puzzlemc.gui.PuzzleClient;
|
||||
import net.puzzlemc.gui.screen.page.GraphicsPage;
|
||||
import net.puzzlemc.gui.screen.page.MiscPage;
|
||||
@@ -30,13 +31,10 @@ public class PuzzleOptionsScreen extends Screen {
|
||||
PerformancePage performancePage = new PerformancePage(this);
|
||||
ResourcesPage resourcesPage = new ResourcesPage(this);
|
||||
|
||||
this.addDrawableChild(new ButtonWidget(this.width / 2 - 155, this.height / 6 + 48 - 6, 150, 20, graphicsPage.getTitle().copy().append("..."), (button) -> Objects.requireNonNull(client).setScreen(graphicsPage)));
|
||||
this.addDrawableChild(new ButtonWidget(this.width / 2 + 5, this.height / 6 + 48 - 6, 150, 20, resourcesPage.getTitle().copy().append("..."), (button) -> Objects.requireNonNull(client).setScreen(resourcesPage)));
|
||||
this.addDrawableChild(new ButtonWidget(this.width / 2 - 155, this.height / 6 + 72 - 6, 150, 20, performancePage.getTitle().copy().append("..."), (button) -> Objects.requireNonNull(client).setScreen(performancePage)));
|
||||
this.addDrawableChild(new ButtonWidget(this.width / 2 + 5, this.height / 6 + 72 - 6, 150, 20, miscPage.getTitle().copy().append("..."), (button) -> Objects.requireNonNull(client).setScreen(miscPage)));
|
||||
// if (FabricLoader.getInstance().isModLoaded("iris")) {
|
||||
// this.addDrawableChild(IrisButton.getButton(this.width / 2 - 155, this.height / 6 + 96 - 6, 310, 20, this, client));
|
||||
// }
|
||||
if (!PuzzleApi.GRAPHICS_OPTIONS.isEmpty()) this.addDrawableChild(new ButtonWidget(this.width / 2 - 155, this.height / 6 + 48 - 6, 150, 20, graphicsPage.getTitle().copy().append("..."), (button) -> Objects.requireNonNull(client).setScreen(graphicsPage)));
|
||||
if (!PuzzleApi.RESOURCE_OPTIONS.isEmpty()) this.addDrawableChild(new ButtonWidget(this.width / 2 + 5, this.height / 6 + 48 - 6, 150, 20, resourcesPage.getTitle().copy().append("..."), (button) -> Objects.requireNonNull(client).setScreen(resourcesPage)));
|
||||
if (!PuzzleApi.PERFORMANCE_OPTIONS.isEmpty()) this.addDrawableChild(new ButtonWidget(this.width / 2 - 155, this.height / 6 + 72 - 6, 150, 20, performancePage.getTitle().copy().append("..."), (button) -> Objects.requireNonNull(client).setScreen(performancePage)));
|
||||
if (!PuzzleApi.MISC_OPTIONS.isEmpty()) this.addDrawableChild(new ButtonWidget(this.width / 2 + 5, this.height / 6 + 72 - 6, 150, 20, miscPage.getTitle().copy().append("..."), (button) -> Objects.requireNonNull(client).setScreen(miscPage)));
|
||||
this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, this.height / 6 + 168, 200, 20, ScreenTexts.DONE, (button) -> Objects.requireNonNull(client).setScreen(parent)));
|
||||
}
|
||||
|
||||
|
||||
@@ -12,8 +12,9 @@ import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public abstract class AbstractPuzzleOptionsPage extends Screen {
|
||||
private PuzzleOptionListWidget list;
|
||||
public PuzzleOptionListWidget list;
|
||||
private final List<PuzzleWidget> options;
|
||||
public List<Text> tooltip = null;
|
||||
|
||||
public AbstractPuzzleOptionsPage(Screen parent, Text title, List<PuzzleWidget> options) {
|
||||
super(title);
|
||||
@@ -41,5 +42,12 @@ public abstract class AbstractPuzzleOptionsPage extends Screen {
|
||||
|
||||
drawCenteredText(matrices, textRenderer, title, width/2, 15, 0xFFFFFF);
|
||||
super.render(matrices, mouseX, mouseY, delta);
|
||||
if (tooltip != null) {
|
||||
if (this.list.getFocused() != null && (this.list.getHoveredEntry() == null || this.list.getHoveredEntry().button == null || !this.list.getHoveredEntry().button.isMouseOver(mouseX, mouseY))) {
|
||||
renderTooltip(matrices, tooltip, this.list.getFocused().getX() + this.list.getFocused().getWidth(), this.list.getFocused().getY() + (this.list.getFocused().getHeight() * 2));
|
||||
}
|
||||
else renderTooltip(matrices, tooltip, mouseX, mouseY);
|
||||
}
|
||||
tooltip = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,8 +8,11 @@ import net.minecraft.client.gui.Element;
|
||||
import net.minecraft.client.gui.Selectable;
|
||||
import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.gui.widget.ElementListWidget;
|
||||
import net.minecraft.client.resource.language.I18n;
|
||||
import net.minecraft.client.util.math.MatrixStack;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableTextContent;
|
||||
import net.puzzlemc.gui.screen.page.AbstractPuzzleOptionsPage;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
|
||||
import java.util.*;
|
||||
@@ -35,7 +38,7 @@ public class PuzzleOptionListWidget extends ElementListWidget<PuzzleOptionListWi
|
||||
} else if (button.buttonType == ButtonType.BUTTON) {
|
||||
this.addButton(new PuzzleButtonWidget(this.width / 2 + 25, 0, 150, 20, button.buttonTextAction, button.onPress), button.descriptionText);
|
||||
} else if (button.buttonType == ButtonType.SLIDER) {
|
||||
this.addButton(new PuzzleSliderWidget(button.min, button.max, this.width / 2 + 25, 0, 150, 20, button.setSliderValue, button.buttonTextAction, button.changeSliderValue), button.descriptionText);
|
||||
this.addButton(new PuzzleSliderWidget(button.min, button.max, this.width / 2 + 25, 0, 150, 20, button.defaultSliderValue.getAsInt(), button.buttonTextAction, button.changeSliderValue), button.descriptionText);
|
||||
} else if (button.buttonType == ButtonType.TEXT_FIELD) {
|
||||
this.addButton(new PuzzleTextFieldWidget(textRenderer, this.width / 2 + 25, 0, 150, 20, button.setTextValue, button.changeTextValue), button.descriptionText);
|
||||
} else
|
||||
@@ -51,15 +54,21 @@ public class PuzzleOptionListWidget extends ElementListWidget<PuzzleOptionListWi
|
||||
return super.getScrollbarPositionX() + 60;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ButtonEntry getHoveredEntry() {
|
||||
return super.getHoveredEntry();
|
||||
}
|
||||
|
||||
public static class ButtonEntry extends ElementListWidget.Entry<ButtonEntry> {
|
||||
private static final TextRenderer textRenderer = MinecraftClient.getInstance().textRenderer;
|
||||
private List<ClickableWidget> buttons = new ArrayList<>();
|
||||
private final ClickableWidget button;
|
||||
private final Text text;
|
||||
public final ClickableWidget button;
|
||||
public final Text text;
|
||||
private MinecraftClient client = MinecraftClient.getInstance();
|
||||
|
||||
private ButtonEntry(ClickableWidget button, Text text) {
|
||||
if (button != null)
|
||||
this.buttons.add(button);
|
||||
this.buttons.add(button);
|
||||
this.button = button;
|
||||
this.text = text;
|
||||
}
|
||||
@@ -75,6 +84,37 @@ public class PuzzleOptionListWidget extends ElementListWidget<PuzzleOptionListWi
|
||||
}
|
||||
if (button == null) drawCenteredText(matrices,textRenderer, Text.literal("------ ").append(text).append(" ------"),x + 200,y+5,0xFFFFFF);
|
||||
else drawTextWithShadow(matrices,textRenderer, text,x+15,y+5,0xFFFFFF);
|
||||
|
||||
if (!(client.currentScreen instanceof AbstractPuzzleOptionsPage page)) return;
|
||||
if (button != null && (button.isMouseOver(mouseX, mouseY) || ((page.list.getHoveredEntry() == null || page.list.getHoveredEntry().button == null || !page.list.getHoveredEntry().button.isMouseOver(mouseX, mouseY)) && button.isFocused())) && text.getContent() instanceof TranslatableTextContent content) {
|
||||
String key = null;
|
||||
if (I18n.hasTranslation(content.getKey() + ".tooltip")) key = content.getKey() + ".tooltip";
|
||||
else if (I18n.hasTranslation(content.getKey() + ".desc")) key = content.getKey() + ".desc";
|
||||
if (key == null && content.getKey().endsWith(".title")) {
|
||||
String strippedContent = content.getKey().substring(0, content.getKey().length()-6);
|
||||
if (I18n.hasTranslation(strippedContent + ".tooltip")) key = strippedContent + ".tooltip";
|
||||
else if (I18n.hasTranslation(strippedContent + ".desc")) key = strippedContent + ".desc";
|
||||
}
|
||||
|
||||
if (key != null) {
|
||||
List<Text> list = new ArrayList<>();
|
||||
for (String str : I18n.translate(key).split("\n"))
|
||||
list.add(Text.literal(str));
|
||||
page.tooltip = list;
|
||||
}
|
||||
}
|
||||
}
|
||||
public int getY() {
|
||||
return button.y;
|
||||
}
|
||||
public int getX() {
|
||||
return button.x;
|
||||
}
|
||||
public int getHeight() {
|
||||
return button.getHeight();
|
||||
}
|
||||
public int getWidth() {
|
||||
return button.getWidth();
|
||||
}
|
||||
|
||||
public List<? extends Element> children() {
|
||||
|
||||
@@ -9,13 +9,12 @@ public class PuzzleSliderWidget extends SliderWidget {
|
||||
private final PuzzleWidget.TextAction setTextAction;
|
||||
private final PuzzleWidget.ChangeSliderValueAction changeAction;
|
||||
|
||||
public PuzzleSliderWidget(int min, int max, int x, int y, int width, int height, PuzzleWidget.SetSliderValueAction setValueAction, PuzzleWidget.TextAction setTextAction, PuzzleWidget.ChangeSliderValueAction changeAction) {
|
||||
super(x,y,width,height,Text.of(""),0);
|
||||
public PuzzleSliderWidget(int min, int max, int x, int y, int width, int height, float defaultValue, PuzzleWidget.TextAction setTextAction, PuzzleWidget.ChangeSliderValueAction changeAction) {
|
||||
super(x,y,width,height,Text.of(""),(defaultValue-min) / (max - min));
|
||||
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
|
||||
setValueAction.setSliderValue(this);
|
||||
this.setTextAction = setTextAction;
|
||||
this.changeAction = changeAction;
|
||||
this.updateMessage();
|
||||
|
||||
@@ -7,16 +7,17 @@ import net.minecraft.client.gui.widget.ClickableWidget;
|
||||
import net.minecraft.client.gui.widget.TextFieldWidget;
|
||||
import net.minecraft.text.Text;
|
||||
|
||||
import java.util.function.IntSupplier;
|
||||
|
||||
public class PuzzleWidget {
|
||||
public ButtonType buttonType;
|
||||
public int min;
|
||||
public int max;
|
||||
public Text descriptionText;
|
||||
public Text buttonText;
|
||||
public TextAction buttonTextAction;
|
||||
public ButtonWidget.PressAction onPress;
|
||||
public PuzzleWidget.SetTextValueAction setTextValue;
|
||||
public PuzzleWidget.SetSliderValueAction setSliderValue;
|
||||
public IntSupplier defaultSliderValue;
|
||||
public PuzzleWidget.ChangeTextValueAction changeTextValue;
|
||||
public PuzzleWidget.ChangeSliderValueAction changeSliderValue;
|
||||
|
||||
@@ -42,22 +43,24 @@ public class PuzzleWidget {
|
||||
this.onPress = onPress;
|
||||
}
|
||||
/**
|
||||
* Puzzle Slider Widget Container (WIP - Doesn't work)
|
||||
* Puzzle Slider Widget Container
|
||||
*/
|
||||
public PuzzleWidget(int min, int max, Text descriptionText, PuzzleWidget.SetSliderValueAction setValueAction, PuzzleWidget.TextAction setTextAction, PuzzleWidget.ChangeSliderValueAction changeAction) {
|
||||
public PuzzleWidget(int min, int max, Text descriptionText, IntSupplier defaultSliderValue, PuzzleWidget.TextAction setTextAction, PuzzleWidget.ChangeSliderValueAction changeAction) {
|
||||
this.buttonType = ButtonType.SLIDER;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.descriptionText = descriptionText;
|
||||
this.setSliderValue = setValueAction;
|
||||
this.defaultSliderValue = defaultSliderValue;
|
||||
this.buttonTextAction = setTextAction;
|
||||
this.changeSliderValue = changeAction;
|
||||
}
|
||||
/**
|
||||
* Puzzle Text Field Widget Container (WIP - Doesn't work)
|
||||
*/
|
||||
public PuzzleWidget(Text descriptionText, PuzzleWidget.SetTextValueAction setValue, ChangeTextValueAction changeAction, int a) {
|
||||
public PuzzleWidget(int min, int max, Text descriptionText, PuzzleWidget.SetTextValueAction setValue, ChangeTextValueAction changeAction) {
|
||||
this.buttonType = ButtonType.TEXT_FIELD;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.descriptionText = descriptionText;
|
||||
this.setTextValue = setValue;
|
||||
this.changeTextValue = changeAction;
|
||||
@@ -75,10 +78,6 @@ public class PuzzleWidget {
|
||||
void setTextValue(TextFieldWidget textField);
|
||||
}
|
||||
@Environment(EnvType.CLIENT)
|
||||
public interface SetSliderValueAction {
|
||||
void setSliderValue(PuzzleSliderWidget slider);
|
||||
}
|
||||
@Environment(EnvType.CLIENT)
|
||||
public interface TextAction {
|
||||
void setTitle(ClickableWidget button);
|
||||
}
|
||||
|
||||
@@ -6,12 +6,34 @@
|
||||
"puzzle.page.performance":"Performance Einstellungen",
|
||||
"puzzle.page.misc":"Sonstige Einstellungen",
|
||||
"puzzle.option.check_for_updates":"Auf Updates überprüfen",
|
||||
"puzzle.option.show_version_info":"Zeige Puzzles Versions Informationen",
|
||||
"puzzle.option.resourcepack_splash_screen":"Nutzte den Resourcepack-splash-Screen",
|
||||
"puzzle.option.show_version_info":"Zeige Informationen über Puzzle's Version",
|
||||
"puzzle.option.resourcepack_splash_screen":"Nutze Resourcepack-Ladebildschirm",
|
||||
"puzzle.option.better_splash_screen_blend":"Verbessere das Blending des Splash-Screen-Logos",
|
||||
"puzzle.option.emissive_textures":"Emissive Texturen",
|
||||
"puzzle.option.unlimited_model_rotations":"Unbegrenzte Modellrotationen",
|
||||
"puzzle.option.bigger_custom_models":"Größere benutzerdefinierte Modelle",
|
||||
"puzzle.option.render_layer_overrides":"Render Layer Overrides",
|
||||
"puzzle.midnightconfig.title":"Erweiterte Puzzle Konfiguration"
|
||||
"puzzle.midnightconfig.title":"Erweiterte Puzzle Konfiguration",
|
||||
"puzzle.option.check_for_updates.tooltip": "Aktiviert Puzzle's eingebauten Update-Checker",
|
||||
"puzzle.option.show_version_info.tooltip": "Zeigt Informationen über die Version\nvon Puzzle und die Verfügbarkeit von Updates\nauf dem Titelbildschirm und im F3-Menü",
|
||||
"puzzle.option.resourcepack_splash_screen.tooltip": "Ermöglicht Resourcepacks, das Aussehen\ndes Ladebildschirms mit dem\nOptiFine-Format zu verändern",
|
||||
"puzzle.option.better_splash_screen_blend.tooltip": "Ändert die Art des Blending,\ndie für das Logo auf dem Ladebildschirm benutzt wird,\ndamit es besser mit farbigen Logos funktioniert.",
|
||||
"puzzle.option.unlimited_model_rotations.tooltip": "Schaltet volle 360° Rotation für\nbenutzerdefinierte Item-/Blockmodelle frei",
|
||||
"puzzle.option.bigger_custom_models.tooltip": "Erhöht das Größenlimit für\nbenutzerdefinierte Item-/Blockmodelle\nvon 3x3x3 auf 5x5x5",
|
||||
"puzzle.midnightconfig.tooltip": "Optionen für fortgeschrittene Nutzer",
|
||||
|
||||
"cullleaves.puzzle.option.enabled": "Aktiviere Culling für Blätter",
|
||||
"cullleaves.puzzle.option.enabled.tooltip": "Fügt Occlusion Culling für \nBlätter hinzu, was die Leistung des \nSpiels verbessert",
|
||||
"iris.puzzle.option.enableShaders": "Shader aktivieren",
|
||||
"iris.puzzle.option.enableShaders.tooltip": "Legt fest, ob Shader aktiviert werden sollen",
|
||||
"iris.puzzle.option.open": "ÖFFNEN",
|
||||
"options.iris.shaderPackSelection.tooltip": "Öffnet einen Bildschirm, um Shader\nauszuwählen und zu konfigurieren",
|
||||
"lambdabettergrass.option.mode.tooltip": "Verbindet die Seiten von Grasblöcken\nmit anliegenden Grasblöcken",
|
||||
"lambdabettergrass.option.better_snow.tooltip": "Fügt eine rein visuelle Schnee-/Moosschicht\nunter nicht-volle Blöcke hinzu,\nwelche von Schnee/Moos umgeben sind",
|
||||
"config.dynamicfps.reduce_when_unfocused.tooltip": "Reduziert Minecraft's FPS,\nwährend das Spiel nicht im Fokus ist\n(z.B. wenn ein anderes Fenster fokussiert oder das Spiel versteckt ist)\num Strom und Systemressourcen zu sparen",
|
||||
"config.dynamicfps.unfocused_fps.tooltip": "Die Anzahl der Bilder pro Sekunde (FPS)\nmit denen Minecraft rendern\ndarf, wenn es nicht im Fokus ist",
|
||||
"config.dynamicfps.restore_when_hovered.tooltip": "Legt fest, ob die Limitierung\nder FPS aufgehoben werden soll, wenn Minecraft in der Vorschau erscheint\n(z.B. in der Taskleiste oder Dock überfahren wird)",
|
||||
"config.dynamicfps.run_gc_on_unfocus.tooltip": "Lässt einen Garbage Collector laufen,\nwährend Minecraft nicht im Fokus ist\num etwas Arbeitsspeicher (RAM) freizumachen",
|
||||
"config.dynamicfps.unfocused_volume.tooltip": "Die Lautstärke mit der Minecraft\nGeräusche wiedergeben kann, während es nicht im Fokus ist\n(z.B. wenn ein anderes Fenster fokussiert ist)",
|
||||
"config.dynamicfps.hidden_volume.tooltip": "Die Lautstärke mit der Minecraft\nGeräusche wiedergeben kann, während es nicht im Fokus ist\n(z.B. wenn es minimiert, von anderen Fenstern verdeckt\noder auf einem anderen virtuellen Desktop ist)",
|
||||
"entity_texture_features.puzzle.emissive_type.brighter": "§eHeller",
|
||||
"entity_texture_features.puzzle.emissive_type.default": "§6Normal"
|
||||
}
|
||||
@@ -6,12 +6,34 @@
|
||||
"puzzle.page.performance":"Performance Settings",
|
||||
"puzzle.page.misc":"Miscellaneous Settings",
|
||||
"puzzle.option.check_for_updates":"Check for Updates",
|
||||
"puzzle.option.check_for_updates.tooltip":"Enables Puzzle's built-in update checker",
|
||||
"puzzle.option.show_version_info":"Show Puzzle version info",
|
||||
"puzzle.option.show_version_info.tooltip":"Show information about the current\nPuzzle version and update status on\nthe Title Screen and F3 Menu",
|
||||
"puzzle.option.resourcepack_splash_screen":"Use resourcepack splash screen",
|
||||
"puzzle.option.resourcepack_splash_screen.tooltip":"Enables resourcepacks to change the look\nof Minecraft's loading/splash\nscreen using the OptiFine format",
|
||||
"puzzle.option.better_splash_screen_blend":"Better splash screen logo blending",
|
||||
"puzzle.option.emissive_textures":"Emissive Textures",
|
||||
"puzzle.option.better_splash_screen_blend.tooltip":"Changes the type of blending used\nby the logo on the splash screen\nto work better with custom colored logos",
|
||||
"puzzle.option.unlimited_model_rotations":"Unlimited Model Rotations",
|
||||
"puzzle.option.unlimited_model_rotations.tooltip":"Unlocks full 360° rotation on custom block/item models",
|
||||
"puzzle.option.bigger_custom_models":"Bigger Custom Models",
|
||||
"puzzle.option.render_layer_overrides":"Render Layer Overrides",
|
||||
"puzzle.midnightconfig.title":"Puzzle Advanced Config"
|
||||
"puzzle.option.bigger_custom_models.tooltip":"Increases the limit of\ncustom block/item model sizes\nfrom 3x3x3 to 5x5x5",
|
||||
"puzzle.midnightconfig.title":"Puzzle Advanced Config",
|
||||
"puzzle.midnightconfig.tooltip":"Options for advanced users only",
|
||||
|
||||
"cullleaves.puzzle.option.enabled": "Cull Leaves",
|
||||
"cullleaves.puzzle.option.enabled.tooltip": "Enable the culling of leaves to enhance performance",
|
||||
"iris.puzzle.option.enableShaders": "Enable Shaders",
|
||||
"iris.puzzle.option.enableShaders.tooltip": "Whether or not to enable shaderpacks",
|
||||
"iris.puzzle.option.open": "OPEN",
|
||||
"options.iris.shaderPackSelection.tooltip": "Open a screen to select\nshaderpacks and configure them",
|
||||
"lambdabettergrass.option.mode.tooltip": "Makes the sides of\ngrass blocks connect to\nadjacent grass blocks",
|
||||
"lambdabettergrass.option.better_snow.tooltip": "Adds a purely visual snow/moss layer\nto non-full blocks that\nare surrounded by snow/moss",
|
||||
"config.dynamicfps.reduce_when_unfocused.tooltip": "Reduces Minecraft's FPS when unfocused\n(i.e. another window is focused or the game is hidden)\nto save power and system resources",
|
||||
"config.dynamicfps.unfocused_fps.tooltip": "The amount of frames per second\nMinecraft is allowed to\nrender at while unfocused",
|
||||
"config.dynamicfps.restore_when_hovered.tooltip": "Whether or not to stop the\nFPS limiting while Minecraft is previewed\n(i.e. hovered on task bar or dock)",
|
||||
"config.dynamicfps.run_gc_on_unfocus.tooltip": "Run a garbage collector while\nMinecraft is not focused to\nfree up some RAM",
|
||||
"config.dynamicfps.unfocused_volume.tooltip": "The volume the game should play\nsound at while unfocused\n(i.e. another window is selected)",
|
||||
"config.dynamicfps.hidden_volume.tooltip": "The volume the game should play\nsound at while not visible\n(i.e. minimized, covered by other windows\nor on another virtual desktop)",
|
||||
"entity_texture_features.puzzle.emissive_type.brighter": "§eBrighter",
|
||||
"entity_texture_features.puzzle.emissive_type.default": "§6Default"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user