aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/dulkirmod/mixins/MixinItemStack.java
diff options
context:
space:
mode:
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;
+ }
+ }
+}