Jump to content

Recommended Posts

Posted

Hi, I wanted to ask (I don't know if this is the correct forum) about how I can make a button with a custom texture I have this code "

public void init(Minecraft minecraft, int width, int height) {
        super.init(minecraft, width, height);
        minecraft.keyboardListener.enableRepeatEvents(true);
        this.addButton(new Button(this.guiLeft + 55, this.guiTop + 66, 40, 20, new StringTextComponent("asa"), e -> {
            if (true) {
                EsdecoMod.PACKET_HANDLER.sendToServer(new OooGui.ButtonPressedMessage(0, x, y, z));
                OooGui.handleButtonAction(entity, 0, x, y, z);
" but there comes a "string component" and I would like it to be more of an image, I don't know much about java, but if I know about the "net.minecraft.client.gui.widget.button.ImageButton" library, I don't know. how to use the method to make a button with image. Could someone tell me how can I do it?

I am doing the mod in mcreator, and to make a button with image I need to write the code, so I would like you to help me, thanks in advance

and sorry for my bad english

Posted

We do not provide support for MCreator here

This is my Forum Signature, I am currently attempting to transform it into a small guide for fixing easier issues using spoiler blocks to keep things tidy.

 

As the most common issue I feel I should put this outside the main bulk:

The only official source for Forge is https://files.minecraftforge.net, and the only site I trust for getting mods is CurseForge.

If you use any site other than these, please take a look at the StopModReposts project and install their browser extension, I would also advise running a virus scan.

 

For players asking for assistance with Forge please expand the spoiler below and read the appropriate section(s) in its/their entirety.

  Reveal hidden contents

 

  • Guest locked this topic
Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.