Core followups (#1445)

This commit is contained in:
Jason Mitchell authored and GitHub committed 2026-03-05 11:35:05 -08:00
1 parent 2fecb3a05b
commit 379330f997
14 files changed
+135 -82

No files matched your search

@@ -239,4 +239,15 @@ public class AngelicaConfig {
@Config.DefaultBoolean(true)
public static boolean replaceFFPUploads;
@Config.Comment("Pinned OpenGL version an integer (e.g. 46, 41, 33). 0 = auto-detect. [33, 46]. (Disable with disableGLVersionPinning=true)")
@Config.DefaultInt(0)
@Config.RangeInt(min = 0, max = 46)
@Config.RequiresMcRestart
public static int pinnedGLVersion;
@Config.Comment("Disable automatic GL version pinning. When true, always probes from highest on every launch.")
@Config.DefaultBoolean(false)
@Config.RequiresMcRestart
public static boolean disableGLVersionPinning;
}
@@ -1537,6 +1537,7 @@ public class GLStateManager {
}
}
alphaTest.enable();
fragmentGeneration++;
}
public static void disableAlphaTest() {
@@ -1554,6 +1555,7 @@ public class GLStateManager {
}
}
alphaTest.disable();
fragmentGeneration++;
}
public static void glAlphaFunc(int function, float reference) {
@@ -6,7 +6,9 @@ import net.minecraft.launchwrapper.Launch;
import net.minecraft.launchwrapper.LaunchClassLoader;
import java.io.File;
import java.lang.reflect.Field;
import java.util.List;
import java.util.Set;
public class AngelicaLateTweaker implements ITweaker {
@@ -17,7 +19,41 @@ public class AngelicaLateTweaker implements ITweaker {
@Override
public void injectIntoClassLoader(LaunchClassLoader classLoader) {
// no-op
narrowTransformerExclusions(classLoader);
}
/**
* Reduces overly broad transformer exclusions that prevent AngelicaRedirector from doing its job.
*
* Looking at you, DragonAPI.
*/
@SuppressWarnings("unchecked")
private static void narrowTransformerExclusions(LaunchClassLoader classLoader) {
try {
final Field exceptionsField = LaunchClassLoader.class.getDeclaredField("transformerExceptions");
exceptionsField.setAccessible(true);
final Set<String> exceptions = (Set<String>) exceptionsField.get(classLoader);
if (exceptions.remove("Reika.DragonAPI.ASM")) {
// Don't read ASMCallsClient and Patchers/Fixes/WorldRenderAlpha. The rest are fair game.
// Re-add the other non utility classes
exceptions.add("Reika.DragonAPI.ASM.Patchers");
exceptions.add("Reika.DragonAPI.ASM.Profiling");
exceptions.add("Reika.DragonAPI.ASM.APIStripper");
exceptions.add("Reika.DragonAPI.ASM.ClassReparenter");
exceptions.add("Reika.DragonAPI.ASM.DependentMethodStripper");
exceptions.add("Reika.DragonAPI.ASM.DragonAPIClassTransformer");
exceptions.add("Reika.DragonAPI.ASM.FMLItemBlockPatch");
exceptions.add("Reika.DragonAPI.ASM.FluidNamePatch");
exceptions.add("Reika.DragonAPI.ASM.InterfaceInjector");
exceptions.add("Reika.DragonAPI.ASM.SpecialBiomePlacement");
exceptions.add("Reika.DragonAPI.ASM.StructureLootHooks");
FMLRelaunchLog.info("[Angelica] Narrowed Reika.DragonAPI.ASM transformer exclusion to allow GL redirection of utility classes");
}
} catch (Exception e) {
FMLRelaunchLog.warning("[Angelica] Failed to narrow transformer exclusions: %s", e.getMessage());
}
}
@Override
@@ -283,7 +283,7 @@ public class ReeseSodiumVideoOptionsScreen extends SodiumOptionsGUI {
}
if (keyCode == Keyboard.KEY_P) {
if(isShiftKeyDown()){
this.mc.displayGuiScreen(new GuiCustomMenu(this.prevScreen, SodiumGameOptionPages.general(), SodiumGameOptionPages.quality(), SodiumGameOptionPages.advanced(), SodiumGameOptionPages.performance(), SodiumGameOptionPages.appearance(), SodiumGameOptionPages.debug()));
this.mc.displayGuiScreen(new GuiCustomMenu(this.prevScreen, SodiumGameOptionPages.general(), SodiumGameOptionPages.quality(), SodiumGameOptionPages.advanced(), SodiumGameOptionPages.performance(), SodiumGameOptionPages.appearance()));
} else if (isCtrlKeyDown()) {
this.mc.displayGuiScreen(new SodiumOptionsGUI(this.prevScreen));
}
@@ -540,20 +540,4 @@ public class SodiumGameOptionPages {
return new OptionPage(I18n.format("sodium.options.pages.appearance"), ImmutableList.copyOf(groups));
}
public static OptionPage debug() {
final List<OptionGroup> groups = new ArrayList<>();
groups.add(OptionGroup.createBuilder()
.add(OptionImpl.createBuilder(boolean.class, sodiumOpts)
.setName(I18n.format("sodium.options.use_gl_state_cache.name"))
.setTooltip(I18n.format("sodium.options.use_gl_state_cache.tooltip"))
.setControl(TickBoxControl::new)
.setImpact(OptionImpact.EXTREME)
.setBinding((opts, value) -> GLStateManager.BYPASS_CACHE = !value, opts -> !GLStateManager.BYPASS_CACHE)
.setFlags(OptionFlag.REQUIRES_RENDERER_RELOAD)
.build())
.build());
return new OptionPage(I18n.format("sodium.options.pages.debug"), ImmutableList.copyOf(groups));
}
}
@@ -77,7 +77,6 @@ public class SodiumOptionsGUI extends ScrollableGuiScreen {
this.pages.add(shaderPacks);
}
this.pages.add(SodiumGameOptionPages.debug());
}
public void setPage(OptionPage page) {
@@ -302,7 +301,7 @@ public class SodiumOptionsGUI extends ScrollableGuiScreen {
if (keyCode == Keyboard.KEY_P && isShiftKeyDown()) {
this.mc.displayGuiScreen(new GuiCustomMenu(this.prevScreen, SodiumGameOptionPages.general(),
SodiumGameOptionPages.quality(), SodiumGameOptionPages.advanced(), SodiumGameOptionPages.performance(),
SodiumGameOptionPages.appearance(), SodiumGameOptionPages.debug()));
SodiumGameOptionPages.appearance()));
}
}
@@ -1,27 +0,0 @@
package me.jellysquid.mods.sodium.client.gui.utils;
import com.gtnewhorizons.angelica.AngelicaMod;
import net.minecraft.util.Util;
import java.io.IOException;
public class URLUtils {
private static String[] getURLOpenCommand(String url) {
return switch (Util.getOSType()) {
case WINDOWS -> new String[]{"rundll32", "url.dll,FileProtocolHandler", url};
case OSX -> new String[]{"open", url};
case UNKNOWN, LINUX, SOLARIS -> new String[]{"xdg-open", url};
};
}
public static void open(String url) {
try {
Runtime.getRuntime().exec(getURLOpenCommand(url));
} catch (IOException exception) {
AngelicaMod.LOGGER.error("Couldn't open url '{}'", url, exception);
}
}
}