Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

To make adding tooltips to items that already exist easier, adding a hook or event that is called whenever the items addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) method is called so that mods like mine can add tooltips to the vanilla minecraft items, or other mod items.

 

Thanks in advance, EJ.

 

Example of an event for this that could be added:

 

package net.minecraftforge.client.event;

 

import java.util.List;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

 

import net.minecraft.entity.player.EntityPlayer;

import net.minecraft.item.ItemStack;

import net.minecraft.src.ModLoader;

import net.minecraft.util.MovingObjectPosition;

import net.minecraft.client.renderer.RenderGlobal;

import net.minecraftforge.event.Cancelable;

import net.minecraftforge.event.Event;

 

@SideOnly(Side.CLIENT)

/*

* Allows mods using this event to add information to the items tooltip

*/

public class ItemInformationEvent extends Event

{

/*

* The ItemStack that is having its tooltip

*/

    public final ItemStack itemstack;

    /*

    * The player that owns the inventory with the item stack in

    */

    public final EntityPlayer player;

    /*

    * The list of tooltips, Add information to this to add info to the tooltip (list.add())

    */

    public final List list;

    /*

    * Whether or not F3+H is active

    */

    public final boolean extrainfo;

    /*

    * Whether or not the player is holding shift

    */

    public final boolean shifting;

   

    public ItemInformationEvent(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)

    {

    this.itemstack = par1ItemStack;

    this.player = par2EntityPlayer;

    this.list = par3List;

    this.extrainfo = par4;

    this.shifting = ModLoader.getMinecraftInstance().currentScreen.isShiftKeyDown();

    }

 

}

 

 

  • 3 months later...

"so that mods like mine can add tooltips to the vanilla minecraft items, or other mod items.", well actualy u can add that using tick handlers with ticktype player, getting the current equiped item and adding information

 

  • 4 months later...

And for items in inventory? Man, I've been trying several ways of adding tooltips to vanilla items. I can get it done, but not in a handy way.

Is'nt there really a hook for this?

Last time I checked, there is no way to modify the tooltip, because the list containg info is being created inside a method. But if you use NEI, it gives such possibility.

  • 1 month later...

This looks great! How do I implement this now? Is it ok to just copy and paste all the green code? (and remove the red code I guess)

Will this work when I reobuscate and export the code? Will it work on a server?

 

As you might have guessed, I'm not so familiar with this ForgeHookFactory. Can I make additions like this in there?

 

 

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.