Custom Buttons

Started by Jewily on Tue, 05/12/2020 - 20:53

Topic category: Help with modding (Java Edition)

Last seen on 12:27, 16. Jan 2021
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Custom Buttons
Tue, 05/12/2020 - 20:53

Hello everyone! I made my custom GUI look using Adobe XD and paste it  in the MCreator using 'Image' stuff in GUI creator. I`ve trought bout it but my  buttons looks like weird. Is it  possible to make my own  buttons design? Maybe using JSON files in gui properties(if they are exists) or resource-packs?

Thank you guys for this awesome  tool!

Last seen on 16:01, 1. Jul 2021
Joined Dec 2016
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Yes, custom code.
Thu, 05/14/2020 - 17:50

Yes, custom code.

Last seen on 12:27, 16. Jan 2021
Joined Mar 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I`ve checked the code but i…
Thu, 05/14/2020 - 18:40

I`ve checked the code but i`ve not founded nothing connected to button  view. Lots of  classes with xyz moving but without rendering. Can you tell me where it is? Thank you, anyway

Last seen on 04:35, 17. Jan 2021
Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Personally, I feel this…
Tue, 06/02/2020 - 13:16

Personally, I feel this should be added in MCreator. But if you want to code, you need to create a custom widget that extends Button (more functionality). I will include an example below;

public class GuiButtonLightningSymbol extends Button {

    final ResourceLocation texture = new ResourceLocation(Main.MODID + ":textures/items/symbols.png");

    protected final IPressable onPress;
    int u = 0;
    int v = 40;
    int widthIn;
    int heightIn;

    public GuiButtonLightningSymbol(int widthIn, int heightIn, IPressable onPress) {
        super(widthIn, heightIn, 10, 10, "", onPress);
        this.widthIn = widthIn;
        this.heightIn = heightIn;
        this.onPress = onPress;
    }

    @Override
    public void renderButton(int p_renderButton_1_, int p_renderButton_2_, float p_renderButton_3_) {
        Minecraft mc = Minecraft.getInstance();
        mc.textureManager.bindTexture(texture);
        if (!visible)
        {
            return;
        }
        mc.ingameGUI.blit(widthIn, heightIn, u, v, width, height);
    }
}

 

Last seen on 22:53, 9. Jul 2021
Joined Mar 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Is there a video anywhere…
Sun, 01/31/2021 - 16:16

Is there a video anywhere explaining how to use this?

Last seen on 15:53, 20. Jul 2021
Joined Feb 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Do you mean with Custom…
Mon, 02/01/2021 - 06:34

Do you mean with Custom Widget "Custom Element" in MCreator? Also you need to create an Custom Element for the code?