Topic category: User side tutorials
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
A very nice tutorial. We will consider adding this into MCreator!
Thanks!
Read the tutorial, its really good
Could you do one for the multiple lines and coloured text please? im getting stuck a lot
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
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;
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.
Thread still relevant to make tooltips for tools since mcreator doesn't support it yet!
Is there any way to add a tooltip to an item/block in mcreator 1.9.1?
When you create a block/item, there's a textbox for your tooltip under the texture selection part.
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
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.
Forget what I said. I confused with the items.
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
4 years later, is it added yet?
Useful