Skip to content

Commit

Permalink
Merge pull request #592 from friendlyhj/gui_default_text_color
Browse files Browse the repository at this point in the history
Set gui default text color
  • Loading branch information
ACGaming authored Nov 19, 2024
2 parents 8e82bdf + dc2b6df commit aa0df7d
Show file tree
Hide file tree
Showing 4 changed files with 42 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1451,6 +1451,16 @@ public static class MiscCategory
@Config.Comment("Sets the default difficulty for newly generated worlds")
public EnumDifficulty utDefaultDifficulty = EnumDifficulty.NORMAL;


@Config.RequiresMcRestart
@Config.Name("Default Gui Text Color")
@Config.Comment
({
"Sets the default gui text color (hex rgb code). It is useful for dark mode texture pack",
"404040 for vanilla default"
})
public String utDefaultGuiTextColor = "404040";

@Config.RequiresMcRestart
@Config.Name("Disable Advancements")
@Config.Comment("Prevents the advancement system from loading entirely")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader
put("mixins.tweaks.misc.credits.json", () -> UTConfigTweaks.MISC.utSkipCreditsToggle);
put("mixins.tweaks.misc.glint.enchantedbook.json", () -> UTConfigTweaks.MISC.utDisableEnchantmentBookGlint);
put("mixins.tweaks.misc.glint.potion.json", () -> UTConfigTweaks.MISC.utDisablePotionGlint);
put("mixins.tweaks.misc.gui.defaultguitextcolor.json", () -> !UTConfigTweaks.MISC.utDefaultGuiTextColor.equals("404040"));
put("mixins.tweaks.misc.gui.keybindlistentry.json", () -> UTConfigTweaks.MISC.utPreventKeybindingEntryOverflow);
put("mixins.tweaks.misc.gui.lanserverproperties.json", () -> UTConfigTweaks.MISC.utLANServerProperties);
put("mixins.tweaks.misc.gui.overlaymessage.json", () -> UTConfigTweaks.MISC.utOverlayMessageHeight != -4);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package mod.acgaming.universaltweaks.tweaks.misc.gui.mixin;

import mod.acgaming.universaltweaks.config.UTConfigTweaks;

import net.minecraft.client.gui.FontRenderer;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.ModifyVariable;

// Courtesy of youyihj
@Mixin(FontRenderer.class)
public class UTDefaultGuiTextColor
{
@ModifyVariable(method = "drawString(Ljava/lang/String;FFIZ)I", at = @At("HEAD"), argsOnly = true)
private int utSetDefaultGuiTextColor(int color)
{
if (color == 0x404040) {
return Integer.parseInt(UTConfigTweaks.MISC.utDefaultGuiTextColor, 16);
} else {
return color;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.tweaks.misc.gui.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"client": ["UTDefaultGuiTextColor"]
}

0 comments on commit aa0df7d

Please sign in to comment.