public class OnOffButton extends IndexedButton
id
NO_TOOLTIP, onPress, onTooltip
Constructor and Description |
---|
OnOffButton(int id,
int x,
int y,
int width,
int height,
boolean on,
net.minecraft.client.gui.widget.button.Button.IPressable pressedAction)
Initializes an on/off button.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isOn()
Checks if the button is on.
|
void |
setOn(boolean on)
Sets whether the button is on.
|
boolean |
toggle()
Toggles the button on or off.
|
getID, setMessage
onPress, renderButton, renderToolTip
keyPressed, onClick
changeFocus, clearFGColor, clicked, createNarrationMessage, getFGColor, getHeight, getMessage, getWidth, getYImage, isFocused, isHovered, isMouseOver, isValidClickButton, mouseClicked, mouseDragged, mouseReleased, narrate, onDrag, onFocusedChanged, onRelease, playDownSound, queueNarration, render, renderBg, setAlpha, setFGColor, setFocused, setHeight, setMessage, setWidth
blit, blit, blit, blit, blit, blitOutlineBlack, drawCenteredString, drawCenteredString, drawString, drawString, fill, fillGradient, fillGradient, getBlitOffset, hLine, setBlitOffset, vLine
public OnOffButton(int id, int x, int y, int width, int height, boolean on, net.minecraft.client.gui.widget.button.Button.IPressable pressedAction)
x
- The x coordinate of the left side of the button.y
- The y coordinate of the top of the button.width
- The width of the button.height
- The height of the button.on
- Whether the button is initially on.public boolean toggle()
public boolean isOn()
public void setOn(boolean on)
on
- Whether the button will be on.