From fea0d014b83c117a3ecfddb97cbae9b92cc72bc8 Mon Sep 17 00:00:00 2001 From: Jonathing Date: Mon, 23 Dec 2024 22:34:19 -0500 Subject: [PATCH] Allow mipmap lowering to be disabled (#10252) --- .../client/renderer/texture/SpriteLoader.java.patch | 2 +- .../java/net/minecraftforge/common/ForgeConfig.java | 11 +++++++++++ src/main/resources/assets/forge/lang/en_us.json | 2 ++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/patches/minecraft/net/minecraft/client/renderer/texture/SpriteLoader.java.patch b/patches/minecraft/net/minecraft/client/renderer/texture/SpriteLoader.java.patch index c6c4aee8ea..2b3477e546 100644 --- a/patches/minecraft/net/minecraft/client/renderer/texture/SpriteLoader.java.patch +++ b/patches/minecraft/net/minecraft/client/renderer/texture/SpriteLoader.java.patch @@ -5,7 +5,7 @@ int k1 = Mth.m_14173_(j1); int l1; - if (k1 < p_261919_) { -+ if (false) { // Forge: Do not lower the mipmap level ++ if (k1 < p_261919_ && net.minecraftforge.common.ForgeConfig.CLIENT.allowMipmapLowering()) { // Forge: Do not lower the mipmap level f_244357_.warn("{}: dropping miplevel from {} to {}, because of minimum power of two: {}", this.f_244500_, p_261919_, k1, j1); l1 = k1; } else { diff --git a/src/main/java/net/minecraftforge/common/ForgeConfig.java b/src/main/java/net/minecraftforge/common/ForgeConfig.java index 3512b8af2b..5200fd2ff2 100644 --- a/src/main/java/net/minecraftforge/common/ForgeConfig.java +++ b/src/main/java/net/minecraftforge/common/ForgeConfig.java @@ -121,6 +121,8 @@ public class ForgeConfig { public final BooleanValue stabilizeDirectionGetNearest; + public final BooleanValue allowMipmapLowering; + Client(ForgeConfigSpec.Builder builder) { builder.comment("Client only settings, mostly things related to rendering") @@ -167,6 +169,11 @@ public class ForgeConfig { .translation("forge.configgui.stabilizeDirectionGetNearest") .define("stabilizeDirectionGetNearest", true); + allowMipmapLowering = builder + .comment("When enabled, Forge will allow mipmaps to be lowered in real-time. This is the default behavior in vanilla. Use this if you experience issues with resource packs that use textures lower than 8x8.") + .translation("forge.configgui.allowMipmapLowering") + .define("allowMipmapLowering", false); + builder.pop(); } @@ -179,6 +186,10 @@ public class ForgeConfig { public final boolean showLoadWarnings() { return clientSpec.isLoaded() ? showLoadWarnings.get() : showLoadWarnings.getDefault(); } + + public final boolean allowMipmapLowering() { + return clientSpec.isLoaded() ? allowMipmapLowering.get() : allowMipmapLowering.getDefault(); + } } static final ForgeConfigSpec clientSpec; diff --git a/src/main/resources/assets/forge/lang/en_us.json b/src/main/resources/assets/forge/lang/en_us.json index 2b79ddd324..7adde0ef1e 100644 --- a/src/main/resources/assets/forge/lang/en_us.json +++ b/src/main/resources/assets/forge/lang/en_us.json @@ -187,6 +187,8 @@ "forge.configgui.selectiveResourceReloadEnabled": "Enable Selective Resource Loading", "forge.configgui.showLoadWarnings.tooltip": "When enabled, Forge will show any warnings that occurred during loading.", "forge.configgui.showLoadWarnings": "Show Load Warnings", + "forge.configgui.allowMipmapLowering.tooltip": "When enabled, Forge will allow mipmaps to be lowered in real-time. This is the default behavior in vanilla. Use this if you experience issues with resource packs that use textures lower than 8x8.", + "forge.configgui.allowMipmapLowering": "Allow mipmap lowering", "forge.configgui.disableVersionCheck.tooltip": "Set to true to disable Forge version check mechanics. Forge queries a small json file on our server for version information. For more details see the ForgeVersion class in our github.", "forge.configgui.disableVersionCheck": "Disable Forge Version Check",