Custom button texture

Started by NeyGeyex on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Custom button texture

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?

is there any way to make buttons with images in mcreator?

sorry for my bad english