Package noppes.npcs.api.gui
Interface ICustomGuiComponent
-
- All Known Subinterfaces:
IButton
,IItemSlot
,ILabel
,ILine
,IScroll
,ITextField
,ITexturedRect
public interface ICustomGuiComponent
Base 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 ICustomGuiComponent
fromNBT(net.minecraft.nbt.NBTTagCompound nbt)
Deserializes the component from an NBT compound.float
getAlpha()
Returns the component's transparency (alpha).int
getColor()
Returns the text color.java.lang.String[]
getHoverText()
Returns the hover text as an array of strings.int
getID()
Returns the unique ID of this component.int
getPosX()
Returns the x position of this component.int
getPosY()
Returns the y position of this component.float
getRotation()
Returns the component's rotation.boolean
hasHoverText()
Checks if the component has hover text.void
setAlpha(float alpha)
Sets the component's transparency (alpha).ICustomGuiComponent
setColor(int color)
Sets the text color.ICustomGuiComponent
setHoverText(java.lang.String hoverText)
Sets the hover text with a single line.ICustomGuiComponent
setHoverText(java.lang.String[] hoverTextLines)
Sets the hover text with multiple lines.ICustomGuiComponent
setID(int id)
Sets the unique ID for this component.ICustomGuiComponent
setPos(int x, int y)
Sets the position of the component.void
setRotation(float rotation)
Sets the component's rotation.net.minecraft.nbt.NBTTagCompound
toNBT(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.
-
-