Package noppes.npcs.api.gui
Interface ITexturedRect
-
- All Superinterfaces:
ICustomGuiComponent
public interface ITexturedRect extends ICustomGuiComponent
Represents a textured rectangle component in a custom GUI. Allows configuration of texture resource, size, scale, and texture offset.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description intgetFrameCount()Returns the number of animation frames.intgetFrameTime()Returns the ticks per animation frame.intgetHeight()Returns the height of the rectangle.floatgetScale()Returns the scale factor of the rectangle.StringgetTexture()Returns the texture resource location.intgetTextureX()Returns the texture's x offset.intgetTextureY()Returns the texture's y offset.intgetWidth()Returns the width of the rectangle.booleanisAnimated()Returns whether this textured rect has animation enabled.ITexturedRectsetAnimation(int frameCount, int frametime)Enables animation on this textured rect using a vertical sprite strip.ITexturedRectsetScale(float scale)Sets the scale factor of the rectangle.ITexturedRectsetSize(int width, int height)Sets the size of the rectangle.ITexturedRectsetTexture(String texture)Sets the texture resource location.ITexturedRectsetTextureOffset(int textureX, int textureY)Sets the texture offset.-
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
-
getTexture
String getTexture()
Returns the texture resource location.- Returns:
- the texture as a string.
-
setTexture
ITexturedRect setTexture(String texture)
Sets the texture resource location.- Parameters:
texture- the texture resource location.- Returns:
- this textured rectangle instance.
-
getWidth
int getWidth()
Returns the width of the rectangle.- Returns:
- the width in pixels.
-
getHeight
int getHeight()
Returns the height of the rectangle.- Returns:
- the height in pixels.
-
setSize
ITexturedRect setSize(int width, int height)
Sets the size of the rectangle.- Parameters:
width- the new width.height- the new height.- Returns:
- this textured rectangle instance.
-
getScale
float getScale()
Returns the scale factor of the rectangle.- Returns:
- the scale.
-
setScale
ITexturedRect setScale(float scale)
Sets the scale factor of the rectangle.- Parameters:
scale- the new scale.- Returns:
- this textured rectangle instance.
-
getTextureX
int getTextureX()
Returns the texture's x offset.- Returns:
- the x offset.
-
getTextureY
int getTextureY()
Returns the texture's y offset.- Returns:
- the y offset.
-
setTextureOffset
ITexturedRect setTextureOffset(int textureX, int textureY)
Sets the texture offset.- Parameters:
textureX- the new x offset.textureY- the new y offset.- Returns:
- this textured rectangle instance.
-
isAnimated
boolean isAnimated()
Returns whether this textured rect has animation enabled.- Returns:
- true if animated.
-
getFrameCount
int getFrameCount()
Returns the number of animation frames.- Returns:
- the frame count.
-
getFrameTime
int getFrameTime()
Returns the ticks per animation frame.- Returns:
- the frame time in ticks.
-
setAnimation
ITexturedRect setAnimation(int frameCount, int frametime)
Enables animation on this textured rect using a vertical sprite strip. The texture PNG should contain frames stacked vertically.- Parameters:
frameCount- number of frames in the strip.frametime- ticks per frame (1 tick = 50ms).- Returns:
- this textured rectangle instance.
-
-