Class PaperText
java.lang.Object
xyz.gmitch215.socketmc.util.render.text.Text
xyz.gmitch215.socketmc.util.render.text.PaperText
- All Implemented Interfaces:
Serializable
Represents a text element to be displayed on the client's screen, built by a
Component
.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionprotected int
The alpha value for the color in this text element.protected Component
The text content for this text element.Fields inherited from class xyz.gmitch215.socketmc.util.render.text.Text
dropShadow, FONT_HEIGHT
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionCreates a new text element from a component.int
getAlpha()
Gets the alpha value for the color in this text element.int
getColor()
Gets the color as an ARGB integer.Gets the text content for this text element.void
setAlpha
(int alpha) Sets the alpha value for the color in this text element.void
setComponent
(@NotNull Component component) Sets the text content for this text element.toJSON()
Serializes this text element to a JSON string compatible with the Minecraft Component format.Methods inherited from class xyz.gmitch215.socketmc.util.render.text.Text
isDropShadow, setDropShadow
-
Field Details
-
component
The text content for this text element. -
alpha
protected int alphaThe alpha value for the color in this text element.
-
-
Constructor Details
-
PaperText
public PaperText()Constructs a new, empty text element. -
PaperText
Constructs a new text element.- Parameters:
component
- Component for Text- Throws:
IllegalArgumentException
- if the component is null
-
PaperText
Constructs a new text element.- Parameters:
component
- Component for Textalpha
- Color Alpha Value- Throws:
IllegalArgumentException
- if the component is null or the alpha value is not between 0 and 255
-
-
Method Details
-
getComponent
Gets the text content for this text element.- Returns:
- Text Content
-
setComponent
Sets the text content for this text element.- Parameters:
component
- Text Component- Throws:
IllegalArgumentException
- if the text is null
-
getAlpha
public int getAlpha()Gets the alpha value for the color in this text element.- Returns:
- Alpha Value
-
setAlpha
Sets the alpha value for the color in this text element.- Parameters:
alpha
- Alpha Value- Throws:
IllegalArgumentException
- if the alpha value is not between 0 and 255
-
getColor
public int getColor()Description copied from class:Text
Gets the color as an ARGB integer. -
toJSON
Description copied from class:Text
Serializes this text element to a JSON string compatible with the Minecraft Component format. -
from
Creates a new text element from a component.- Parameters:
component
- Component for Text- Returns:
- Text Element
-