diff --git a/README.md b/README.md index f6235ae3..973c3582 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,7 @@ All changes are toggleable via config files. ### **🔧 TWEAKS** +* **Accurate Potion Duration:** Always displays the actual potion duration instead of `**:**` * **Adaptive XP Drops:** Scales dropped experience from entities based on their health * **AI Improvements:** Replaces/removes entity AI for improved server performance * **Always Eat:** Allows the consumption of food at any time, regardless of the hunger bar diff --git a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java index c50a25c5..b5c37924 100644 --- a/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java +++ b/src/main/java/mod/acgaming/universaltweaks/config/UTConfigTweaks.java @@ -1157,6 +1157,10 @@ public static class MiscCategory @Config.Name("Toast Control") public final ToastControlCategory TOAST_CONTROL = new ToastControlCategory(); + @Config.Name("Accurate Potion Duration") + @Config.Comment("Always displays the actual potion duration instead of `**:**`") + public boolean utPotionDurationToggle = true; + @Config.RequiresMcRestart @Config.Name("Copy World Seed") @Config.Comment("Enables clicking of `/seed` world seed in chat to copy to clipboard") diff --git a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java index c7bd7de5..18324099 100644 --- a/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java +++ b/src/main/java/mod/acgaming/universaltweaks/core/UTLoadingPlugin.java @@ -129,6 +129,7 @@ public List getMixinConfigs() configs.add("mixins.tweaks.misc.difficulty.client.json"); configs.add("mixins.tweaks.misc.gui.lanserverproperties.json"); configs.add("mixins.tweaks.misc.gui.overlaymessage.json"); + configs.add("mixins.tweaks.misc.gui.potionduration.json"); configs.add("mixins.tweaks.misc.gui.selecteditemtooltip.json"); configs.add("mixins.tweaks.misc.lightning.flash.json"); configs.add("mixins.tweaks.misc.music.json"); @@ -309,6 +310,8 @@ public boolean shouldMixinConfigQueue(String mixinConfig) return UTConfigTweaks.MISC.utLANServerProperties; case "mixins.tweaks.misc.gui.overlaymessage.json": return UTConfigTweaks.MISC.utOverlayMessageHeight != -4; + case "mixins.tweaks.misc.gui.potionduration.json": + return UTConfigTweaks.MISC.utPotionDurationToggle; case "mixins.tweaks.misc.gui.selecteditemtooltip.json": return UTConfigTweaks.MISC.utSelectedItemTooltipHeight != 59; case "mixins.tweaks.misc.lightning.flash.json": diff --git a/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/gui/mixin/UTPotionDurationMixin.java b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/gui/mixin/UTPotionDurationMixin.java new file mode 100644 index 00000000..0003c1d0 --- /dev/null +++ b/src/main/java/mod/acgaming/universaltweaks/tweaks/misc/gui/mixin/UTPotionDurationMixin.java @@ -0,0 +1,19 @@ +package mod.acgaming.universaltweaks.tweaks.misc.gui.mixin; + +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionEffect; + +import mod.acgaming.universaltweaks.config.UTConfigTweaks; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(Potion.class) +public class UTPotionDurationMixin +{ + @Redirect(method = "getPotionDurationString", at = @At(value = "INVOKE", target = "Lnet/minecraft/potion/PotionEffect;getIsPotionDurationMax()Z")) + private static boolean utPotionDuration(PotionEffect effect) + { + return effect.getIsPotionDurationMax() && !UTConfigTweaks.MISC.utPotionDurationToggle; + } +} \ No newline at end of file diff --git a/src/main/resources/mixins.tweaks.misc.gui.potionduration.json b/src/main/resources/mixins.tweaks.misc.gui.potionduration.json new file mode 100644 index 00000000..0bedfc2c --- /dev/null +++ b/src/main/resources/mixins.tweaks.misc.gui.potionduration.json @@ -0,0 +1,7 @@ +{ + "package": "mod.acgaming.universaltweaks.tweaks.misc.gui.mixin", + "refmap": "universaltweaks.refmap.json", + "minVersion": "0.8", + "compatibilityLevel": "JAVA_8", + "client": ["UTPotionDurationMixin"] +} \ No newline at end of file