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 int
getHeight()
Returns the button's height.java.lang.String
getLabel()
Returns the button's label text.float
getScale()
Returns the scale factor of the button.java.lang.String
getTexture()
Returns the texture resource location for this button.int
getTextureX()
Returns the X offset within the texture.int
getTextureY()
Returns the Y offset within the texture.int
getWidth()
Returns the button's width.boolean
hasTexture()
Checks if the button has an assigned texture.boolean
isEnabled()
Checks if the button is enabled.void
setEnabled(boolean enabled)
Enables or disables the button.IButton
setLabel(java.lang.String text)
Sets the button's label text.void
setScale(float scale)
Sets the scale factor of the button.IButton
setSize(int width, int height)
Sets the size of the button.IButton
setTexture(java.lang.String texture)
Sets the texture resource location for this button.IButton
setTextureOffset(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.
-
-