Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gamemode for Starscript & Text preset #4553

Merged
merged 2 commits into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading