diff options
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig/internal')
3 files changed, 45 insertions, 1 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java b/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java index 13e34ff..479192d 100644 --- a/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java +++ b/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java @@ -36,7 +36,7 @@ public class OneConfig { public static void preLaunch() { if (preLaunched) return; try { - OneConfig.class.getResourceAsStream("net/minecraft/world/World"); + Class.forName("net.minecraft.world.World"); LOGGER.warn("OneConfig is NOT obfuscated!"); isObfuscated = false; } catch (Exception ignored) { diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java b/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java new file mode 100644 index 0000000..bc1d400 --- /dev/null +++ b/src/main/java/cc/polyfrost/oneconfig/internal/mixin/OptifineConfigMixin.java @@ -0,0 +1,21 @@ +package cc.polyfrost.oneconfig.internal.mixin; + +import cc.polyfrost.oneconfig.internal.plugin.OptifineConfigHook; +import org.spongepowered.asm.mixin.Dynamic; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.Pseudo; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; + +@Pseudo +@Mixin(targets = "Config", remap = false) +public class OptifineConfigMixin { + @Dynamic("OptiFine") + @Inject(method = "isFastRender", at = @At("HEAD"), cancellable = true) + private static void cancelFastRender(CallbackInfoReturnable<Boolean> cir) { + if (OptifineConfigHook.shouldNotApplyFastRender()) { + cir.setReturnValue(false); + } + } +} diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OptifineConfigHook.java b/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OptifineConfigHook.java new file mode 100644 index 0000000..69d1f2e --- /dev/null +++ b/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OptifineConfigHook.java @@ -0,0 +1,23 @@ +package cc.polyfrost.oneconfig.internal.plugin; + +import cc.polyfrost.oneconfig.gui.OneConfigGui; +import cc.polyfrost.oneconfig.libs.universal.UScreen; +import cc.polyfrost.oneconfig.utils.gui.GuiUtils; +import net.minecraft.client.gui.GuiScreen; + +import java.util.Optional; + +public class OptifineConfigHook { + + public static boolean shouldNotApplyFastRender() { + if (UScreen.getCurrentScreen() instanceof OneConfigGui) { + return true; + } + for (Optional<GuiScreen> screen : GuiUtils.getScreenQueue()) { + if (screen.isPresent() && screen.get() instanceof OneConfigGui) { + return true; + } + } + return false; + } +} |