aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dulkirmod/mixins/MixinItemStack.java
diff options
context:
space:
mode:
authoringlettronald <71849533+inglettronald@users.noreply.github.com>2023-01-11 02:36:35 -0600
committeringlettronald <inglettronald@gmail.com>2023-01-11 02:36:35 -0600
commitd7062b05c3d309e7a1e14d6d50c586b1dfe2138c (patch)
tree8a599b431dbf976e501770ec02779d97229005cb /src/main/java/dulkirmod/mixins/MixinItemStack.java
parentdfcc2c5818daa50b558a8a4cb81d0e92e03219d2 (diff)
downloadDulkirMod-d7062b05c3d309e7a1e14d6d50c586b1dfe2138c.tar.gz
DulkirMod-d7062b05c3d309e7a1e14d6d50c586b1dfe2138c.tar.bz2
DulkirMod-d7062b05c3d309e7a1e14d6d50c586b1dfe2138c.zip
- 1.14 commit:
oldanimations "fix" and scalable tooltips
Diffstat (limited to 'src/main/java/dulkirmod/mixins/MixinItemStack.java')
-rw-r--r--src/main/java/dulkirmod/mixins/MixinItemStack.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/main/java/dulkirmod/mixins/MixinItemStack.java b/src/main/java/dulkirmod/mixins/MixinItemStack.java
new file mode 100644
index 0000000..76440ef
--- /dev/null
+++ b/src/main/java/dulkirmod/mixins/MixinItemStack.java
@@ -0,0 +1,27 @@
+package dulkirmod.mixins;
+import dulkirmod.features.ScalableTooltips;
+import net.minecraft.entity.player.EntityPlayer;
+import net.minecraft.item.ItemStack;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.injection.At;
+import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
+
+import java.util.List;
+
+@Mixin(ItemStack.class)
+public abstract class MixinItemStack {
+
+ private static ItemStack previousStack;
+
+ @Inject(method = "getTooltip", at = @At("HEAD"))
+ public void onTooltip(EntityPlayer playerIn, boolean advanced, CallbackInfoReturnable<List<String>> cir) {
+
+ ItemStack currentStack = (ItemStack)(Object)this;
+ if (currentStack != previousStack) {
+ // reset values here for scrollable tooltips
+ ScalableTooltips.INSTANCE.resetPos();
+ previousStack = currentStack;
+ }
+ }
+}