diff --git a/buildscript/src/main/java/Buildscript.java b/buildscript/src/main/java/Buildscript.java index 5f59ceee4c..785de00863 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.19.2"), ModDependencyFlag.COMPILE, ModDependencyFlag.RUNTIME); + d.addMaven("https://api.modrinth.com/maven", new MavenId("maven.modrinth", "distanthorizons", "2.0.0-a-1.19.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); diff --git a/src/main/java/net/coderbot/iris/Iris.java b/src/main/java/net/coderbot/iris/Iris.java index a9c6794d37..69c730a129 100644 --- a/src/main/java/net/coderbot/iris/Iris.java +++ b/src/main/java/net/coderbot/iris/Iris.java @@ -75,9 +75,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; @@ -107,21 +104,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")); @@ -727,18 +709,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/MixinDebugScreenOverlay.java b/src/main/java/net/coderbot/iris/mixin/MixinDebugScreenOverlay.java index 10c7aedf9d..2ac73fd49e 100644 --- a/src/main/java/net/coderbot/iris/mixin/MixinDebugScreenOverlay.java +++ b/src/main/java/net/coderbot/iris/mixin/MixinDebugScreenOverlay.java @@ -59,19 +59,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/MixinTitleScreen.java b/src/main/java/net/coderbot/iris/mixin/MixinTitleScreen.java index 6db0fcd2a3..0b98da271f 100644 --- a/src/main/java/net/coderbot/iris/mixin/MixinTitleScreen.java +++ b/src/main/java/net/coderbot/iris/mixin/MixinTitleScreen.java @@ -1,28 +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 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; @@ -32,61 +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(); - } - }, - Component.translatable("iris.nec.failure.title", Iris.MODNAME).withStyle(ChatFormatting.BOLD, ChatFormatting.RED), - Component.translatable("iris.nec.failure.description"), - Component.translatable("options.graphics.warning.accept").withStyle(ChatFormatting.RED), - Component.translatable("menu.quit").withStyle(ChatFormatting.BOLD))); - return; - } else { - if (!iris$hasFirstInit) { - Iris.onLoadingComplete(); - } - - iris$hasFirstInit = true; - - return; + 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(); - } - }, - Component.translatable("iris.sodium.failure.title").withStyle(ChatFormatting.RED), - Component.translatable(reason), - Component.translatable("iris.sodium.failure.download"), - Component.translatable("menu.quit"))); } } 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(); 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); 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); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index f7a0aa7bc3..1721dd6655 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", 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 73ea6c2005..87a8ae4bbb 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(Component.translatable("options.iris.shadowDistance")) .setTooltip(Component.translatable("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 : (Component.translatable(key, v)).getString(); + }; + } + public static OptionImpl createLimitedVideoSettingsButton(MinecraftOptionsStorage vanillaOpts) { return OptionImpl.createBuilder(SupportedGraphicsMode.class, vanillaOpts) .setName(Component.translatable("options.graphics")) // TODO: State that Fabulous Graphics is incompatible with Shader Packs in the tooltip .setTooltip(Component.translatable("sodium.options.graphics_quality.tooltip")) .setControl(option -> new CyclingControl<>(option, SupportedGraphicsMode.class, - new Component[] { Component.literal("Fast"), Component.literal("Fancy") })) + new Component[] { Component.translatable("options.graphics.fast"), Component.translatable("options.graphics.fancy") })) .setBinding( (opts, value) -> opts.graphicsMode().set(value.toVanilla()), opts -> SupportedGraphicsMode.fromVanilla(opts.graphicsMode().get()))