blob: f08329031ed3a0d318c9f1a11c62f098ca4a5715 (
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
|
package com.dulkirfabric.mixin;
import com.dulkirfabric.util.render.ItemChangeHandler;
import net.minecraft.client.item.TooltipType;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.text.Text;
import org.jetbrains.annotations.Nullable;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
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 ItemStackMixin {
@Shadow public abstract Item getItem();
@Inject(method = "getTooltip", at = @At("HEAD"))
private void onGetTooltip(Item.TooltipContext context, @Nullable PlayerEntity player, TooltipType type, CallbackInfoReturnable<List<Text>> cir) {
ItemChangeHandler.INSTANCE.handle(this.getItem().getName().getString());
}
}
|