Tutorial: How to add tooltips/descriptions to any element

Started by k6u on

Topic category: User side tutorials

Joined Sep 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Tutorial: How to add tooltips/descriptions to any element
Sat, 10/14/2017 - 07:56 (edited)

Hello all! This is a step by step tutorial with images on how to add tooltips / item descriptions to any element in MCreator, eg blocks, tools, armor. 

1.  Create your element as usual.

2. Go to "CODE".

3. Double click the element you want to add a tooltip to.  (In my case it is called "TooltipTutorial) http://prntscr.com/gx8suo

4. A small tab pops up notifying you about editing code, ect ect, just select "Lock the code for MCreator" http://prntscr.com/gx8t1i

5. Make a space somewhere in the code, make sure its not right at the top, somewhere like here would do: http://prntscr.com/gx8uyr

6. Now, paste in this line of code: 

@SideOnly(Side.CLIENT) public void addInformation(ItemStack itemStack, EntityPlayer player, List dataList, boolean bool) { dataList.add("Edit your tooltip here.");   }

http://prntscr.com/gx8vfs Put whatever text you want inside of the quotation marks which will make it appear ingame.

7. Here begins the copy paste spree! Scroll up to the top of the code, make a space http://prntscr.com/gx8vv2, and copypaste this: import net.minecraftforge.fml.relauncher.SideOnly; 

8. Now make another space here http://prntscr.com/gx8x70 and copypaste this: import net.minecraft.entity.player.EntityPlayer;

9. Make a space here http://prntscr.com/gx9342 and copypaste this import java.util.List;

Now you are all done! Press "Save and Build" in the top right corner and if you did it right there should be no errors! 

Here's what I did with my tool: http://prntscr.com/gx96hd

I hope this tutorial has helped you :)
If you get an error or need help, please reply with your code and I will reply fast as I can. If you want to know how to color the text or have multiple lines, just ask and I will reply with the code, I did not show you how to do that as it is too long and is only optional.

Edit: Fixing spoilers

Edited by k6u on Sat, 10/14/2017 - 07:56
Joined Feb 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I cannot see the pics and it…
Sat, 10/26/2024 - 06:42

I cannot see the pics and it is outdated.