Jump to content

[SOLVED] Add tooltip to another item.


TesterTesting135

Recommended Posts

Hello, so I'm trying to add additional tooltips to items. I have it so that when you press a character, it will do something to a item. I want to be able to see that the item has been modified. I am using RenderTooltipEvent.PostBackRound, but it just keeps crashing. Here is my code:

@SubscribeEvent
public static void onTooltipPreEvent(RenderTooltipEvent.PostBackground event) {
    ItemStack stack = event.getStack();
    NBTTagCompound nbt;
    if (stack.hasTagCompound()) {
        nbt = stack.getTagCompound();
    } else {
        nbt = new NBTTagCompound();
    }
    if (nbt.hasKey(ModifactionTable.NBT_LOCK)) {
        if (nbt.getBoolean(ModifactionTable.NBT_LOCK)) {
            event.getLines().add("Item Modified");
        }
    }
}
Edited by TesterTesting135
Solved
Link to comment
Share on other sites

  • 4 months later...
1 hour ago, diesieben07 said:

编写自己的线程,发布代码和遇到的问题。

@SubscribeEvent
    public void event(RenderTooltipEvent.Pre event){
        Minecraft mc = Minecraft.getInstance();
        event.setCanceled(true);
        mc.getTextureManager().bindTexture(ITEMGUI);
        this.blit(event.getX(),event.getY(),0,0,109,158);
    }

Rendering problems, how should be solved?

_JBY~3E2Q]NW9M$D_5E2`XI.png

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.