blob: 76440ef666cdd59e2a26df8c758a7e2e61f96b49 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
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;
}
}
}
|