Skip to content

Commit

Permalink
Changes for Angelica
Browse files Browse the repository at this point in the history
  • Loading branch information
jss2a98aj committed Apr 19, 2024
1 parent 1057bea commit 643ebb5
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 51 deletions.
9 changes: 8 additions & 1 deletion src/main/java/jss/notfine/config/NotFineConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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,
Expand Down
5 changes: 4 additions & 1 deletion src/main/java/jss/notfine/gui/NotFineGameOptionPages.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"))
Expand All @@ -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"))
Expand Down
68 changes: 32 additions & 36 deletions src/main/java/jss/notfine/mixinplugin/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ public List<String> getMixins(Set<String> 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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/jss/notfine/mixinplugin/TargetedMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
6 changes: 6 additions & 0 deletions src/main/java/jss/notfine/proxy/ClientProxy.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 643ebb5

Please sign in to comment.