forked from Patbox/TextPlaceholderAPI
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFontNode.java
More file actions
36 lines (29 loc) · 964 Bytes
/
FontNode.java
File metadata and controls
36 lines (29 loc) · 964 Bytes
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
package eu.pb4.placeholders.api.node.parent;
import eu.pb4.placeholders.api.ParserContext;
import eu.pb4.placeholders.api.node.TextNode;
import net.minecraft.text.Style;
import net.minecraft.text.StyleSpriteSource;
import net.minecraft.util.Identifier;
import java.util.Arrays;
public final class FontNode extends SimpleStylingNode {
private final Identifier font;
public FontNode(TextNode[] children, Identifier font) {
super(children);
this.font = font;
}
@Override
protected Style style(ParserContext context) {
return Style.EMPTY.withFont(new StyleSpriteSource.Font(this.font));
}
@Override
public ParentTextNode copyWith(TextNode[] children) {
return new FontNode(children, this.font);
}
@Override
public String toString() {
return "FontNode{" +
"font=" + font +
", children=" + Arrays.toString(children) +
'}';
}
}