Editing the vertical size of the button in GUI

Started by VegaOrionis on

Topic category: Help with MCreator software

Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Editing the vertical size of the button in GUI

I know how to resize the button horizontally but I don't know how to resize the button vertically.

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you can do this by locking…
Tue, 10/14/2025 - 12:55

you can do this by locking the element but does your version have the image button option?

Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Unfortunately, they haven't…
Tue, 10/14/2025 - 13:37

Unfortunately, they haven't implemented this in version 2021.2 yet. I know it's already in newer versions, but I don't know which version it's been available since. I manually edited the GUI code and it works but the bottom of the button doesn't display correctly...

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
can you show your edits and…
Tue, 10/14/2025 - 13:45

can you show your edits and what it looks like?

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh yeah it will do that,…
Tue, 10/14/2025 - 15:05

Oh yeah it will do that,

does your version have the undecorated option?

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
oh um, it just works in…
Tue, 10/14/2025 - 15:12

oh um,

it just works in newer versions, but I was going to say you could just fake it, not with the undecorated option. but just by making a black line texture and lining it up with the bottom of the button.

Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
In the old version there is…
Tue, 10/14/2025 - 15:37

In the old version there is no option without decorations. I also thought about aligning it by pasting a black line, but there is a problem when you hover the mouse over it. There is no backlight effect, I don't know if there is a procedure to change the texture when you move the mouse over it
 

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
got this, i'm trying to port…
Tue, 10/14/2025 - 19:33

got this, i'm trying to port it to 1.15.2

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
👀   this looks so messy x3…
Tue, 10/14/2025 - 20:02

👀

 

this looks so messy x3

so in the init method do something like this to the this.addButton

			int left_pos = this.guiLeft;
			int top_pos = this.guiTop;
			this.addButton(new Button(this.guiLeft + 56, this.guiTop + 51, 40, 10, "222", e -> {
				if (true) {
					SuperOldMod.PACKET_HANDLER.sendToServer(new ButtonPressedMessage(0, x, y, z));
					handleButtonAction(entity, 0, x, y, z);
				}
			}) {
				@Override
				public void render(int p_282682_, int p_281714_, float p_282542_) {
					super.render(p_282682_, p_281714_, p_282542_);
					
					ResourceLocation resourceLocation;
					if(this.isHovered()) {
						resourceLocation = new ResourceLocation("super_old:textures/button_hover.png");
					} else {
						resourceLocation = new ResourceLocation("super_old:textures/button.png");
					}
					RenderSystem.color4f(1, 1, 1, 1);
					RenderSystem.enableBlend();
					RenderSystem.defaultBlendFunc();
					Minecraft.getInstance().getTextureManager().bindTexture(resourceLocation);
					this.blit(this.x/*left_pos + 56*/, this.y/*top_pos + 51*/, 0, 0, this.width/*40*/, this.height/*10*/, this.width/*40*/, this.height/*10*/);
					RenderSystem.disableBlend();
				}
			});
Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I didn't notice the message…
Tue, 10/14/2025 - 21:54

I didn't notice the message earlier, I already updated to the newer version and ignored the problem (I left it as a small bug in my mod :V) But thanks for the code, I might use it someday :)

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh, which version did you…
Tue, 10/14/2025 - 21:56

Oh, which version did you switch to now? x3

Joined Oct 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I switched and changed the…
Tue, 10/14/2025 - 22:03

I switched and changed the code to 1.16.5, everything went well,  and now I'm on 1.17.1 and then it stopped working :V