mirror of
https://github.com/PuzzleMC/Puzzle.git
synced 2025-12-17 12:25:10 +01:00
Puzzle 1.1.0 - Use IrisAPI, Deactivatable Integrations, Remove puzzle-blocks
- Use the new Iris API - Builtin mod support is now configurable - Puzzle button in Options screen can be disabled - Remove puzzle-blocks (Already covered by Continuity) - Fix #4 - Fix #5 - Fix #6 - Fix #7
This commit is contained in:
@@ -1,41 +1,25 @@
|
||||
package net.puzzlemc.gui;
|
||||
|
||||
import net.coderbot.iris.Iris;
|
||||
import net.coderbot.iris.config.IrisConfig;
|
||||
import net.coderbot.iris.gui.screen.ShaderPackScreen;
|
||||
import net.fabricmc.loader.api.FabricLoader;
|
||||
import net.irisshaders.iris.api.v0.IrisApi;
|
||||
import net.irisshaders.iris.api.v0.IrisApiConfig;
|
||||
import net.minecraft.client.MinecraftClient;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
import net.minecraft.text.Text;
|
||||
import net.minecraft.text.TranslatableText;
|
||||
import net.puzzlemc.gui.screen.widget.PuzzleWidget;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class IrisCompat {
|
||||
public static void init() {
|
||||
if (FabricLoader.getInstance().isModLoaded("iris")) {
|
||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.of("Iris")));
|
||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.of("Enable Shaders"), (button) -> button.setMessage(Iris.getIrisConfig().areShadersEnabled() ? PuzzleClient.YES : PuzzleClient.NO), (button) -> {
|
||||
IrisConfig irisConfig = Iris.getIrisConfig();
|
||||
irisConfig.setShadersEnabled(!irisConfig.areShadersEnabled());
|
||||
try {
|
||||
Iris.getIrisConfig().save();
|
||||
} catch (IOException e) {
|
||||
Iris.logger.error("Error saving configuration file!");
|
||||
Iris.logger.catching(e);
|
||||
}
|
||||
|
||||
try {
|
||||
Iris.reload();
|
||||
} catch (IOException e) {
|
||||
Iris.logger.error("Error reloading shader pack while applying changes!");
|
||||
Iris.logger.catching(e);
|
||||
}
|
||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(Text.of("Enable Shaders"), (button) -> button.setMessage(IrisApi.getInstance().getConfig().areShadersEnabled() ? PuzzleClient.YES : PuzzleClient.NO), (button) -> {
|
||||
IrisApiConfig irisConfig = IrisApi.getInstance().getConfig();
|
||||
irisConfig.setShadersEnabledAndApply(!irisConfig.areShadersEnabled());
|
||||
}));
|
||||
PuzzleApi.addToGraphicsOptions(new PuzzleWidget(new TranslatableText("options.iris.shaderPackSelection.title"), (button) -> button.setMessage(Text.of("OPEN")), (button) -> {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
ShaderPackScreen shaderPackPage = new ShaderPackScreen(client.currentScreen);
|
||||
client.setScreen(shaderPackPage);
|
||||
client.setScreen((Screen) IrisApi.getInstance().openMainIrisScreenObj(client.currentScreen));
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user