Skip to content

Commit

Permalink
Implement Accurate Potion Duration tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
ACGaming committed Mar 11, 2024
1 parent 3d0823f commit 20ddb21
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ public List<String> 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");
Expand Down Expand Up @@ -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":
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
}
}
7 changes: 7 additions & 0 deletions src/main/resources/mixins.tweaks.misc.gui.potionduration.json
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": ["UTPotionDurationMixin"]
}

0 comments on commit 20ddb21

Please sign in to comment.