Skip to content

Commit

Permalink
Implement Forge Mod List Improvements tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Jan 14, 2025
1 parent bb7f93f commit 200f811
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ All changes are toggleable via config files.
* **Fence/Wall Jump:** Allows the player to jump over fences and walls
* **Finite Water:** Prevents creation of infinite water sources outside of ocean and river biomes
* **First Person Burning Overlay:** Sets the offset for the fire overlay in first person when the player is burning
* **Forge Mod List Improvements:** Improves the Forge mod list GUI by remembering last searches and supporting pipes `|` to look up multiple mods
* **Glass Bottle Consumes Water Source:** Causes Glass Bottles to consume the source block of water
* **Growth Size:** Configurable growth height/length for sugar cane, cacti and vines
* **Hardcore Buckets:** Prevents placing of liquid source blocks in the world
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1502,6 +1502,11 @@ public static class MiscCategory
@Config.Comment("Re-implements parallax rendering of the end portal from 1.10 and older")
public boolean utEndPortalParallaxToggle = false;

@Config.RequiresMcRestart
@Config.Name("Forge Mod List Improvements")
@Config.Comment("Improves the Forge mod list GUI by remembering last searches and supporting pipes `|` to look up multiple mods")
public boolean utForgeModListImprovements = true;

@Config.RequiresMcRestart
@Config.Name("Infinite Music")
@Config.Comment("Lets background music play continuously without delays")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ public class UTLoadingPlugin implements IFMLLoadingPlugin, IEarlyMixinLoader
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.modlist.json", () -> UTConfigTweaks.MISC.utForgeModListImprovements);
put("mixins.tweaks.misc.gui.overlaymessage.json", () -> UTConfigTweaks.MISC.utOverlayMessageHeight != -4);
put("mixins.tweaks.misc.gui.ping.json", () -> UTConfigTweaks.MISC.utBetterPing);
put("mixins.tweaks.misc.gui.potionduration.json", () -> UTConfigTweaks.MISC.utPotionDurationToggle);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package mod.acgaming.universaltweaks.tweaks.misc.gui.modlist.mixin;

import java.util.Arrays;

import net.minecraft.client.gui.GuiTextField;
import net.minecraftforge.fml.client.GuiModList;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(GuiModList.class)
public abstract class UTGuiModListMixin
{
@Shadow(remap = false)
private GuiTextField search;

@Shadow(remap = false)
private String lastFilterText;

@Inject(method = "initGui", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiTextField;setCanLoseFocus(Z)V", shift = At.Shift.AFTER))
public void utInitGuiModList(CallbackInfo ci)
{
search.setText(lastFilterText);
}

@Redirect(method = "reloadMods", at = @At(value = "INVOKE", target = "Ljava/lang/String;contains(Ljava/lang/CharSequence;)Z"), remap = false)
public boolean utReloadMods(String string, CharSequence charSequence)
{
if (charSequence.toString().contains("|"))
{
String[] splits = charSequence.toString().split("\\|");
return Arrays.stream(splits).anyMatch(string::contains);
}
return string.contains(charSequence);
}
}
7 changes: 7 additions & 0 deletions src/main/resources/mixins.tweaks.misc.gui.modlist.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"package": "mod.acgaming.universaltweaks.tweaks.misc.gui.modlist.mixin",
"refmap": "universaltweaks.refmap.json",
"minVersion": "0.8",
"compatibilityLevel": "JAVA_8",
"client": ["UTGuiModListMixin"]
}

0 comments on commit 200f811

Please sign in to comment.