I'm trying to add a tool (not an item!) description but I just can't! [SOLVED]

Started by Max094_Reikeb on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jun 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm trying to add a tool (not an item!) description but I just can't! [SOLVED]
Wed, 03/25/2020 - 16:16 (edited)

Hello,
I'm just trying to add a description to a tool, not an item. The MCreator interface doesn't have this for tools that's why I'm asking.
My MCreator version : last 2020.2 snapshot
My MC version : 1.14.4

So I've been trying several codes but none work.

// First trial
public void addInformation(ItemStack itemstack, World world, List<ITextComponent> list, ITooltipFlag flag) {
    this.addInformation(itemstack, world, list, flag);
    list.add(new StringTextComponent("Test"));
}

//Second trial
public void addInformation(ItemStack itemstack, World world, List<ITextComponent> list, ITooltipFlag flag) {
    super.addInformation(itemstack, world, list, flag);
    list.add(new StringTextComponent("Test"));
}

//Third trial
public void addInformation(ItemStack stack, World worldIn, List<String> tooltip, ITooltipFlag flagIn) {
	tooltip.add("Test");
	super.addInformation(stack, worldIn, tooltip, flagIn);
}

Thanks for any help!

Edited by Max094_Reikeb on Wed, 03/25/2020 - 16:16
Joined Jun 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Please, anyone to help me?
Wed, 03/25/2020 - 14:33

Please, anyone to help me?

Joined Jun 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
problem solved on my own.
Wed, 03/25/2020 - 16:16

problem solved on my own.

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
@Override public void…
Thu, 05/21/2020 - 18:56
@Override
	public void addInformation(ItemStack stack, World worldIn, List<ITextComponent> tooltip, ITooltipFlag flagIn)
	{
		if(KeyboardHelper.isHoldingShift())
		{
			tooltip.add(new StringTextComponent("Melon Juice Heals 3 Meat Peices"));
		} else {
			tooltip.add(new StringTextComponent("\u00A75" + "Hold Shift For More Information"));
		}
		super.addInformation(stack, worldIn, tooltip, flagIn);
	}

this is how i like to run my tool tips its on my melon juice its a nice way to run it if you want them to hold shift to view the information you just need to create a KeyboardHelper class i have in util/helpers

public class KeyboardHelper 
{
	private static final long WINDOW = Minecraft.getInstance().getMainWindow().getHandle();
	@OnlyIn(Dist.CLIENT)
	public static boolean isHoldingShift()
	{
		return InputMappings.isKeyDown(WINDOW, GLFW.GLFW_KEY_LEFT_SHIFT) || InputMappings.isKeyDown(WINDOW, GLFW.GLFW_KEY_RIGHT_SHIFT);
	
	}
	@OnlyIn(Dist.CLIENT)
	public static boolean isHoldingCtrl()
	{
		return InputMappings.isKeyDown(WINDOW, GLFW.GLFW_KEY_LEFT_CONTROL) || InputMappings.isKeyDown(WINDOW, GLFW.GLFW_KEY_RIGHT_CONTROL);
	
	}
}

make a nice tool tip say if u have a fair bit of information you can have a little keybind while hovering item to show more information 

Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
You can actually do this…
Thu, 05/21/2020 - 18:57

You can actually do this without code in 2020.3

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
this is the java eclipse…
Thu, 05/21/2020 - 19:05

this is the java eclipse code ive used for mc 1.15.2 but it can be a guide on how it works some coding may be a bit different but with any coding experience should not be hard to make a copy of it to the code that works via any other versions of mc

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
ahh so .3 has the…
Thu, 05/21/2020 - 19:10

ahh so .3 has the implementations so no code needed nice 

Joined Nov 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
tooltip.add(new…
Thu, 05/21/2020 - 20:36

tooltip.add(new StringTextComponent("Melon Juice Heals 3 Meat Peices"));

You spelt pieces wrong.

tooltip.add(new StringTextComponent("Melon Juice Heals 3 Meat Pieces"));

 

Joined May 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i over looked that thanks…
Fri, 05/22/2020 - 11:05

i over looked that thanks lol ill sort that xD