Skip to content

Commit

Permalink
Starscript & Text preset for game mode (#4553)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zgoly committed May 3, 2024
1 parent 0f96cb1 commit 20799ae
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ public class MeteorTextHud {
public static final HudElementInfo<TextHud>.Preset TPS;
public static final HudElementInfo<TextHud>.Preset PING;
public static final HudElementInfo<TextHud>.Preset SPEED;
public static final HudElementInfo<TextHud>.Preset GAME_MODE;
public static final HudElementInfo<TextHud>.Preset DURABILITY;
public static final HudElementInfo<TextHud>.Preset POSITION;
public static final HudElementInfo<TextHud>.Preset OPPOSITE_POSITION;
Expand All @@ -37,6 +38,7 @@ public class MeteorTextHud {
TPS = addPreset("TPS", "TPS: #1{round(server.tps, 1)}");
PING = addPreset("Ping", "Ping: #1{ping}");
SPEED = addPreset("Speed", "Speed: #1{round(player.speed, 1)}", 0);
GAME_MODE = addPreset("Game mode", "Game mode: #1{player.gamemode}", 0);
DURABILITY = addPreset("Durability", "Durability: #1{player.hand_or_offhand.durability}");
POSITION = addPreset("Position", "Pos: #1{floor(camera.pos.x)}, {floor(camera.pos.y)}, {floor(camera.pos.z)}", 0);
OPPOSITE_POSITION = addPreset("Opposite Position", "{player.opposite_dimension != \"End\" ? player.opposite_dimension + \":\" : \"\"} #1{player.opposite_dimension != \"End\" ? \"\" + floor(camera.opposite_dim_pos.x) + \", \" + floor(camera.opposite_dim_pos.y) + \", \" + floor(camera.opposite_dim_pos.z) : \"\"}", 0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ public static void init() {
.set("dimension", () -> Value.string(PlayerUtils.getDimension().name()))
.set("opposite_dimension", () -> Value.string(PlayerUtils.getDimension().opposite().name()))

.set("gamemode", () -> mc.player != null ? Value.string(StringUtils.capitalize(PlayerUtils.getGameMode().getName())) : Value.null_())

.set("pos", new ValueMap()
.set("_toString", () -> posString(false, false))
.set("x", () -> Value.number(mc.player != null ? mc.player.getX() : 0))
Expand Down

0 comments on commit 20799ae

Please sign in to comment.