From 106ae58d2b363471ff33c5f7868b78ca2bb34cfd Mon Sep 17 00:00:00 2001 From: IMS212 Date: Sat, 18 Nov 2023 10:36:00 -1000 Subject: [PATCH 1/7] Fix option translations --- .../compat/sodium/impl/options/IrisSodiumOptions.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/options/IrisSodiumOptions.java b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/options/IrisSodiumOptions.java index 300f8635b4..0946846038 100644 --- a/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/options/IrisSodiumOptions.java +++ b/src/sodiumCompatibility/java/net/coderbot/iris/compat/sodium/impl/options/IrisSodiumOptions.java @@ -22,7 +22,7 @@ public static OptionImpl createMaxShadowDistanceSlider(Minecra OptionImpl maxShadowDistanceSlider = OptionImpl.createBuilder(int.class, vanillaOpts) .setName(new TranslatableComponent("options.iris.shadowDistance")) .setTooltip(new TranslatableComponent("options.iris.shadowDistance.sodium_tooltip")) - .setControl(option -> new SliderControl(option, 0, 32, 1, ControlValueFormatter.quantityOrDisabled("Chunks", "Disabled"))) + .setControl(option -> new SliderControl(option, 0, 32, 1, translateVariableOrDisabled("options.chunks", "Disabled"))) .setBinding((options, value) -> { IrisVideoSettings.shadowDistance = value; try { @@ -64,13 +64,19 @@ public static OptionImpl createColorSpaceButton(MinecraftOp return colorSpace; } + static ControlValueFormatter translateVariableOrDisabled(String key, String disabled) { + return (v) -> { + return v == 0 ? disabled : (new TranslatableComponent(key, v)).getString(); + }; + } + public static OptionImpl createLimitedVideoSettingsButton(MinecraftOptionsStorage vanillaOpts) { return OptionImpl.createBuilder(SupportedGraphicsMode.class, vanillaOpts) .setName(new TranslatableComponent("options.graphics")) // TODO: State that Fabulous Graphics is incompatible with Shader Packs in the tooltip .setTooltip(new TranslatableComponent("sodium.options.graphics_quality.tooltip")) .setControl(option -> new CyclingControl<>(option, SupportedGraphicsMode.class, - new Component[] { new TextComponent("Fast"), new TextComponent("Fancy") })) + new Component[] { new TranslatableComponent("options.graphics.fast"), new TranslatableComponent("options.graphics.fancy") })) .setBinding( (opts, value) -> opts.graphicsMode = value.toVanilla(), opts -> SupportedGraphicsMode.fromVanilla(opts.graphicsMode)) From b7482042b50b738cae787663a3a3779758bd6e81 Mon Sep 17 00:00:00 2001 From: IMS212 Date: Sun, 19 Nov 2023 09:14:01 -1000 Subject: [PATCH 2/7] Minor fix for biome uniforms --- .../java/net/coderbot/iris/shaderpack/ShaderProperties.java | 2 +- .../java/net/coderbot/iris/uniforms/custom/CustomUniforms.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/net/coderbot/iris/shaderpack/ShaderProperties.java b/src/main/java/net/coderbot/iris/shaderpack/ShaderProperties.java index 32bb6eddf8..2d7f220599 100644 --- a/src/main/java/net/coderbot/iris/shaderpack/ShaderProperties.java +++ b/src/main/java/net/coderbot/iris/shaderpack/ShaderProperties.java @@ -113,7 +113,7 @@ private ShaderProperties() { // TODO: Is there a better solution than having ShaderPack pass a root path to ShaderProperties to be able to read textures? public ShaderProperties(String contents, ShaderPackOptions shaderPackOptions, Iterable environmentDefines, Iterable replacements) { for (StringPair pair : replacements) { - contents = contents.replace(pair.getKey(), pair.getValue()); + contents = contents.replaceAll("\\b" + pair.getKey() + "\\b", pair.getValue()); } String preprocessedContents = PropertiesPreprocessor.preprocessSource(contents, shaderPackOptions, environmentDefines); diff --git a/src/main/java/net/coderbot/iris/uniforms/custom/CustomUniforms.java b/src/main/java/net/coderbot/iris/uniforms/custom/CustomUniforms.java index f0feb91279..c898f352a5 100644 --- a/src/main/java/net/coderbot/iris/uniforms/custom/CustomUniforms.java +++ b/src/main/java/net/coderbot/iris/uniforms/custom/CustomUniforms.java @@ -306,7 +306,7 @@ public void addVariable(String type, String name, String expression, boolean isU ExpressionElement ast = Parser.parse(expression, IrisOptions.options); variables.put(name, new Variable(parsedType, name, ast, isUniform)); } catch (Exception e) { - Iris.logger.warn("Failed to parse custom variable/uniform", e); + Iris.logger.warn("Failed to parse custom variable/uniform " + name + " with expression " + expression, e); } } From a4a85e524d0e993eb93ab5b9fb2fc96a24747f45 Mon Sep 17 00:00:00 2001 From: IMS212 Date: Tue, 21 Nov 2023 18:37:20 -1000 Subject: [PATCH 3/7] Fix entityId in core shaders --- .../transform/transformer/VanillaCoreTransformer.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/coderbot/iris/pipeline/transform/transformer/VanillaCoreTransformer.java b/src/main/java/net/coderbot/iris/pipeline/transform/transformer/VanillaCoreTransformer.java index c03af75be8..4b838304bf 100644 --- a/src/main/java/net/coderbot/iris/pipeline/transform/transformer/VanillaCoreTransformer.java +++ b/src/main/java/net/coderbot/iris/pipeline/transform/transformer/VanillaCoreTransformer.java @@ -18,7 +18,10 @@ public static void transform( VanillaParameters parameters) { if (parameters.inputs.hasOverlay()) { - AttributeTransformer.patchOverlayColor(t, tree, root, parameters); + if (!parameters.inputs.isText()) { + AttributeTransformer.patchOverlayColor(t, tree, root, parameters); + } + AttributeTransformer.patchEntityId(t, tree, root, parameters); } CommonTransformer.transform(t, tree, root, parameters, true); From 04c2e0c65f5490c3d4d7258426a74a7ca3e66dd9 Mon Sep 17 00:00:00 2001 From: IMS212 Date: Tue, 21 Nov 2023 21:01:11 -0800 Subject: [PATCH 4/7] Remove old Sodium/NEC code --- src/main/java/net/coderbot/iris/Iris.java | 30 ------- .../coderbot/iris/mixin/MixinTitleScreen.java | 79 +------------------ 2 files changed, 3 insertions(+), 106 deletions(-) diff --git a/src/main/java/net/coderbot/iris/Iris.java b/src/main/java/net/coderbot/iris/Iris.java index 460bd9739d..c543735a80 100644 --- a/src/main/java/net/coderbot/iris/Iris.java +++ b/src/main/java/net/coderbot/iris/Iris.java @@ -71,9 +71,6 @@ public class Iris { private static ShaderPack currentPack; private static String currentPackName; - private static boolean sodiumInvalid; - private static boolean hasNEC; - private static boolean sodiumInstalled; private static boolean initialized; private static PipelineManager pipelineManager; @@ -103,21 +100,6 @@ public class Iris { *

This is called right before options are loaded, so we can add key bindings here.

*/ public void onEarlyInitialize() { - FabricLoader.getInstance().getModContainer("sodium").ifPresent( - modContainer -> { - sodiumInstalled = true; - String versionString = modContainer.getMetadata().getVersion().getFriendlyString(); - - // This makes it so that if we don't have the right version of Sodium, it will show the user a - // nice warning, and prevent them from playing the game with a wrong version of Sodium. - if (!SodiumVersionCheck.isAllowedVersion(versionString)) { - sodiumInvalid = true; - } - } - ); - - hasNEC = FabricLoader.getInstance().isModLoaded("notenoughcrashes"); - ModContainer iris = FabricLoader.getInstance().getModContainer(MODID) .orElseThrow(() -> new IllegalStateException("Couldn't find the mod container for Iris")); @@ -723,18 +705,6 @@ public static String getFormattedVersion() { return color + version; } - public static boolean isSodiumInvalid() { - return sodiumInvalid; - } - - public static boolean isSodiumInstalled() { - return sodiumInstalled; - } - - public static boolean hasNotEnoughCrashes() { - return hasNEC; - } - public static Path getShaderpacksDirectory() { if (shaderpacksDirectory == null) { shaderpacksDirectory = FabricLoader.getInstance().getGameDir().resolve("shaderpacks"); diff --git a/src/main/java/net/coderbot/iris/mixin/MixinTitleScreen.java b/src/main/java/net/coderbot/iris/mixin/MixinTitleScreen.java index 980aa4e29d..0b98da271f 100644 --- a/src/main/java/net/coderbot/iris/mixin/MixinTitleScreen.java +++ b/src/main/java/net/coderbot/iris/mixin/MixinTitleScreen.java @@ -1,29 +1,14 @@ package net.coderbot.iris.mixin; -import com.google.common.collect.ImmutableList; import net.coderbot.iris.Iris; -import net.coderbot.iris.compat.sodium.SodiumVersionCheck; -import net.fabricmc.loader.api.FabricLoader; -import net.minecraft.ChatFormatting; -import net.minecraft.Util; -import net.minecraft.client.GraphicsStatus; -import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.screens.AlertScreen; -import net.minecraft.client.gui.screens.ConfirmScreen; -import net.minecraft.client.gui.screens.PopupScreen; import net.minecraft.client.gui.screens.Screen; import net.minecraft.client.gui.screens.TitleScreen; import net.minecraft.network.chat.Component; -import net.minecraft.network.chat.TextComponent; -import net.minecraft.network.chat.TranslatableComponent; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import java.net.URI; -import java.net.URISyntaxException; - @Mixin(TitleScreen.class) public class MixinTitleScreen extends Screen { private static boolean iris$hasFirstInit; @@ -33,70 +18,12 @@ protected MixinTitleScreen(Component arg) { } @Inject(method = "init", at = @At("RETURN")) - public void iris$showSodiumIncompatScreen(CallbackInfo ci) { - if (iris$hasFirstInit) return; - - String reason; - - if (!Iris.isSodiumInstalled() && !FabricLoader.getInstance().isDevelopmentEnvironment()) { - reason = "iris.sodium.failure.reason.notFound"; - } else if (Iris.isSodiumInvalid()) { - reason = "iris.sodium.failure.reason.incompatible"; - } else if (Iris.hasNotEnoughCrashes()) { - Minecraft.getInstance().setScreen(new ConfirmScreen( - bool -> { - if (bool) { - if (!iris$hasFirstInit) { - Iris.onLoadingComplete(); - } - - iris$hasFirstInit = true; - - Minecraft.getInstance().setScreen(this); - } else { - Minecraft.getInstance().stop(); - } - }, - new TranslatableComponent("iris.nec.failure.title", Iris.MODNAME).withStyle(ChatFormatting.BOLD, ChatFormatting.RED), - new TranslatableComponent("iris.nec.failure.description"), - new TranslatableComponent("options.graphics.warning.accept").withStyle(ChatFormatting.RED), - new TranslatableComponent("menu.quit").withStyle(ChatFormatting.BOLD))); - return; - } else { - if (!iris$hasFirstInit) { - Iris.onLoadingComplete(); - } - - iris$hasFirstInit = true; - - return; - } - - if (Iris.isSodiumInvalid()) { - Minecraft.getInstance().setScreen(new AlertScreen( - Minecraft.getInstance()::stop, - new TranslatableComponent("iris.sodium.failure.title").withStyle(ChatFormatting.RED), - new TranslatableComponent("iris.sodium.failure.reason"), - new TranslatableComponent("menu.quit"))); + public void iris$firstInit(CallbackInfo ci) { + if (!iris$hasFirstInit) { + Iris.onLoadingComplete(); } iris$hasFirstInit = true; - Minecraft.getInstance().setScreen(new ConfirmScreen( - (boolean accepted) -> { - if (accepted) { - try { - Util.getPlatform().openUri(new URI(SodiumVersionCheck.getDownloadLink())); - } catch (URISyntaxException e) { - throw new IllegalStateException(e); - } - } else { - Minecraft.getInstance().stop(); - } - }, - new TranslatableComponent("iris.sodium.failure.title").withStyle(ChatFormatting.RED), - new TranslatableComponent(reason), - new TranslatableComponent("iris.sodium.failure.download"), - new TranslatableComponent("menu.quit"))); } } From 0d33d99f10b32079ae35f2fda36b011fb2cab977 Mon Sep 17 00:00:00 2001 From: IMS212 Date: Tue, 21 Nov 2023 21:02:40 -0800 Subject: [PATCH 5/7] I need to learn to try my code --- .../iris/mixin/MixinDebugScreenOverlay.java | 14 +++++----- .../iris/mixin/MixinLevelRenderer.java | 5 ---- .../iris/mixin/MixinSystemReport.java | 8 ------ .../net/coderbot/iris/mixin/gui/MixinGui.java | 27 ------------------- 4 files changed, 7 insertions(+), 47 deletions(-) diff --git a/src/main/java/net/coderbot/iris/mixin/MixinDebugScreenOverlay.java b/src/main/java/net/coderbot/iris/mixin/MixinDebugScreenOverlay.java index 208c44f26d..15c411263c 100644 --- a/src/main/java/net/coderbot/iris/mixin/MixinDebugScreenOverlay.java +++ b/src/main/java/net/coderbot/iris/mixin/MixinDebugScreenOverlay.java @@ -58,19 +58,19 @@ public abstract class MixinDebugScreenOverlay { messages.add(3, "Direct Buffers: +" + iris$humanReadableByteCountBin(iris$directPool.getMemoryUsed())); - if (!Iris.isSodiumInstalled()) { - messages.add(3, "Native Memory: +" + iris$humanReadableByteCountBin(iris$getNativeMemoryUsage())); - } + //if (!Iris.isSodiumInstalled()) { + // messages.add(3, "Native Memory: +" + iris$humanReadableByteCountBin(iris$getNativeMemoryUsage())); + //} } @Inject(method = "getGameInformation", at = @At("RETURN")) private void iris$appendShadowDebugText(CallbackInfoReturnable> cir) { List messages = cir.getReturnValue(); - if (!Iris.isSodiumInstalled() && Iris.getCurrentPack().isPresent()) { - messages.add(1, ChatFormatting.YELLOW + "[" + Iris.MODNAME + "] Sodium isn't installed; you will have poor performance."); - messages.add(2, ChatFormatting.YELLOW + "[" + Iris.MODNAME + "] Install Sodium if you want to run benchmarks or get higher FPS!"); - } + //if (!Iris.isSodiumInstalled() && Iris.getCurrentPack().isPresent()) { + // messages.add(1, ChatFormatting.YELLOW + "[" + Iris.MODNAME + "] Sodium isn't installed; you will have poor performance."); + // messages.add(2, ChatFormatting.YELLOW + "[" + Iris.MODNAME + "] Install Sodium if you want to run benchmarks or get higher FPS!"); + //} Iris.getPipelineManager().getPipeline().ifPresent(pipeline -> pipeline.addDebugText(messages)); } diff --git a/src/main/java/net/coderbot/iris/mixin/MixinLevelRenderer.java b/src/main/java/net/coderbot/iris/mixin/MixinLevelRenderer.java index a998bd66cc..5355426038 100644 --- a/src/main/java/net/coderbot/iris/mixin/MixinLevelRenderer.java +++ b/src/main/java/net/coderbot/iris/mixin/MixinLevelRenderer.java @@ -69,11 +69,6 @@ public class MixinLevelRenderer { private void iris$setupPipeline(PoseStack poseStack, float tickDelta, long startTime, boolean renderBlockOutline, Camera camera, GameRenderer gameRenderer, LightTexture lightTexture, Matrix4f projection, CallbackInfo callback) { - if (Iris.isSodiumInvalid()) { - throw new IllegalStateException("An invalid version of Sodium is installed, and the warning screen somehow" + - " didn't work. This is a bug! Please report it to the Iris developers."); - } - IrisTimeUniforms.updateTime(); CapturedRenderingState.INSTANCE.setGbufferModelView(poseStack.last().pose()); CapturedRenderingState.INSTANCE.setGbufferProjection(projection); diff --git a/src/main/java/net/coderbot/iris/mixin/MixinSystemReport.java b/src/main/java/net/coderbot/iris/mixin/MixinSystemReport.java index 8eec02d752..cc28904bf4 100644 --- a/src/main/java/net/coderbot/iris/mixin/MixinSystemReport.java +++ b/src/main/java/net/coderbot/iris/mixin/MixinSystemReport.java @@ -32,13 +32,5 @@ private void fillSystemDetails(CallbackInfo ci) { }); return sb.toString(); }); - - this.setDetail("NEC status", () -> { - if (Iris.hasNotEnoughCrashes()) { - return "Has NEC: INVALID"; - } else { - return "No NEC detected"; - } - }); } } diff --git a/src/main/java/net/coderbot/iris/mixin/gui/MixinGui.java b/src/main/java/net/coderbot/iris/mixin/gui/MixinGui.java index 98bc987633..ee3068156b 100644 --- a/src/main/java/net/coderbot/iris/mixin/gui/MixinGui.java +++ b/src/main/java/net/coderbot/iris/mixin/gui/MixinGui.java @@ -35,33 +35,6 @@ public class MixinGui { } } - // TODO: Move this to a more appropriate mixin - @Inject(method = "render", at = @At("RETURN")) - public void iris$displayBigSodiumWarning(PoseStack poseStack, float tickDelta, CallbackInfo ci) { - if (Iris.isSodiumInstalled() - || Minecraft.getInstance().options.renderDebug - || !Iris.getCurrentPack().isPresent()) { - return; - } - - Font font = Minecraft.getInstance().font; - - List warningLines = new ArrayList<>(); - warningLines.add("[" + Iris.MODNAME + "] Sodium isn't installed; you will have poor performance."); - warningLines.add("[" + Iris.MODNAME + "] Install Sodium if you want to run benchmarks or get higher FPS!"); - - for (int i = 0; i < warningLines.size(); ++i) { - String string = warningLines.get(i); - - final int lineHeight = 9; - final int lineWidth = font.width(string); - final int y = 2 + lineHeight * i; - - GuiComponent.fill(poseStack, 1, y - 1, 2 + lineWidth + 1, y + lineHeight - 1, 0x9050504E); - font.draw(poseStack, string, 2.0F, y, 0xFFFF55); - } - } - @Inject(method = "renderVignette", at = @At("HEAD"), cancellable = true) private void iris$disableVignetteRendering(Entity entity, CallbackInfo ci) { WorldRenderingPipeline pipeline = Iris.getPipelineManager().getPipelineNullable(); From 9ebd2b9be5328d0c2c2d0a0a747563d86d78033c Mon Sep 17 00:00:00 2001 From: IMS212 Date: Tue, 21 Nov 2023 21:03:12 -0800 Subject: [PATCH 6/7] get outta my dev env DH --- buildscript/src/main/java/Buildscript.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildscript/src/main/java/Buildscript.java b/buildscript/src/main/java/Buildscript.java index 0633380263..3a13588024 100644 --- a/buildscript/src/main/java/Buildscript.java +++ b/buildscript/src/main/java/Buildscript.java @@ -101,7 +101,7 @@ public void getModDependencies(ModDependencyCollector d) { jij(d.addMaven(Maven.MAVEN_CENTRAL, new MavenId("io.github.douira:glsl-transformer:2.0.0-pre13"), ModDependencyFlag.COMPILE, ModDependencyFlag.RUNTIME)); jij(d.addMaven(Maven.MAVEN_CENTRAL, new MavenId("org.antlr:antlr4-runtime:4.11.1"), ModDependencyFlag.COMPILE, ModDependencyFlag.RUNTIME)); - d.addMaven("https://api.modrinth.com/maven", new MavenId("maven.modrinth", "distanthorizons", "2.0.0-a-1.18.2"), ModDependencyFlag.COMPILE, ModDependencyFlag.RUNTIME); + d.addMaven("https://api.modrinth.com/maven", new MavenId("maven.modrinth", "distanthorizons", "2.0.0-a-1.18.2"), ModDependencyFlag.COMPILE); if (SODIUM) { d.addMaven(FabricMaven.URL, new MavenId(FabricMaven.GROUP_ID + ".fabric-api", "fabric-api-base", "0.4.3+d7c144a8d2"), ModDependencyFlag.COMPILE, ModDependencyFlag.RUNTIME); From a972c9191b105ddf47424044eddd68258a69fa4f Mon Sep 17 00:00:00 2001 From: IMS212 Date: Wed, 22 Nov 2023 15:53:48 -0800 Subject: [PATCH 7/7] Change version to 1.6.11 --- src/main/resources/fabric.mod.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index bab1de2c02..1d7ada1835 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,7 +1,7 @@ { "schemaVersion": 1, "id": "iris", - "version": "1.6.10-development-environment", + "version": "1.6.11-development-environment", "name": "Iris", "description": "A modern shaders mod for Minecraft intended to be compatible with existing OptiFine shader packs",