diff --git a/build.gradle b/build.gradle index 6f7778e..c9d818a 100755 --- a/build.gradle +++ b/build.gradle @@ -77,17 +77,6 @@ subprojects { version = rootProject.version } -sourceSets { - testmod { - compileClasspath += main.compileClasspath - runtimeClasspath += main.runtimeClasspath - } - test { - compileClasspath += main.compileClasspath - runtimeClasspath += main.runtimeClasspath - } -} - subprojects.each { remapJar.dependsOn("${it.path}:remapJar") } repositories { @@ -139,7 +128,7 @@ dependencies { modImplementation ("maven.modrinth:continuity:${project.continuity_version}") modImplementation ("maven.modrinth:animatica:${project.animatica_version}") modImplementation ("maven.modrinth:entitytexturefeatures:${project.entitytexturefeatures_version}") - modImplementation ("curse.maven:custom-entity-models-cem-477078:${project.cem_version}") + modImplementation ("maven.modrinth:cem:${project.cem_version}") modImplementation "com.gitlab.Lortseam:completeconfig:${project.complete_config_version}" modImplementation("org.aperlambda:lambdajcommon:1.8.1") { diff --git a/gradle.properties b/gradle.properties index cd9ab16..edd9b19 100755 --- a/gradle.properties +++ b/gradle.properties @@ -3,30 +3,29 @@ org.gradle.jvmargs=-Xmx1G # Fabric Properties # check these on https://fabricmc.net/use - minecraft_version=1.18.1 - yarn_mappings=1.18.1+build.14 - loader_version=0.13.3 + minecraft_version=1.18.2 + yarn_mappings=1.18.2+build.3 + loader_version=0.14.6 # Mod Properties - mod_version = 1.2.2 + mod_version = 1.3.0 maven_group = net.puzzlemc archives_base_name = puzzle # Dependencies # currently not on the main fabric site, check on the maven: https://maven.fabricmc.net/net/fabricmc/fabric-api/fabric-api - fabric_version=0.45.0+1.18 + fabric_version=0.55.1+1.18.2 mod_menu_version = 2.0.13 cull_leaves_version = 2.3.2 ldl_version = 2.1.0+1.17 - lbg_version = 1.2.2+1.17 - iris_version = 1.18.x-v1.1.4 + lbg_version = 1.2.3+1.18 + iris_version = 1.18.x-v1.2.4 continuity_version = 1.0.3+1.18 animatica_version = 0.2+1.18 cit_resewn_version = 1.0.1+1.18.2 - cem_version = 3561474 + cem_version = 0.7.1 complete_config_version = 1.0.0 - spruceui_version=3.3.2+1.17 + spruceui_version=3.3.3+1.18 midnightlib_version=0.4.0 - #update to 3.0 included class renames, ETF will be stable for puzzle usage from here on out entitytexturefeatures_version=3.0.0 diff --git a/puzzle-base/src/main/java/net/puzzlemc/core/PuzzleCore.java b/puzzle-base/src/main/java/net/puzzlemc/core/PuzzleCore.java index 79c2f6f..70ec3c3 100755 --- a/puzzle-base/src/main/java/net/puzzlemc/core/PuzzleCore.java +++ b/puzzle-base/src/main/java/net/puzzlemc/core/PuzzleCore.java @@ -7,7 +7,7 @@ public class PuzzleCore implements ClientModInitializer { - public final static String version = "Puzzle "+ FabricLoader.getInstance().getModContainer("puzzle").get().getMetadata().getVersion(); + public final static String version = "Puzzle "+ (FabricLoader.getInstance().getModContainer("puzzle").isPresent() ? FabricLoader.getInstance().getModContainer("puzzle").get().getMetadata().getVersion() : "Test"); public final static String name = "Puzzle"; public final static String id = "puzzle"; public final static String website = "https://github.com/PuzzleMC/Puzzle"; diff --git a/puzzle-base/src/main/java/net/puzzlemc/core/config/PuzzleConfig.java b/puzzle-base/src/main/java/net/puzzlemc/core/config/PuzzleConfig.java index 451549a..6ca3bca 100755 --- a/puzzle-base/src/main/java/net/puzzlemc/core/config/PuzzleConfig.java +++ b/puzzle-base/src/main/java/net/puzzlemc/core/config/PuzzleConfig.java @@ -13,12 +13,12 @@ public class PuzzleConfig extends MidnightConfig { @Entry public static boolean checkUpdates = true; @Entry public static boolean showPuzzleInfo = true; @Entry public static boolean resourcepackSplashScreen = true; - @Entry public static boolean disableSplashScreenBlend = false; - @Entry public static boolean emissiveTextures = true; + @Entry public static boolean betterSplashScreenBlend = true; @Entry public static boolean unlimitedRotations = true; @Entry public static boolean biggerModels = true; @Entry public static int backgroundColor = 15675965; @Entry public static int progressBarColor = 16777215; + @Entry public static int progressBarBackgroundColor = 15675965; @Entry public static int progressFrameColor = 16777215; } diff --git a/puzzle-base/src/main/java/net/puzzlemc/core/util/ColorUtil.java b/puzzle-base/src/main/java/net/puzzlemc/core/util/ColorUtil.java deleted file mode 100755 index d5a6266..0000000 --- a/puzzle-base/src/main/java/net/puzzlemc/core/util/ColorUtil.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.puzzlemc.core.util; - -import java.awt.*; - -public class ColorUtil { - /** - * @credit https://stackoverflow.com/questions/4129666/how-to-convert-hex-to-rgb-using-java - * @param colorStr e.g. "FFFFFF" - * @return - */ - public static Color hex2Rgb(String colorStr) { - return new Color( - Integer.valueOf( colorStr.substring( 0, 2 ), 16 ), - Integer.valueOf( colorStr.substring( 2, 4 ), 16 ), - Integer.valueOf( colorStr.substring( 4, 6 ), 16 )); - } -} diff --git a/puzzle-gui/build.gradle b/puzzle-gui/build.gradle index c96f6ff..057ed1c 100755 --- a/puzzle-gui/build.gradle +++ b/puzzle-gui/build.gradle @@ -43,7 +43,7 @@ dependencies { modImplementation ("maven.modrinth:iris:${project.iris_version}") modImplementation ("maven.modrinth:cit-resewn:${project.cit_resewn_version}") modImplementation ("maven.modrinth:entitytexturefeatures:${project.entitytexturefeatures_version}") - modImplementation ("curse.maven:custom-entity-models-cem-477078:${project.cem_version}") + modImplementation ("maven.modrinth:cem:${project.cem_version}") modImplementation "com.gitlab.Lortseam:completeconfig:${project.complete_config_version}" modImplementation("org.aperlambda:lambdajcommon:1.8.1") { diff --git a/puzzle-gui/src/main/java/net/puzzlemc/gui/PuzzleClient.java b/puzzle-gui/src/main/java/net/puzzlemc/gui/PuzzleClient.java index 8c6317f..ddd97aa 100755 --- a/puzzle-gui/src/main/java/net/puzzlemc/gui/PuzzleClient.java +++ b/puzzle-gui/src/main/java/net/puzzlemc/gui/PuzzleClient.java @@ -6,6 +6,7 @@ import dev.lambdaurora.lambdynlights.LambDynLights; import eu.midnightdust.cullleaves.config.CullLeavesConfig; import me.pepperbell.continuity.client.config.ContinuityConfig; +import me.pepperbell.continuity.client.config.Option; import net.dorianpb.cem.internal.config.CemConfig; import net.dorianpb.cem.internal.config.CemConfigFairy; import net.dorianpb.cem.internal.config.CemOptions; @@ -19,10 +20,8 @@ import net.minecraft.text.TranslatableText; import net.minecraft.util.Formatting; import net.puzzlemc.splashscreen.PuzzleSplashScreen; -import shcm.shsupercm.fabric.citresewn.CITResewn; import shcm.shsupercm.fabric.citresewn.config.CITResewnConfig; import traben.entity_texture_features.client.ETFClient; -import traben.entity_texture_features.client.utils.ETFUtils; import traben.entity_texture_features.config.ETFConfig; import traben.entity_texture_features.config.ETFConfigScreen; @@ -55,8 +54,8 @@ public void onInitializeClient() { PuzzleSplashScreen.resetColors(); MinecraftClient.getInstance().getTextureManager().registerTexture(PuzzleSplashScreen.LOGO, new PuzzleSplashScreen.LogoTexture()); })); - PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("puzzle.option.disable_splash_screen_blend"), (button) -> button.setMessage(PuzzleConfig.disableSplashScreenBlend ? YES : NO), (button) -> { - PuzzleConfig.disableSplashScreenBlend = !PuzzleConfig.disableSplashScreenBlend; + PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("puzzle.option.better_splash_screen_blend"), (button) -> button.setMessage(PuzzleConfig.betterSplashScreenBlend ? YES : NO), (button) -> { + PuzzleConfig.betterSplashScreenBlend = !PuzzleConfig.betterSplashScreenBlend; PuzzleConfig.write(id); })); } @@ -82,55 +81,8 @@ public void onInitializeClient() { IrisCompat.init(); } - if (FabricLoader.getInstance().isModLoaded("continuity") && !PuzzleConfig.disabledIntegrations.contains("continuity")) { - PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Continuity"))); - ContinuityConfig contConfig = ContinuityConfig.INSTANCE; - PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("options.continuity.disable_ctm"), (button) -> button.setMessage(contConfig.disableCTM.get() ? YES : NO), (button) -> { - contConfig.disableCTM.set(!contConfig.disableCTM.get()); - contConfig.onChange(); - contConfig.save(); - })); - PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("options.continuity.use_manual_culling"), (button) -> button.setMessage(contConfig.useManualCulling.get() ? YES : NO), (button) -> { - contConfig.useManualCulling.set(!contConfig.useManualCulling.get()); - contConfig.onChange(); - contConfig.save(); - })); - } - if (FabricLoader.getInstance().isModLoaded("entity_texture_features") && !PuzzleConfig.disabledIntegrations.contains("entity_texture_features")) { - PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Entity Texture Features"))); - ETFConfig etfConfig = ETFClient.ETFConfigData; - ETFConfigScreen etfConfigScreen = new ETFConfigScreen(); - PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Enable Optifine Random mobs"), (button) -> button.setMessage(etfConfig.enableCustomTextures ? YES : NO), (button) -> { - etfConfig.enableCustomTextures = !etfConfig.enableCustomTextures; - etfConfigScreen.saveConfig(); - etfConfigScreen.resetVisuals(); - })); - PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Enable Optifine Emissive entity textures"), (button) -> button.setMessage(etfConfig.enableEmissiveTextures ? YES : NO), (button) -> { - etfConfig.enableEmissiveTextures = !etfConfig.enableEmissiveTextures; - etfConfigScreen.saveConfig(); - etfConfigScreen.resetVisuals(); - })); - // shader fix no longer required as an option from V3.0 onwards as a solution has been found - // I figure this is a good use of the menu slot, - // it is the most significant feature for emissives added at the same time the shader fix was removed, - // it can impact shader compatability and each option has distinct visual differences. - // see https://github.com/Traben-0/Entity_Texture_Features/blob/master/readMeAssets/EMISSIVE_GUIDE.md - PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Emissive Entity Textures: Rendering Mode"), (button) -> button.setMessage(etfConfig.fullBrightEmissives ? Text.of("Brighter") : Text.of("Default")), (button) -> { - etfConfig.fullBrightEmissives = !etfConfig.fullBrightEmissives ; - etfConfigScreen.saveConfig(); - etfConfigScreen.resetVisuals(); - })); - PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Enable Blinking Mobs"), (button) -> button.setMessage(etfConfig.enableBlinking ? YES : NO), (button) -> { - etfConfig.enableBlinking = !etfConfig.enableBlinking; - etfConfigScreen.saveConfig(); - etfConfigScreen.resetVisuals(); - })); - PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Enable Player Skin Features"), (button) -> button.setMessage(etfConfig.skinFeaturesEnabled ? YES : NO), (button) -> { - etfConfig.skinFeaturesEnabled = !etfConfig.skinFeaturesEnabled; - etfConfigScreen.saveConfig(); - etfConfigScreen.resetVisuals(); - })); - } + + } public static boolean lateInitDone = false; public static void lateInit() { // Some mods are initialized after Puzzle, so we can't access them in our ClientModInitializer @@ -198,6 +150,51 @@ public static void lateInit() { // Some mods are initialized after Puzzle, so we cemConfig.save(); })); } + if (FabricLoader.getInstance().isModLoaded("continuity") && !PuzzleConfig.disabledIntegrations.contains("continuity")) { + PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Continuity"))); + ContinuityConfig contConfig = ContinuityConfig.INSTANCE; + contConfig.getOptionMapView().forEach((s, option) -> { + if (s.equals("use_manual_culling")) return; + try { + Option.BooleanOption booleanOption = ((Option.BooleanOption)option); + PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("options.continuity."+s), (button) -> button.setMessage(booleanOption.get() ? YES : NO), (button) -> { + booleanOption.set(!booleanOption.get()); + contConfig.onChange(); + contConfig.save(); + })); + } catch (Exception ignored) {} + }); + } + if (FabricLoader.getInstance().isModLoaded("entity_texture_features") && !PuzzleConfig.disabledIntegrations.contains("entity_texture_features")) { + PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("config.etf.title"))); + ETFConfig etfConfig = ETFClient.ETFConfigData; + ETFConfigScreen etfConfigScreen = new ETFConfigScreen(); + PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("config.etf.enable_custom_textures.title"), (button) -> button.setMessage(etfConfig.enableCustomTextures ? YES : NO), (button) -> { + etfConfig.enableCustomTextures = !etfConfig.enableCustomTextures; + etfConfigScreen.saveConfig(); + etfConfigScreen.resetVisuals(); + })); + PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("config.etf.enable_emissive_textures.title"), (button) -> button.setMessage(etfConfig.enableEmissiveTextures ? YES : NO), (button) -> { + etfConfig.enableEmissiveTextures = !etfConfig.enableEmissiveTextures; + 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) -> { + etfConfig.fullBrightEmissives = !etfConfig.fullBrightEmissives ; + etfConfigScreen.saveConfig(); + etfConfigScreen.resetVisuals(); + })); + PuzzleApi.addToResourceOptions(new PuzzleWidget(new TranslatableText("config.etf.blinking_mob_settings.title"), (button) -> button.setMessage(etfConfig.enableBlinking ? YES : NO), (button) -> { + etfConfig.enableBlinking = !etfConfig.enableBlinking; + etfConfigScreen.saveConfig(); + etfConfigScreen.resetVisuals(); + })); + PuzzleApi.addToResourceOptions(new PuzzleWidget(Text.of("Enable Player Skin Features"), (button) -> button.setMessage(etfConfig.skinFeaturesEnabled ? YES : NO), (button) -> { + etfConfig.skinFeaturesEnabled = !etfConfig.skinFeaturesEnabled; + etfConfigScreen.saveConfig(); + etfConfigScreen.resetVisuals(); + })); + } lateInitDone = true; } public static Text message(CITResewnConfig config) { diff --git a/puzzle-gui/src/main/java/net/puzzlemc/gui/mixin/MixinOptionsScreen.java b/puzzle-gui/src/main/java/net/puzzlemc/gui/mixin/MixinOptionsScreen.java index 1a21b43..487a6fc 100755 --- a/puzzle-gui/src/main/java/net/puzzlemc/gui/mixin/MixinOptionsScreen.java +++ b/puzzle-gui/src/main/java/net/puzzlemc/gui/mixin/MixinOptionsScreen.java @@ -1,6 +1,9 @@ package net.puzzlemc.gui.mixin; +import eu.midnightdust.core.config.MidnightLibConfig; +import eu.midnightdust.lib.config.MidnightConfig; import eu.midnightdust.lib.util.screen.TexturedOverlayButtonWidget; +import net.fabricmc.loader.api.FabricLoader; import net.minecraft.util.Identifier; import net.puzzlemc.core.config.PuzzleConfig; import net.puzzlemc.gui.PuzzleClient; @@ -25,8 +28,12 @@ protected MixinOptionsScreen(Text title) { } @Inject(at = @At("HEAD"), method = "init") - private void midnightlib$init(CallbackInfo ci) { - if (PuzzleConfig.enablePuzzleButton) - this.addDrawableChild(new TexturedOverlayButtonWidget(this.width / 2 - 178, this.height / 6 - 12, 20, 20, 0, 0, 20, PUZZLE_ICON_TEXTURE, 32, 64, (buttonWidget) -> (Objects.requireNonNull(this.client)).setScreen(new PuzzleOptionsScreen(this)), new TranslatableText("midnightlib.overview.title"))); + private void puzzle$init(CallbackInfo ci) { + if (PuzzleConfig.enablePuzzleButton) { + int i = 0; + if (FabricLoader.getInstance().isModLoaded("lod")) i = i + 358; + if (MidnightLibConfig.config_screen_list.equals(MidnightLibConfig.ConfigButton.FALSE)) i = i - 25; + this.addDrawableChild(new TexturedOverlayButtonWidget(this.width / 2 - 178 + i, this.height / 6 - 12, 20, 20, 0, 0, 20, PUZZLE_ICON_TEXTURE, 32, 64, (buttonWidget) -> (Objects.requireNonNull(this.client)).setScreen(new PuzzleOptionsScreen(this)), new TranslatableText("midnightlib.overview.title"))); + } } } diff --git a/puzzle-gui/src/main/java/net/puzzlemc/gui/screen/widget/PuzzleOptionListWidget.java b/puzzle-gui/src/main/java/net/puzzlemc/gui/screen/widget/PuzzleOptionListWidget.java index 4cb9677..633038b 100755 --- a/puzzle-gui/src/main/java/net/puzzlemc/gui/screen/widget/PuzzleOptionListWidget.java +++ b/puzzle-gui/src/main/java/net/puzzlemc/gui/screen/widget/PuzzleOptionListWidget.java @@ -34,11 +34,11 @@ public void addAll(List buttons) { if (button.buttonType == ButtonType.TEXT) { this.addButton(null, button.descriptionText); } else if (button.buttonType == ButtonType.BUTTON) { - this.addButton(new PuzzleButtonWidget(this.width / 2 - 155 + 160, 0, 150, 20, button.buttonTextAction, button.onPress), button.descriptionText); + 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 - 155 + 160, 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.setSliderValue, button.buttonTextAction, button.changeSliderValue), button.descriptionText); } else if (button.buttonType == ButtonType.TEXT_FIELD) { - this.addButton(new PuzzleTextFieldWidget(textRenderer, this.width / 2 - 155 + 160, 0, 150, 20, button.setTextValue, button.changeTextValue), button.descriptionText); + this.addButton(new PuzzleTextFieldWidget(textRenderer, this.width / 2 + 25, 0, 150, 20, button.setTextValue, button.changeTextValue), button.descriptionText); } else LogManager.getLogger("Puzzle").warn("Button " + button + " is missing the buttonType variable. This shouldn't happen!"); } diff --git a/puzzle-gui/src/main/java/net/puzzlemc/gui/util/ColorUtil.java b/puzzle-gui/src/main/java/net/puzzlemc/gui/util/ColorUtil.java deleted file mode 100755 index c0109fc..0000000 --- a/puzzle-gui/src/main/java/net/puzzlemc/gui/util/ColorUtil.java +++ /dev/null @@ -1,17 +0,0 @@ -package net.puzzlemc.gui.util; - -import java.awt.*; - -public class ColorUtil { - /** - * @credit https://stackoverflow.com/questions/4129666/how-to-convert-hex-to-rgb-using-java - * @param colorStr e.g. "FFFFFF" - * @return - */ - public static Color hex2Rgb(String colorStr) { - return new Color( - Integer.valueOf( colorStr.substring( 0, 2 ), 16 ), - Integer.valueOf( colorStr.substring( 2, 4 ), 16 ), - Integer.valueOf( colorStr.substring( 4, 6 ), 16 )); - } -} diff --git a/puzzle-gui/src/main/resources/fabric.mod.json b/puzzle-gui/src/main/resources/fabric.mod.json index 6ea1871..a50e649 100755 --- a/puzzle-gui/src/main/resources/fabric.mod.json +++ b/puzzle-gui/src/main/resources/fabric.mod.json @@ -42,6 +42,6 @@ }, "breaks": { "citresewn": "<=1.0.0+1.18.2", - "entity_texture_features": "<=3.0.0" + "entity_texture_features": "<3.0.0" } } diff --git a/puzzle-splashscreen/src/main/java/net/puzzlemc/splashscreen/PuzzleSplashScreen.java b/puzzle-splashscreen/src/main/java/net/puzzlemc/splashscreen/PuzzleSplashScreen.java index 3f5c5cb..d8271f3 100755 --- a/puzzle-splashscreen/src/main/java/net/puzzlemc/splashscreen/PuzzleSplashScreen.java +++ b/puzzle-splashscreen/src/main/java/net/puzzlemc/splashscreen/PuzzleSplashScreen.java @@ -1,11 +1,11 @@ package net.puzzlemc.splashscreen; +import eu.midnightdust.lib.util.MidnightColorUtil; import net.fabricmc.api.ClientModInitializer; import net.minecraft.client.texture.NativeImageBackedTexture; import net.minecraft.util.Util; import net.minecraft.util.math.ColorHelper; import net.puzzlemc.core.config.PuzzleConfig; -import net.puzzlemc.core.util.ColorUtil; import net.fabricmc.api.EnvType; import net.fabricmc.api.Environment; import net.fabricmc.fabric.api.resource.ResourceManagerHelper; @@ -41,6 +41,7 @@ public class PuzzleSplashScreen implements ClientModInitializer { public static void resetColors() { PuzzleConfig.backgroundColor = 15675965; PuzzleConfig.progressBarColor = 16777215; + PuzzleConfig.progressBarBackgroundColor = 15675965; PuzzleConfig.progressFrameColor = 16777215; PuzzleConfig.write("puzzle"); } @@ -62,6 +63,9 @@ public Identifier getFabricId() { return new Identifier("puzzle", "splash_screen"); } + public void method_14491(ResourceManager manager) { + reload(manager); + } @Override public void reload(ResourceManager manager) { if (PuzzleConfig.resourcepackSplashScreen) { @@ -74,16 +78,16 @@ public void reload(ResourceManager manager) { properties.load(stream); if (properties.get("screen.loading") != null) { - Color backgroundColorRGB = ColorUtil.hex2Rgb(properties.get("screen.loading").toString()); - PuzzleConfig.backgroundColor = ColorHelper.Argb.getArgb(backgroundColorRGB.getAlpha(), backgroundColorRGB.getRed(), backgroundColorRGB.getGreen(), backgroundColorRGB.getGreen()); + PuzzleConfig.backgroundColor = MidnightColorUtil.hex2Rgb(properties.get("screen.loading").toString()).getRGB(); } if (properties.get("screen.loading.bar") != null) { - Color progressFrameColorRGB = ColorUtil.hex2Rgb(properties.get("screen.loading.bar").toString()); - PuzzleConfig.progressFrameColor = ColorHelper.Argb.getArgb(progressFrameColorRGB.getAlpha(), progressFrameColorRGB.getRed(), progressFrameColorRGB.getGreen(), progressFrameColorRGB.getGreen()); + PuzzleConfig.progressBarBackgroundColor = MidnightColorUtil.hex2Rgb(properties.get("screen.loading.bar").toString()).getRGB(); } if (properties.get("screen.loading.progress") != null) { - Color progressBarColorRGB = ColorUtil.hex2Rgb(properties.get("screen.loading.progress").toString()); - PuzzleConfig.progressBarColor = ColorHelper.Argb.getArgb(progressBarColorRGB.getAlpha(), progressBarColorRGB.getRed(), progressBarColorRGB.getGreen(), progressBarColorRGB.getGreen()); + PuzzleConfig.progressBarColor = MidnightColorUtil.hex2Rgb(properties.get("screen.loading.progress").toString()).getRGB(); + } + if (properties.get("screen.loading.outline") != null) { + PuzzleConfig.progressFrameColor = MidnightColorUtil.hex2Rgb(properties.get("screen.loading.outline").toString()).getRGB(); } if (properties.get("screen.loading") != null) { PuzzleConfig.write("puzzle"); diff --git a/puzzle-splashscreen/src/main/java/net/puzzlemc/splashscreen/mixin/MixinSplashScreen.java b/puzzle-splashscreen/src/main/java/net/puzzlemc/splashscreen/mixin/MixinSplashScreen.java index 8b3054e..3c33cd8 100755 --- a/puzzle-splashscreen/src/main/java/net/puzzlemc/splashscreen/mixin/MixinSplashScreen.java +++ b/puzzle-splashscreen/src/main/java/net/puzzlemc/splashscreen/mixin/MixinSplashScreen.java @@ -1,6 +1,5 @@ package net.puzzlemc.splashscreen.mixin; -import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.screen.Overlay; @@ -16,26 +15,21 @@ import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.ModifyArg; +import org.spongepowered.asm.mixin.injection.*; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; +import java.util.function.IntSupplier; @Mixin(value = SplashOverlay.class, priority = 2000) public abstract class MixinSplashScreen extends Overlay { @Shadow @Final static Identifier LOGO; @Shadow private long reloadCompleteTime; - @Shadow @Final private MinecraftClient client; - - @Shadow private long reloadStartTime; - @Inject(method = "init(Lnet/minecraft/client/MinecraftClient;)V", at = @At("TAIL")) - private static void init(MinecraftClient client, CallbackInfo ci) { // Load our custom textures at game start // + private static void puzzle$initSplashscreen(MinecraftClient client, CallbackInfo ci) { // Load our custom textures at game start // if (PuzzleConfig.resourcepackSplashScreen && PuzzleSplashScreen.LOGO_TEXTURE.toFile().exists()) { try { InputStream input = new FileInputStream(String.valueOf(PuzzleSplashScreen.LOGO_TEXTURE)); @@ -43,48 +37,42 @@ private static void init(MinecraftClient client, CallbackInfo ci) { // Load our } catch (IOException ignored) {} } } - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/SplashOverlay;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V", shift = At.Shift.AFTER, ordinal = 0)) - private void modifyBackgroundColor(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { // Set the Background Color to our configured value // + @Redirect(method = "render", at = @At(value = "INVOKE", target = "Ljava/util/function/IntSupplier;getAsInt()I")) + private int puzzle$modifyBackground(IntSupplier instance) { // Set the Progress Bar Frame Color to our configured value // + return PuzzleConfig.backgroundColor | 255 << 24; + } + @Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;blendFunc(II)V", shift = At.Shift.AFTER), remap = false) + private void puzzle$betterBlend(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { + if (PuzzleConfig.betterSplashScreenBlend) RenderSystem.defaultBlendFunc(); + } + @Inject(method = "renderProgressBar", at = @At("HEAD")) + private void puzzle$addProgressBarBackground(MatrixStack matrices, int minX, int minY, int maxX, int maxY, float opacity, CallbackInfo ci) { + RenderSystem.disableBlend(); + if (!PuzzleConfig.resourcepackSplashScreen || PuzzleConfig.progressBarBackgroundColor == 15675965) return; long l = Util.getMeasuringTimeMs(); float f = this.reloadCompleteTime > -1L ? (float)(l - this.reloadCompleteTime) / 1000.0F : -1.0F; int m = MathHelper.ceil((1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F)) * 255.0F); - if (PuzzleConfig.resourcepackSplashScreen && PuzzleConfig.backgroundColor != 15675965) - fill(matrices, 0, 0, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight(), withAlpha(PuzzleConfig.backgroundColor, m)); + fill(matrices, minX, minY, maxX, maxY, withAlpha(PuzzleConfig.progressBarBackgroundColor, m)); } - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/SplashOverlay;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V", shift = At.Shift.AFTER, ordinal = 1)) - private void modifyBackgroundColor2(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { // Set the Background Color to our configured value // + @Inject(method = "renderProgressBar", at = @At("TAIL")) + private void puzzle$fixProgressBarEnd(MatrixStack matrices, int minX, int minY, int maxX, int maxY, float opacity, CallbackInfo ci) { // For some reason the end of the progressbar is colored wrong + if (!PuzzleConfig.resourcepackSplashScreen || PuzzleConfig.progressFrameColor == 16777215) return; long l = Util.getMeasuringTimeMs(); - float g = this.reloadStartTime > -1L ? (float)(l - this.reloadStartTime) / 500.0F : -1.0F; - int m = MathHelper.ceil(MathHelper.clamp(g, 0.15D, 1.0D) * 255.0D); - if (PuzzleConfig.resourcepackSplashScreen && PuzzleConfig.backgroundColor != 15675965) - fill(matrices, 0, 0, client.getWindow().getScaledWidth(), client.getWindow().getScaledHeight(), withAlpha(PuzzleConfig.backgroundColor, m)); - } - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;_clear(IZ)V", shift = At.Shift.AFTER)) - private void modifyBackgroundColor3(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { // Set the Background Color to our configured value // - if (PuzzleConfig.resourcepackSplashScreen && PuzzleConfig.backgroundColor != 15675965) { - int m = PuzzleConfig.backgroundColor; - float p = (float) (m >> 16 & 255) / 255.0F; - float q = (float) (m >> 8 & 255) / 255.0F; - float r = (float) (m & 255) / 255.0F; - GlStateManager._clearColor(p, q, r, 1.0F); - GlStateManager._clear(16384, MinecraftClient.IS_SYSTEM_MAC); - } - } - @Inject(method = "render", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;enableBlend()V", shift = At.Shift.AFTER), remap = false) - private void disableBlend(MatrixStack matrices, int mouseX, int mouseY, float delta, CallbackInfo ci) { - if (PuzzleConfig.disableSplashScreenBlend) RenderSystem.disableBlend(); + float f = this.reloadCompleteTime > -1L ? (float)(l - this.reloadCompleteTime) / 1000.0F : -1.0F; + int m = MathHelper.ceil((1.0F - MathHelper.clamp(f - 1.0F, 0.0F, 1.0F)) * 255.0F); + fill(matrices, maxX-1, minY, maxX, maxY, withAlpha(PuzzleConfig.progressFrameColor, m)); } @ModifyArg(method = "renderProgressBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/SplashOverlay;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V"), index = 5) - private int modifyProgressFrame(int color) { // Set the Progress Bar Frame Color to our configured value // + private int puzzle$modifyProgressFrame(int color) { // Set the Progress Bar Frame Color to our configured value // return PuzzleConfig.progressFrameColor | 255 << 24; } @ModifyArg(method = "renderProgressBar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/screen/SplashOverlay;fill(Lnet/minecraft/client/util/math/MatrixStack;IIIII)V", ordinal = 4), index = 5) - private int modifyProgressColor(int color) { // Set the Progress Bar Color to our configured value // + private int puzzle$modifyProgressColor(int color) { // Set the Progress Bar Color to our configured value // return PuzzleConfig.progressBarColor | 255 << 24; } private static int withAlpha(int color, int alpha) { - return color & 16777215 | alpha << 24; + return color & 0xFFFFFF | alpha << 24; } } diff --git a/src/main/resources/assets/puzzle/lang/de_de.json b/src/main/resources/assets/puzzle/lang/de_de.json index c87b4dc..129c189 100644 --- a/src/main/resources/assets/puzzle/lang/de_de.json +++ b/src/main/resources/assets/puzzle/lang/de_de.json @@ -8,10 +8,10 @@ "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.disable_splash_screen_blend":"Deaktiviere das Überblenden des Splash-Screen-Logos", + "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 Einstellungen" + "puzzle.midnightconfig.title":"Erweiterte Puzzle Konfiguration" } \ No newline at end of file diff --git a/src/main/resources/assets/puzzle/lang/en_us.json b/src/main/resources/assets/puzzle/lang/en_us.json index 8b681e4..872f2f5 100755 --- a/src/main/resources/assets/puzzle/lang/en_us.json +++ b/src/main/resources/assets/puzzle/lang/en_us.json @@ -8,7 +8,7 @@ "puzzle.option.check_for_updates":"Check for Updates", "puzzle.option.show_version_info":"Show Puzzle version info", "puzzle.option.resourcepack_splash_screen":"Use resourcepack splash screen", - "puzzle.option.disable_splash_screen_blend":"Disable splash screen logo blending", + "puzzle.option.better_splash_screen_blend":"Better splash screen logo blending", "puzzle.option.emissive_textures":"Emissive Textures", "puzzle.option.unlimited_model_rotations":"Unlimited Model Rotations", "puzzle.option.bigger_custom_models":"Bigger Custom Models",