blob: 0a3bc845586890f8b87322e493cecef391b1a0d4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
package me.xmrvizzy.skyblocker.utils.title;
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 x = -1;
protected float y = -1;
/**
* 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;
}
public void setText(MutableText text) {
this.text = text;
}
protected boolean isDefaultPos() {
return x == -1 && y == -1;
}
protected void resetPos() {
this.x = -1;
this.y = -1;
}
}
|