ButtonWidgetHelper.TexturedButtonBuilder
com.jsmacrosce.jsmacros.client.api.helper.screen.ButtonWidgetHelper.TexturedButtonBuilder
Builds a texture-based button bound to the screen that supplied this builder.
Provide textures for the enabled, disabled, enabled-focused, and disabled-focused states; none falls back to another. Its height is fixed at 20.
js
const screen = Hud.createScreen("a screen", true);
screen.setOnInit(JavaWrapper.methodToJava(function (self) {
self.texturedButtonBuilder()
.pos(10, 20)
.size(100, 20)
.enabledTexture("minecraft:item/diamond")
.disabledTexture("minecraft:item/emerald")
.enabledFocusedTexture("minecraft:item/diamond")
.disabledFocusedTexture("minecraft:item/emerald")
.build();
}));
Hud.openScreen(screen);Nested type declared in ButtonWidgetHelper.
Constructors
new ButtonWidgetHelper.TexturedButtonBuilder
Methods
action
action(MethodWrapper<ButtonWidgetHelper<ImageButton>, IScreen, Object, ?> action): ButtonWidgetHelper.TexturedButtonBuilderSince1.8.4#Sets the action run when the button is activated; pass
null to clear it.Parameters:
action: the action to run, ornullfor no action
Returns: this builder
createWidget
createWidget(): ButtonWidgetHelper<ImageButton>#Creates and wraps a new texture-based button from this builder's current configuration without adding it to the screen or applying shared post-creation styles. Use
build() to create, configure, and add the button.Returns: the newly wrapped texture-based button
disabledFocusedTexture
disabledFocusedTexture(Identifier disabledFocused): ButtonWidgetHelper.TexturedButtonBuilderSince1.9.0#Sets the texture used when the button is inactive and hovered or focused.
Parameters:
disabledFocused: the texture to draw while disabled and focused
Returns: this builder
Sets the disabled, focused texture from its resource-location string; an omitted namespace defaults to
minecraft.Parameters:
disabledFocused: the texture to draw while disabled and focused
Returns: this builder
disabledTexture
Sets the texture used when the button is inactive and neither hovered nor focused.
Parameters:
disabled: the texture to draw while disabled
Returns: this builder
Sets the disabled, unfocused texture from its resource-location string; an omitted namespace defaults to
minecraft.Parameters:
disabled: the texture to draw while disabled
Returns: this builder
enabledFocusedTexture
enabledFocusedTexture(Identifier enabledFocused): ButtonWidgetHelper.TexturedButtonBuilderSince1.9.0#Sets the texture used when the button is active and hovered or focused.
Parameters:
enabledFocused: the texture to draw while enabled and focused
Returns: this builder
Sets the enabled, focused texture from its resource-location string; an omitted namespace defaults to
minecraft.Parameters:
enabledFocused: the texture to draw while enabled and focused
Returns: this builder
enabledTexture
Sets the texture used when the button is active and neither hovered nor focused.
Parameters:
enabled: the texture to draw while enabled and not focused
Returns: this builder
Sets the enabled, unfocused texture from its resource-location string; an omitted namespace defaults to
minecraft.Parameters:
enabled: the texture to draw while enabled and not focused
Returns: this builder
getAction
Returns: the configured action, or
null if none is setheight
Parameters:
height: ignored; the button height remains 20
Returns: this builder
size
Parameters:
width: the button widthheight: ignored; the button height remains 20
Returns: this builder