Package noppes.npcs.api.gui
Interface ICustomGuiComponent
-
- All Known Subinterfaces:
IButton,IItemSlot,ILabel,ILine,IScroll,ITextField,ITexturedRect
public interface ICustomGuiComponentBase interface for all custom GUI components. Defines common methods for position, appearance, and NBT serialization.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description ICustomGuiComponentfromNBT(net.minecraft.nbt.NBTTagCompound nbt)Deserializes the component from an NBT compound.floatgetAlpha()Returns the component's transparency (alpha).intgetColor()Returns the text color.java.lang.String[]getHoverText()Returns the hover text as an array of strings.intgetID()Returns the unique ID of this component.intgetPosX()Returns the x position of this component.intgetPosY()Returns the y position of this component.floatgetRotation()Returns the component's rotation.booleanhasHoverText()Checks if the component has hover text.voidsetAlpha(float alpha)Sets the component's transparency (alpha).ICustomGuiComponentsetColor(int color)Sets the text color.ICustomGuiComponentsetHoverText(java.lang.String hoverText)Sets the hover text with a single line.ICustomGuiComponentsetHoverText(java.lang.String[] hoverTextLines)Sets the hover text with multiple lines.ICustomGuiComponentsetID(int id)Sets the unique ID for this component.ICustomGuiComponentsetPos(int x, int y)Sets the position of the component.voidsetRotation(float rotation)Sets the component's rotation.net.minecraft.nbt.NBTTagCompoundtoNBT(net.minecraft.nbt.NBTTagCompound nbt)Serializes the component to an NBT compound.
-
-
-
Method Detail
-
getID
int getID()
Returns the unique ID of this component.- Returns:
- the component ID.
-
setID
ICustomGuiComponent setID(int id)
Sets the unique ID for this component.- Parameters:
id- the new ID.- Returns:
- this component instance.
-
getPosX
int getPosX()
Returns the x position of this component.- Returns:
- the x position.
-
getPosY
int getPosY()
Returns the y position of this component.- Returns:
- the y position.
-
setPos
ICustomGuiComponent setPos(int x, int y)
Sets the position of the component.- Parameters:
x- the new x position.y- the new y position.- Returns:
- this component instance.
-
hasHoverText
boolean hasHoverText()
Checks if the component has hover text.- Returns:
- true if hover text is set.
-
getHoverText
java.lang.String[] getHoverText()
Returns the hover text as an array of strings.- Returns:
- the hover text.
-
setHoverText
ICustomGuiComponent setHoverText(java.lang.String hoverText)
Sets the hover text with a single line.- Parameters:
hoverText- the hover text.- Returns:
- this component instance.
-
setHoverText
ICustomGuiComponent setHoverText(java.lang.String[] hoverTextLines)
Sets the hover text with multiple lines.- Parameters:
hoverTextLines- the hover text lines.- Returns:
- this component instance.
-
getColor
int getColor()
Returns the text color.- Returns:
- the color as an integer.
-
setColor
ICustomGuiComponent setColor(int color)
Sets the text color.- Parameters:
color- the color.- Returns:
- this component instance.
-
getAlpha
float getAlpha()
Returns the component's transparency (alpha).- Returns:
- the alpha value.
-
setAlpha
void setAlpha(float alpha)
Sets the component's transparency (alpha).- Parameters:
alpha- the alpha value.
-
getRotation
float getRotation()
Returns the component's rotation.- Returns:
- the rotation angle.
-
setRotation
void setRotation(float rotation)
Sets the component's rotation.- Parameters:
rotation- the rotation angle.
-
toNBT
net.minecraft.nbt.NBTTagCompound toNBT(net.minecraft.nbt.NBTTagCompound nbt)
Serializes the component to an NBT compound.- Parameters:
nbt- the NBT compound to populate.- Returns:
- the NBT compound.
-
fromNBT
ICustomGuiComponent fromNBT(net.minecraft.nbt.NBTTagCompound nbt)
Deserializes the component from an NBT compound.- Parameters:
nbt- the NBT compound.- Returns:
- this component instance.
-
-