Custom Tooltip for GUIS

Started by MrScautHD on Mon, 03/01/2021 - 14:44

Topic category: User side tutorials

Last seen on 07:45, 10. Nov 2021
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Custom Tooltip for GUIS
Sat, 05/08/2021 - 16:36 (edited)

Hi this is my Custom Tooltip Tutoiral for GUIS (1.16.4+)

https://www.youtube.com/watch?v=u6BomfhdYn0&feature=youtu.be

1. You make a GUI

2. You go in the GUIWindow Class

3. You add the Code
 

        if(mouseX > guiLeft + 7 && mouseX < guiLeft + 29 && mouseY > guiTop + 10 && mouseY < guiTop + 77)
        this.renderTooltip(ms, new StringTextComponent("TEXT" + "TEXT"), mouseX, mouseY);
    }

Picture:

code

Second option (to add nbts):

        if (mouseX > guiLeft + 143 && mouseX < guiLeft + 168 && mouseY > guiTop + 21 && mouseY < guiTop + 70)
            this.renderTooltip(ms, new StringTextComponent(((new Object() {
                public double getValue(IWorld world, BlockPos pos, String tag) {
                    TileEntity tileEntity = world.getTileEntity(pos);
                    if (tileEntity != null)
                        return tileEntity.getTileData().getDouble(tag);
                    return -1;
                }
            }.getValue(world, new BlockPos((int) x, (int) y, (int) z), "TEXT of the nbt (number)"))) + " FE / 9000.0 FE"), mouseX, mouseY);
    }

Picture to understand the Scaling:

agfd

ToolTip code for JEI:

        @Override
        public List<ITextComponent> getTooltipStrings(OxygenMachineRecipeWrapper recipe, double mouseX, double mouseY) {
                if (mouseX > 10 && mouseX < 50 && mouseY > 10 && mouseY < 50) {
                return Collections.singletonList(new TranslationTextComponent("Energy"));
           }
            return Collections.emptyList();
        }

Picture:

fg

Have fun to make nice GUI ToolTips! :D

You need help?

My Discord Tag: MrScautHD#0350

Edited by MrScautHD on Sat, 05/08/2021 - 16:36
Last seen on 14:05, 2. Dec 2021
Joined Sep 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
pog
Mon, 03/01/2021 - 15:18

pog

Last seen on 09:41, 27. Nov 2021
Joined Jan 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
please post a tutorial video…
Thu, 03/25/2021 - 17:18

please post a tutorial video because i dont understand the java 

Last seen on 07:45, 10. Nov 2021
Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
when you need help: My…
Sat, 04/10/2021 - 06:01

when you need help:
My Discord Tag: MrScautHD#0350

Last seen on 19:07, 4. Dec 2021
Joined Sep 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
can someone explain the…
Tue, 11/30/2021 - 16:43

can someone explain the picture?