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

Started by Max094_Reikeb on Wed, 03/25/2020 - 07:55

Topic category: Help with modding (Java Edition)

Last seen on 07:35, 14. Jan 2021
Joined Jun 2015
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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
Last seen on 07:35, 14. Jan 2021
Joined Jun 2015
User points:

User statistics:

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

Please, anyone to help me?

Last seen on 07:35, 14. Jan 2021
Joined Jun 2015
User points:

User statistics:

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

problem solved on my own.

Last seen on 13:39, 15. Jan 2021
Joined Mar 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How did you do it?
Fri, 05/08/2020 - 16:20

How did you do it?

Last seen on 08:55, 4. Nov 2020
Joined May 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 

Last seen on 13:39, 15. Jan 2021
Joined Mar 2020
User points:

User statistics:

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

You can actually do this without code in 2020.3

Last seen on 08:55, 4. Nov 2020
Joined May 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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

Last seen on 08:55, 4. Nov 2020
Joined May 2020
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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 

Last seen on 14:13, 15. Jan 2021
Joined Nov 2018
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • 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"));

 

Last seen on 08:55, 4. Nov 2020
Joined May 2020
User points:

User statistics:

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

i over looked that thanks lol ill sort that xD