From 643ebb5030b8a1cf2617a901417d7c4b6590acd1 Mon Sep 17 00:00:00 2001 From: jss2a98aj Date: Fri, 19 Apr 2024 10:32:02 -0400 Subject: [PATCH] Changes for Angelica --- .../jss/notfine/config/NotFineConfig.java | 9 ++- .../notfine/gui/NotFineGameOptionPages.java | 5 +- .../java/jss/notfine/mixinplugin/Mixins.java | 68 +++++++++---------- .../mixinplugin/NotFineEarlyMixins.java | 3 +- .../jss/notfine/mixinplugin/TargetedMod.java | 2 +- .../java/jss/notfine/proxy/ClientProxy.java | 6 ++ .../control/ControlValueFormatter.java | 11 +-- 7 files changed, 53 insertions(+), 51 deletions(-) diff --git a/src/main/java/jss/notfine/config/NotFineConfig.java b/src/main/java/jss/notfine/config/NotFineConfig.java index 0161e15..1a22990 100644 --- a/src/main/java/jss/notfine/config/NotFineConfig.java +++ b/src/main/java/jss/notfine/config/NotFineConfig.java @@ -12,6 +12,9 @@ public class NotFineConfig { public static final String CATEGORY_TOGGLE = "toggle"; public static boolean allowAdvancedOpenGL; + public static boolean allowToggle3DAnaglyph; + public static boolean allowToggleFBO; + public static boolean betterBlockFaceCulling; @@ -20,7 +23,11 @@ public static void loadSettings() { Configuration notFineConfig = new Configuration(configFile); allowAdvancedOpenGL = notFineConfig.getBoolean("allowAdvancedOpenGL", CATEGORY_GENERAL, false, - "Allow or always disable Advanced OpenGL"); + "Allow Advanced OpenGL to be enabled when it might be supported."); + allowToggle3DAnaglyph = notFineConfig.getBoolean("allowToggle3DAnaglyph", CATEGORY_GENERAL, true, + "Allow 3D Anaglyph to be enabled."); + allowToggleFBO = notFineConfig.getBoolean("allowToggleFBO", CATEGORY_GENERAL, false, + "Allow FBOs to be disabled."); notFineConfig.setCategoryComment(CATEGORY_TOGGLE, "Enable or disable various mod features."); betterBlockFaceCulling = notFineConfig.getBoolean("betterBlockFaceCulling", CATEGORY_TOGGLE, true, diff --git a/src/main/java/jss/notfine/gui/NotFineGameOptionPages.java b/src/main/java/jss/notfine/gui/NotFineGameOptionPages.java index 76465de..078ca39 100644 --- a/src/main/java/jss/notfine/gui/NotFineGameOptionPages.java +++ b/src/main/java/jss/notfine/gui/NotFineGameOptionPages.java @@ -87,11 +87,12 @@ public static OptionPage general() { .build()) .build()); + int maxGuiScale = Math.max(3, Math.min(Minecraft.getMinecraft().displayWidth / 320, Minecraft.getMinecraft().displayHeight / 240)); groups.add(OptionGroup.createBuilder() .add(OptionImpl.createBuilder(int.class, vanillaOpts) .setName(I18n.format("options.guiScale")) .setTooltip(I18n.format("sodium.options.gui_scale.tooltip")) - .setControl(option -> new SliderControl(option, 0, 4, 1, ControlValueFormatter.guiScale())) + .setControl(option -> new SliderControl(option, 0, maxGuiScale, 1, ControlValueFormatter.guiScale())) .setBinding((opts, value) -> opts.guiScale = value, opts -> opts.guiScale) .build()) .add(OptionImpl.createBuilder(boolean.class, vanillaOpts) @@ -205,6 +206,7 @@ public static OptionPage other() { .setTooltip(I18n.format("sodium.options.fbo.tooltip")) .setControl(TickBoxControl::new) .setBinding((opts, value) -> opts.fboEnable = value, opts -> opts.fboEnable) + .setEnabled(NotFineConfig.allowToggleFBO) .build()) .add(OptionImpl.createBuilder(boolean.class, vanillaOpts) .setName(I18n.format("options.anaglyph")) @@ -213,6 +215,7 @@ public static OptionPage other() { .setBinding((opts, value) -> opts.anaglyph = value, opts -> opts.anaglyph) .setImpact(OptionImpact.HIGH) .setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD) + .setEnabled(NotFineConfig.allowAdvancedOpenGL) .build()) .add(OptionImpl.createBuilder(boolean.class, vanillaOpts) .setName(I18n.format("options.showCape")) diff --git a/src/main/java/jss/notfine/mixinplugin/Mixins.java b/src/main/java/jss/notfine/mixinplugin/Mixins.java index a922894..ff8860e 100644 --- a/src/main/java/jss/notfine/mixinplugin/Mixins.java +++ b/src/main/java/jss/notfine/mixinplugin/Mixins.java @@ -13,9 +13,9 @@ // Adapted from Hodgepodge public enum Mixins { - NOTFINE(new Builder("NotFine") + NOTFINE_CORE(new Builder("NotFine") .setPhase(Phase.EARLY) - .setApplyIf(() -> NotFineConfig.betterBlockFaceCulling) + .setApplyIf(() -> true) .addTargetedMod(TargetedMod.VANILLA) .addMixinClasses(addPrefix("minecraft.", "clouds.MixinEntityRenderer", @@ -70,6 +70,15 @@ public enum Mixins { .addExcludedMod(TargetedMod.DYNAMIC_SURROUNDINGS_ORIGINAL) .addMixinClasses("minecraft.toggle.MixinEntityRenderer$RenderRainSnow") ), + NO_CUSTOM_ITEM_TEXTURES(new Builder("No Custom Item Textures") + .setPhase(Phase.EARLY) + .setApplyIf(() -> !MCPatcherForgeConfig.instance().customItemTexturesEnabled) + .addTargetedMod(TargetedMod.VANILLA) + .addMixinClasses(addPrefix("minecraft.glint.", + "MixinItemRenderer", + "MixinRenderItem" + )) + ), THAUMCRAFT(new Builder("Thaumcraft compat") .setPhase(Phase.LATE) .setApplyIf(() -> true) @@ -92,7 +101,7 @@ public enum Mixins { .addTargetedMod(TargetedMod.WITCHERY) .addMixinClasses("leaves.witchery.MixinBlockWitchLeaves") ), - MCPATCHER_FORGE(new Builder("MCPatcher Forge base mixins") + MCPATCHER_FORGE(new Builder("MCPatcher Forge") .setPhase(Phase.EARLY) .setApplyIf(() -> true) .addTargetedMod(TargetedMod.VANILLA) @@ -113,7 +122,7 @@ public enum Mixins { "renderpass.MixinWorldRenderer" )) ), - CUSTOM_COLORS(new Builder("Custom colors") + MCPATCHER_FORGE_CUSTOM_COLORS(new Builder("MCP:F Custom Colors") .setPhase(Phase.EARLY) .setApplyIf(() -> MCPatcherForgeConfig.instance().customColorsEnabled) .addTargetedMod(TargetedMod.VANILLA) @@ -169,16 +178,7 @@ public enum Mixins { "world.MixinWorldProviderHell" )) ), - NO_CUSTOM_ITEM_TEXTURES(new Builder("Custom Item Textures") - .setPhase(Phase.EARLY) - .setApplyIf(() -> !MCPatcherForgeConfig.instance().customItemTexturesEnabled) - .addTargetedMod(TargetedMod.VANILLA) - .addMixinClasses(addPrefix("minecraft.glint.", - "MixinItemRenderer", - "MixinRenderItem" - )) - ), - CUSTOM_ITEM_TEXTURES(new Builder("Custom Item Textures") + MCPATCHER_FORGE_CUSTOM_ITEM_TEXTURES(new Builder("MCP:F Custom Item Textures") .setPhase(Phase.EARLY) .setApplyIf(() -> MCPatcherForgeConfig.instance().customItemTexturesEnabled) .addTargetedMod(TargetedMod.VANILLA) @@ -197,13 +197,13 @@ public enum Mixins { "world.MixinWorld" )) ), - CONNECTED_TEXTURES(new Builder("Connected Textures") + MCPATCHER_FORGE_CONNECTED_TEXTURES(new Builder("MCP:F Connected Textures") .setPhase(Phase.EARLY) .setApplyIf(() -> MCPatcherForgeConfig.instance().connectedTexturesEnabled) .addTargetedMod(TargetedMod.VANILLA) .addMixinClasses("mcpatcherforge.ctm.MixinRenderBlocks") ), - EXTENDED_HD(new Builder("Extended hd") + MCPATCHER_FORGE_EXTENDED_HD(new Builder("MCP:F Extended hd") .setPhase(Phase.EARLY) .setApplyIf(() -> MCPatcherForgeConfig.instance().extendedHDEnabled) .addTargetedMod(TargetedMod.VANILLA) @@ -213,14 +213,14 @@ public enum Mixins { "MixinTextureManager" )) ), - HD_FONT(new Builder("HD Font") + MCPATCHER_FORGE_EXTENDED_HD_FONT(new Builder("MCP:F Extended HD Font") .setPhase(Phase.EARLY) .setApplyIf(() -> (MCPatcherForgeConfig.instance().extendedHDEnabled && MCPatcherForgeConfig.instance().hdFont)) .addTargetedMod(TargetedMod.VANILLA) - .addExcludedMod(TargetedMod.COFH_CORE) + .addExcludedMod(TargetedMod.COFHCORE) .addMixinClasses("mcpatcherforge.hd.MixinFontRenderer") ), - RANDOM_MOBS(new Builder("Random Mobs") + MCPATCHER_FORGE_RANDOM_MOBS(new Builder("MCP:F Random Mobs") .setPhase(Phase.EARLY) .setApplyIf(() -> MCPatcherForgeConfig.instance().randomMobsEnabled) .addTargetedMod(TargetedMod.VANILLA) @@ -237,7 +237,7 @@ public enum Mixins { "MixinEntityLivingBase" )) ), - SKY(new Builder("Sky") + MCPATCHER_FORGE_SKY(new Builder("MCP:F Sky") .setPhase(Phase.EARLY) .setApplyIf(() -> MCPatcherForgeConfig.instance().betterSkiesEnabled) .addTargetedMod(TargetedMod.VANILLA) @@ -246,34 +246,30 @@ public enum Mixins { "MixinRenderGlobal" )) ), - CC_NO_CTM(new Builder("Custom colors, no connected textures") + MCPATCHER_FORGE_CC_NO_CTM(new Builder("MCP:F Custom Colors, no Connected Textures") .setPhase(Phase.EARLY) - .setApplyIf( - () -> !MCPatcherForgeConfig.instance().connectedTexturesEnabled + .setApplyIf(() -> !MCPatcherForgeConfig.instance().connectedTexturesEnabled && MCPatcherForgeConfig.instance().customColorsEnabled) .addTargetedMod(TargetedMod.VANILLA) .addMixinClasses("mcpatcherforge.cc_ctm.MixinRenderBlocksNoCTM") ), - CTM_AND_CC(new Builder("Connected textures and Custom Colors enabled") + MCPATCHER_FORGE_CTM_NO_CC(new Builder("MCP:F Connected Textures, no Custom Colours") .setPhase(Phase.EARLY) - .setApplyIf( - () -> MCPatcherForgeConfig.instance().connectedTexturesEnabled - && MCPatcherForgeConfig.instance().customColorsEnabled) + .setApplyIf(() -> MCPatcherForgeConfig.instance().connectedTexturesEnabled + && !MCPatcherForgeConfig.instance().customColorsEnabled) .addTargetedMod(TargetedMod.VANILLA) - .addMixinClasses("mcpatcherforge.ctm_cc.MixinRenderBlocks") + .addMixinClasses("mcpatcherforge.ctm_cc.MixinRenderBlocksNoCC") ), - CTM_NO_CC(new Builder("Connected textures, no custom colours") + MCPATCHER_FORGE_CTM_AND_CC(new Builder("MCP:F Connected Textures and Custom Colors") .setPhase(Phase.EARLY) - .setApplyIf( - () -> MCPatcherForgeConfig.instance().connectedTexturesEnabled - && !MCPatcherForgeConfig.instance().customColorsEnabled) + .setApplyIf(() -> MCPatcherForgeConfig.instance().connectedTexturesEnabled + && MCPatcherForgeConfig.instance().customColorsEnabled) .addTargetedMod(TargetedMod.VANILLA) - .addMixinClasses("mcpatcherforge.ctm_cc.MixinRenderBlocksNoCC") + .addMixinClasses("mcpatcherforge.ctm_cc.MixinRenderBlocks") ), - CTM_OR_CC(new Builder("Connected textures or Custom Colors enabled") + MCPATCHER_FORGE_CTM_OR_CC(new Builder("MCP:F Connected Textures or Custom Colors") .setPhase(Phase.EARLY) - .setApplyIf( - () -> MCPatcherForgeConfig.instance().connectedTexturesEnabled + .setApplyIf(() -> MCPatcherForgeConfig.instance().connectedTexturesEnabled || MCPatcherForgeConfig.instance().customColorsEnabled) .addTargetedMod(TargetedMod.VANILLA) .addMixinClasses("mcpatcherforge.ctm_cc.MixinTextureMap") diff --git a/src/main/java/jss/notfine/mixinplugin/NotFineEarlyMixins.java b/src/main/java/jss/notfine/mixinplugin/NotFineEarlyMixins.java index 0b0f6b2..eca08cc 100644 --- a/src/main/java/jss/notfine/mixinplugin/NotFineEarlyMixins.java +++ b/src/main/java/jss/notfine/mixinplugin/NotFineEarlyMixins.java @@ -38,8 +38,7 @@ public List getMixins(Set loadedCoreMods) { return mixins; } NotFineConfig.loadSettings(); - - //This may be possible to handle differently. + //This may be possible to handle differently or fix. if(loadedCoreMods.contains("cofh.asm.LoadingPlugin")) { MCPatcherForgeConfig.instance().hdFont = false; } diff --git a/src/main/java/jss/notfine/mixinplugin/TargetedMod.java b/src/main/java/jss/notfine/mixinplugin/TargetedMod.java index 9a68c21..1181307 100644 --- a/src/main/java/jss/notfine/mixinplugin/TargetedMod.java +++ b/src/main/java/jss/notfine/mixinplugin/TargetedMod.java @@ -3,7 +3,7 @@ // Adapted from hodgepodge public enum TargetedMod { - COFH_CORE("CoFHCore", "cofh.asm.LoadingPlugin", "CoFHCore"), + COFHCORE("CoFHCore", "cofh.asm.LoadingPlugin", "CoFHCore"), DYNAMIC_SURROUNDINGS_MIST("Dynamic Surroundings", "org.blockartistry.mod.DynSurround.mixinplugin.DynamicSurroundingsEarlyMixins", "dsurround"), DYNAMIC_SURROUNDINGS_ORIGINAL("Dynamic Surroundings", "org.blockartistry.mod.DynSurround.asm.TransformLoader", "dsurround"), THAUMCRAFT("Thaumcraft", null, "Thaumcraft"), diff --git a/src/main/java/jss/notfine/proxy/ClientProxy.java b/src/main/java/jss/notfine/proxy/ClientProxy.java index e59f07d..7f6ea3c 100644 --- a/src/main/java/jss/notfine/proxy/ClientProxy.java +++ b/src/main/java/jss/notfine/proxy/ClientProxy.java @@ -21,6 +21,12 @@ public void preInit(FMLPreInitializationEvent event) { if(!NotFineConfig.allowAdvancedOpenGL) { Minecraft.getMinecraft().gameSettings.advancedOpengl = false; } + if(!NotFineConfig.allowToggle3DAnaglyph) { + Minecraft.getMinecraft().gameSettings.anaglyph = false; + } + if(!NotFineConfig.allowToggleFBO) { + Minecraft.getMinecraft().gameSettings.fboEnable = true; + } for(Settings setting : Settings.values()) { setting.ready(); diff --git a/src/main/java/me/jellysquid/mods/sodium/client/gui/options/control/ControlValueFormatter.java b/src/main/java/me/jellysquid/mods/sodium/client/gui/options/control/ControlValueFormatter.java index 255aec6..69c4548 100644 --- a/src/main/java/me/jellysquid/mods/sodium/client/gui/options/control/ControlValueFormatter.java +++ b/src/main/java/me/jellysquid/mods/sodium/client/gui/options/control/ControlValueFormatter.java @@ -3,17 +3,8 @@ import net.minecraft.client.resources.I18n; public interface ControlValueFormatter { - - String[] GUISCALES = new String[] { - "options.guiScale.auto", - "options.guiScale.small", - "options.guiScale.normal", - "options.guiScale.large", - "options.guiScale.massive" - }; - static ControlValueFormatter guiScale() { - return (v) -> (v < GUISCALES.length) ? I18n.format(GUISCALES[v]) : I18n.format(v + "x"); + return (v) -> (v == 0) ? I18n.format("options.guiScale.auto") : I18n.format(v + "x"); } static ControlValueFormatter fpsLimit() {