feat: added custom background for navigation arrow
This commit is contained in:
parent
b0c71740a3
commit
181811e039
@ -27,6 +27,7 @@ public class NavigatorContext extends PlayerContext implements Navigator {
|
||||
private boolean prevTargetEmpty = true;
|
||||
@Setter private String format = "[ %s ]";
|
||||
@Setter private TextColor textColor = TextColor.color(0xF8FF91);
|
||||
@Setter private GlyphImage arrowBackground = Navigators.GLYPH_BACKGROUND;
|
||||
|
||||
public NavigatorContext(MsbPlayer player) {
|
||||
super(player);
|
||||
@ -80,13 +81,15 @@ public class NavigatorContext extends PlayerContext implements Navigator {
|
||||
|
||||
var builder = new GlyphComponentBuilder();
|
||||
|
||||
builder.append((int) (arrowBackground.width() / -2.15) + 1, arrowBackground);
|
||||
|
||||
// Text
|
||||
if (text != null) {
|
||||
builder.setColorTo(textColor);
|
||||
if (cachedText == null) {
|
||||
cachedText = MinecraftFont.translateByLineNumber(0, format.formatted(text));
|
||||
}
|
||||
builder.append((int) (cachedText.width() / -2.2), cachedText);
|
||||
builder.append((int) (cachedText.width() / -2.15), cachedText);
|
||||
builder.resetColor();
|
||||
}
|
||||
|
||||
|
||||
@ -10,53 +10,61 @@ import ru.dragonestia.msb3.resource.glyph.GlyphImage;
|
||||
|
||||
public class Navigators {
|
||||
|
||||
private final static int ARROW_ASCENT = -5;
|
||||
|
||||
public final static GlyphImage GLYPH_UP = Resources.createGlyph(
|
||||
Key.key("msb3", "navigator/up"),
|
||||
ResourceFromJar.of("glyphs/navigator/arrow/up.png"),
|
||||
16,
|
||||
0);
|
||||
ARROW_ASCENT);
|
||||
|
||||
public final static GlyphImage GLYPH_UP_RIGHT = Resources.createGlyph(
|
||||
Key.key("msb3", "navigator/up_right"),
|
||||
ResourceFromJar.of("glyphs/navigator/arrow/up_right.png"),
|
||||
16,
|
||||
0);
|
||||
ARROW_ASCENT);
|
||||
|
||||
public final static GlyphImage GLYPH_RIGHT = Resources.createGlyph(
|
||||
Key.key("msb3", "navigator/right"),
|
||||
ResourceFromJar.of("glyphs/navigator/arrow/right.png"),
|
||||
16,
|
||||
0);
|
||||
ARROW_ASCENT);
|
||||
|
||||
public final static GlyphImage GLYPH_DOWN_RIGHT = Resources.createGlyph(
|
||||
Key.key("msb3", "navigator/down_right"),
|
||||
ResourceFromJar.of("glyphs/navigator/arrow/down_right.png"),
|
||||
16,
|
||||
0);
|
||||
ARROW_ASCENT);
|
||||
|
||||
public final static GlyphImage GLYPH_DOWN = Resources.createGlyph(
|
||||
Key.key("msb3", "navigator/down"),
|
||||
ResourceFromJar.of("glyphs/navigator/arrow/down.png"),
|
||||
16,
|
||||
0);
|
||||
ARROW_ASCENT);
|
||||
|
||||
public final static GlyphImage GLYPH_DOWN_LEFT = Resources.createGlyph(
|
||||
Key.key("msb3", "navigator/down_left"),
|
||||
ResourceFromJar.of("glyphs/navigator/arrow/down_left.png"),
|
||||
16,
|
||||
0);
|
||||
ARROW_ASCENT);
|
||||
|
||||
public final static GlyphImage GLYPH_LEFT = Resources.createGlyph(
|
||||
Key.key("msb3", "navigator/left"),
|
||||
ResourceFromJar.of("glyphs/navigator/arrow/left.png"),
|
||||
16,
|
||||
0);
|
||||
ARROW_ASCENT);
|
||||
|
||||
public final static GlyphImage GLYPH_UP_LEFT = Resources.createGlyph(
|
||||
Key.key("msb3", "navigator/up_left"),
|
||||
ResourceFromJar.of("glyphs/navigator/arrow/up_left.png"),
|
||||
16,
|
||||
0);
|
||||
ARROW_ASCENT);
|
||||
|
||||
public final static GlyphImage GLYPH_BACKGROUND = Resources.createGlyph(
|
||||
Key.key("msb3", "navigator/background"),
|
||||
ResourceFromJar.of("glyphs/navigator/background.png"),
|
||||
64,
|
||||
12);
|
||||
|
||||
public static Navigator of(Player player) {
|
||||
return PlayerContext.of(player, NavigatorContext.class);
|
||||
|
||||
BIN
api/src/main/resources/glyphs/navigator/background.png
Normal file
BIN
api/src/main/resources/glyphs/navigator/background.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 701 B |
Loading…
x
Reference in New Issue
Block a user