Search in sources :

Example 1 with ShaderPackScreen

use of net.coderbot.iris.gui.screen.ShaderPackScreen in project Iris by IrisShaders.

the class MixinSodiumOptionsGUI method iris$onSetPage.

@Inject(method = "setPage", at = @At("HEAD"), remap = false, cancellable = true)
private void iris$onSetPage(OptionPage page, CallbackInfo ci) {
    if (page == shaderPacks) {
        minecraft.setScreen(new ShaderPackScreen(this));
        ci.cancel();
    }
}
Also used : ShaderPackScreen(net.coderbot.iris.gui.screen.ShaderPackScreen) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 2 with ShaderPackScreen

use of net.coderbot.iris.gui.screen.ShaderPackScreen in project Iris by IrisShaders.

the class Iris method handleKeybinds.

public static void handleKeybinds(Minecraft minecraft) {
    if (reloadKeybind.consumeClick()) {
        try {
            reload();
            if (minecraft.player != null) {
                minecraft.player.displayClientMessage(new TranslatableComponent("iris.shaders.reloaded"), false);
            }
        } catch (Exception e) {
            logger.error("Error while reloading Shaders for Iris!", e);
            if (minecraft.player != null) {
                minecraft.player.displayClientMessage(new TranslatableComponent("iris.shaders.reloaded.failure", Throwables.getRootCause(e).getMessage()).withStyle(ChatFormatting.RED), false);
            }
        }
    } else if (toggleShadersKeybind.consumeClick()) {
        IrisConfig config = getIrisConfig();
        try {
            config.setShadersEnabled(!config.areShadersEnabled());
            config.save();
            reload();
            if (minecraft.player != null) {
                minecraft.player.displayClientMessage(new TranslatableComponent("iris.shaders.toggled", config.areShadersEnabled() ? currentPackName : "off"), false);
            }
        } catch (Exception e) {
            logger.error("Error while toggling shaders!", e);
            if (minecraft.player != null) {
                minecraft.player.displayClientMessage(new TranslatableComponent("iris.shaders.toggled.failure", Throwables.getRootCause(e).getMessage()).withStyle(ChatFormatting.RED), false);
            }
            setShadersDisabled();
            currentPackName = "(off) [fallback, check your logs for errors]";
        }
    } else if (shaderpackScreenKeybind.consumeClick()) {
        minecraft.setScreen(new ShaderPackScreen(null));
    }
}
Also used : IrisConfig(net.coderbot.iris.config.IrisConfig) TranslatableComponent(net.minecraft.network.chat.TranslatableComponent) ShaderPackScreen(net.coderbot.iris.gui.screen.ShaderPackScreen) NoSuchFileException(java.nio.file.NoSuchFileException) InvalidPathException(java.nio.file.InvalidPathException) ZipException(java.util.zip.ZipException) FileSystemNotFoundException(java.nio.file.FileSystemNotFoundException) IOException(java.io.IOException)

Aggregations

ShaderPackScreen (net.coderbot.iris.gui.screen.ShaderPackScreen)2 IOException (java.io.IOException)1 FileSystemNotFoundException (java.nio.file.FileSystemNotFoundException)1 InvalidPathException (java.nio.file.InvalidPathException)1 NoSuchFileException (java.nio.file.NoSuchFileException)1 ZipException (java.util.zip.ZipException)1 IrisConfig (net.coderbot.iris.config.IrisConfig)1 TranslatableComponent (net.minecraft.network.chat.TranslatableComponent)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1