Jump to content

Recommended Posts

Posted (edited)

So this seems like a bug, but it could be a drawing issue I'm not aware of. I have an ImageButton and regular Button:

this.func_230480_a_(new ImageButton(xstart + 99, ystart + 18, 70, 16, 156, 0, 21, 
WIDGET_TEXTURES, 256, 256, (p_213070_1_) -> { }, new TranslationTextComponent("Image Button")));

this.func_230480_a_(new Button(xstart + 99, ystart + 18, 70, 20,
        new TranslationTextComponent("Button"), (p_213070_1_) -> { }));

Both textures render fine, however the ImageButton doesn't display text. This is odd considering they both output the same arguments below. I also tried to give the ImageButton text color to see if it would make a difference, but it doesn't.

TranslatableComponent{key='Image Button', args=[], siblings=[], style=Style{ color=null, bold=null, italic=null, underlined=null, strikethrough=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null, font=minecraft:default}}
TranslatableComponent{key='Button', args=[], siblings=[], style=Style{ color=null, bold=null, italic=null, underlined=null, strikethrough=null, obfuscated=null, clickEvent=null, hoverEvent=null, insertion=null, font=minecraft:default}}
Edited by urbanxx001
Posted (edited)

The constructor of both of the button you are using passes Button.field_238486_s_ (empty), whereas there won't be any hovered text/tooltip being displayed, so I assume you are talking about the text that is rendered on the button:

ImageButton overrides renderButton and does not call super.renderButton(...) (but Button did), and in Widged#renderButton it draws the title you passed in, therefore ImageButton does not render the title, but Button does.

Edited by poopoodice
  • Thanks 1
Posted (edited)

That makes a ton of sense now... it's strange that it's set like that though, if ImageButton has a constructor that accepts text, you would think it would render on the button by default. Normally it just passes StringTextComponent.field_240750_d_ (an empty string), so having another hurdle seems redundant.

Edited by urbanxx001
  • Like 1
Posted

My think is since an ImageButton renders an image on it, if it renders text as well it will become really messy (mixture of text and image).

For every widget to have a message/title is probably for voice narrating? I'm not so sure about this.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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