diff options
Diffstat (limited to 'src/main/java/me/xmrvizzy/skyblocker/utils/title/Title.java')
-rw-r--r-- | src/main/java/me/xmrvizzy/skyblocker/utils/title/Title.java | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/utils/title/Title.java b/src/main/java/me/xmrvizzy/skyblocker/utils/title/Title.java index ac06eb36..7dfef3d9 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/utils/title/Title.java +++ b/src/main/java/me/xmrvizzy/skyblocker/utils/title/Title.java @@ -4,11 +4,36 @@ import net.minecraft.text.MutableText; import net.minecraft.text.Text; import net.minecraft.util.Formatting; +/** + * Represents a title used for {@link TitleContainer}. + * + * @see TitleContainer + */ public class Title { private MutableText text; protected float lastX = 0; protected float lastY = 0; + /** + * Constructs a new title with the given translation key and formatting to be applied. + * + * @param textKey the translation key + * @param formatting the formatting to be applied to the text + */ + public Title(String textKey, Formatting formatting) { + this(Text.translatable(textKey).formatted(formatting)); + } + + /** + * Constructs a new title with the given {@link MutableText}. + * Use {@link Text#literal(String)} or {@link Text#translatable(String)} to create a {@link MutableText} + * + * @param text the mutable text + */ + public Title(MutableText text) { + this.text = text; + } + public MutableText getText() { return text; } @@ -20,12 +45,4 @@ public class Title { public void setFormatting(Formatting formatting) { this.text.formatted(formatting); } - - public Title(String textKey, Formatting formatting) { - this(Text.translatable(textKey).formatted(formatting)); - } - - public Title(MutableText text) { - this.text = text; - } } |