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 Jan 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Read the tutorial, its…
Tue, 01/09/2018 - 16:01

Read the tutorial, its really good

Could you do one for the multiple lines and coloured text please? im getting stuck a lot

 

Joined Sep 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
For colour codes, go to  - …
Wed, 01/10/2018 - 01:06

For colour codes, go to  -  https://minecraft.gamepedia.com/Formatting_codes  - and it shows the colour codes, eg 4 is dark red and 7 is gray. To make the tooltips colourful, type 

\u00A7

in the quotations before your text, like this; dataList.add("\u00A7Edit your tooltip here.");

Now to actually add the colour, go to the colour codes and pick the colour you like, I will choose dark red for this example. What you want to do is add the number of the colour code to the end of "\u00A7". so it looks like this for dark red; "\u00A74"

As for adding multiple lines, just take make a space below the custom code and add this line again; dataList.add("Edit your tooltip here.");

 

So you can have a coloured multi-line tooltip; 

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

 

Joined Jul 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
When I do everything right…
Thu, 05/10/2018 - 09:23

When I do everything right. I get no errors and everything is fine until I get into the game to heck my block that I put it on.

And all I see is the name of the block I don't see any tooltip. I tested the other code on your other fourm and I have the same result.

Joined Apr 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thread still relevant to…
Tue, 05/21/2019 - 21:29

Thread still relevant to make tooltips for tools since mcreator doesn't support it yet!

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
  Is there any way to add a…
Mon, 09/30/2019 - 13:46

 

Is there any way to add a tooltip to an item/block in mcreator 1.9.1?

Joined Nov 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
When you create a block/item…
Mon, 09/30/2019 - 13:58

When you create a block/item, there's a textbox for your tooltip under the texture selection part.

Joined Jan 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
package net.mcreator.the…
Mon, 01/13/2020 - 01:08

package net.mcreator.the_castle_mod;

import net.minecraftforge.registries.ObjectHolder;

import net.minecraft.item.crafting.Ingredient;
import net.minecraft.item.PickaxeItem;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemGroup;
import net.minecraft.item.Item;
import net.minecraft.item.IItemTier;

import net.minecraft.client.util.ITooltipFlag;
import net.minecraft.world.World;
import java.util.List;

@Elementsthe_castle_mod.ModElement.Tag
public class MCreatorCapacityPrimordialPick extends Elementsthe_castle_mod.ModElement {
    @ObjectHolder("the_castle_mod:capacityprimordialpick")
    public static final Item block = null;
    
    public MCreatorCapacityPrimordialPick(Elementsthe_castle_mod instance) {
        super(instance, 94);
    }

    @Override
    public void initElements() {
        elements.items.add(() -> new PickaxeItem(new IItemTier() {
            public int getMaxUses() {
                return 0;
            }

            public float getEfficiency() {
                return 10f;
            }

            public float getAttackDamage() {
                return 8f;
            }

            public int getHarvestLevel() {
                return 5;
            }

            public int getEnchantability() {
                return 15;
            }

            public Ingredient getRepairMaterial() {
                return Ingredient.fromStacks(new ItemStack(MCreatorDiamondBlack.block, (int) (1)));
            }
            
        }, 1, -3F, new Item.Properties().group(ItemGroup.TOOLS)) {
        }.setRegistryName("capacityprimordialpick"));
    }
}

 

Can you help me figure it out? No matter where I paste the line I always get a compiling error

Joined Aug 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
If you are using MCreator 1…
Mon, 01/13/2020 - 02:47

If you are using MCreator 1.14.4, it’s normal you can’t. It’s not the same code in 1.11.2 than in 1.14.4 (or 1.12.2). In addition, you can now qrite a description directly into your mod element.

Joined Aug 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Forget what I said.  I…
Mon, 01/13/2020 - 03:03

Forget what I said.  I confused with the items.

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hi all I use mcreator 2020.2…
Wed, 05/06/2020 - 09:42

Hi all I use mcreator 2020.2 for version 1.12.2 com could I add a description to some tools? (I'm in Italian my English isn't perfect), Thanks in advance to those who will help me

Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
4 years later, is it added…
Fri, 05/14/2021 - 23:51

4 years later, is it added yet?

Joined Oct 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Useful
Sat, 04/02/2022 - 08:18

Useful