aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/com/ambientaddons/mixin/MixinRenderItem.java
blob: 80682913e017c8e3d6e25c2e76e9722e91d17137 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package com.ambientaddons.mixin;

import com.ambientaddons.events.GuiContainerEvent;
import com.ambientaddons.events.ItemOverlayEvent;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.item.ItemStack;
import net.minecraftforge.common.MinecraftForge;
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.CallbackInfo;

@Mixin(RenderItem.class)
public abstract class MixinRenderItem {
    @Inject(method = "renderItemOverlayIntoGUI", at = @At("HEAD"),cancellable = true)
    public void renderItemOverlayIntoGui(FontRenderer fr, ItemStack stack, int xPosition, int yPosition, String text, CallbackInfo ci) {
        if (MinecraftForge.EVENT_BUS.post(new ItemOverlayEvent(stack, xPosition, yPosition))) {
            ci.cancel();
        }
    }
}