Tutorial:Tooltips 164

From MineTweaker 3
Jump to: navigation, search

Since MineTweaker 3.0.8, you can now add tooltips to items.

Adding tooltips can be done directly on any kind of ingredient:

<ore:plankWood>.addTooltip("These are wood planks");
<item.stick>.addTooltip("These are sticks");

Two kinds of tooltips are available: regular tooltips and tooltips that only appear when the shift key is being pressed:

<item.stick>.addShiftTooltip("Only appears with shift");

Markup

Tooltips can be colored and styled using the format functions:

<minecraft:stick>.addTooltip(format.green("This is green text"));

The following formatting functions are available:

format.black
format.darkBlue
format.darkGreen
format.darkAqua
format.darkRed
format.darkPurple
format.gold
format.gray
format.darkGray
format.blue
format.green
format.aqua
format.red
format.lightPurple
format.yellow
format.white

format.obfuscated
format.bold
format.strikethrough
format.underline
format.italic

Strings (and formatted strings) can be concatenated and nested easily:

<item.stick>.addTooltip(format.green(format.italic("This is a stick") + " with " + format.strikethrough("text")) + " in multiple styles");

Be careful to match the brackets properly!