Package noppes.npcs.api.gui
Interface IButton
-
- All Superinterfaces:
ICustomGuiComponent
public interface IButton extends ICustomGuiComponent
Represents a clickable button component in a custom GUI. Provides methods to control size, label, texture, and state.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetHeight()Returns the button's height.java.lang.StringgetLabel()Returns the button's label text.floatgetScale()Returns the scale factor of the button.java.lang.StringgetTexture()Returns the texture resource location for this button.intgetTextureX()Returns the X offset within the texture.intgetTextureY()Returns the Y offset within the texture.intgetWidth()Returns the button's width.booleanhasTexture()Checks if the button has an assigned texture.booleanisEnabled()Checks if the button is enabled.voidsetEnabled(boolean enabled)Enables or disables the button.IButtonsetLabel(java.lang.String text)Sets the button's label text.voidsetScale(float scale)Sets the scale factor of the button.IButtonsetSize(int width, int height)Sets the size of the button.IButtonsetTexture(java.lang.String texture)Sets the texture resource location for this button.IButtonsetTextureOffset(int textureX, int textureY)Sets the texture offset (X and Y) for this button.-
Methods inherited from interface noppes.npcs.api.gui.ICustomGuiComponent
fromNBT, getAlpha, getColor, getHoverText, getID, getPosX, getPosY, getRotation, hasHoverText, setAlpha, setColor, setHoverText, setHoverText, setID, setPos, setRotation, toNBT
-
-
-
-
Method Detail
-
getWidth
int getWidth()
Returns the button's width.- Returns:
- the width in pixels.
-
getHeight
int getHeight()
Returns the button's height.- Returns:
- the height in pixels.
-
setSize
IButton setSize(int width, int height)
Sets the size of the button.- Parameters:
width- the new width in pixels.height- the new height in pixels.- Returns:
- this button instance.
-
getLabel
java.lang.String getLabel()
Returns the button's label text.- Returns:
- the label.
-
setLabel
IButton setLabel(java.lang.String text)
Sets the button's label text.- Parameters:
text- the new label.- Returns:
- this button instance.
-
getTexture
java.lang.String getTexture()
Returns the texture resource location for this button.- Returns:
- the texture location as a string.
-
hasTexture
boolean hasTexture()
Checks if the button has an assigned texture.- Returns:
- true if a texture is set; false otherwise.
-
setTexture
IButton setTexture(java.lang.String texture)
Sets the texture resource location for this button.- Parameters:
texture- the texture resource location.- Returns:
- this button instance.
-
getTextureX
int getTextureX()
Returns the X offset within the texture.- Returns:
- the texture X offset.
-
getTextureY
int getTextureY()
Returns the Y offset within the texture.- Returns:
- the texture Y offset.
-
setTextureOffset
IButton setTextureOffset(int textureX, int textureY)
Sets the texture offset (X and Y) for this button.- Parameters:
textureX- the new X offset.textureY- the new Y offset.- Returns:
- this button instance.
-
setScale
void setScale(float scale)
Sets the scale factor of the button.- Parameters:
scale- the scale factor.
-
getScale
float getScale()
Returns the scale factor of the button.- Returns:
- the scale.
-
setEnabled
void setEnabled(boolean enabled)
Enables or disables the button.- Parameters:
enabled- true to enable; false to disable.
-
isEnabled
boolean isEnabled()
Checks if the button is enabled.- Returns:
- true if enabled; false otherwise.
-
-