Skip to content

Commit

Permalink
don't hide y
Browse files Browse the repository at this point in the history
  • Loading branch information
okx-code committed Feb 24, 2023
1 parent 8d39e4b commit b7f4a42
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
18 changes: 9 additions & 9 deletions common/src/main/java/sh/okx/civmodern/common/radar/Radar.java
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@ public void onClientTick(ClientTickEvent event) {
}
}

private boolean hideY() {
return false;
}

public void onWorldTickPing(ClientTickEvent event) {
ClientLevel world = Minecraft.getInstance().level;
if (world == null) {
Expand All @@ -94,15 +98,13 @@ public void onWorldTickPing(ClientTickEvent event) {
if (config.isPingEnabled()) {
BlockPos pos = player.blockPosition();
String lastWaypointCommand =
"/newWaypoint x:" + pos.getX() + ",y:" + Minecraft.getInstance().player.getBlockY() + ",z:" + pos.getZ() + ",name:"
"/newWaypoint x:" + pos.getX() + ",y:" + (hideY() ? Minecraft.getInstance().player.getBlockY() : pos.getY()) + ",z:" + pos.getZ() + ",name:"
+ player.getScoreboardName();

Minecraft.getInstance().player.displayClientMessage(
new TranslatableComponent("civmodern.radar.enter",
player.getName(),
new TextComponent(Integer.toString(pos.getX()))
.withStyle(s -> s.applyFormat(ChatFormatting.AQUA)),
new TextComponent(Integer.toString(pos.getZ()))
new TextComponent(hideY() ? (pos.getX() + " " + pos.getZ()) : (pos.getX() + " " + pos.getY() + " " + pos.getZ()))
.withStyle(s -> s.applyFormat(ChatFormatting.AQUA)))
.setStyle(Style.EMPTY
.withClickEvent(
Expand All @@ -123,14 +125,12 @@ public void onWorldTickPing(ClientTickEvent event) {
if (!newPlayersInRange.contains(player)) {
BlockPos pos = player.blockPosition();
String lastWaypointCommand =
"/newWaypoint x:" + pos.getX() + ",y:" + Minecraft.getInstance().player.getBlockY() + ",z:" + pos.getZ() + ",name:"
"/newWaypoint x:" + pos.getX() + ",y:" + (hideY() ? Minecraft.getInstance().player.getBlockY() : pos.getY()) + ",z:" + pos.getZ() + ",name:"
+ player.getScoreboardName();
Minecraft.getInstance().player.displayClientMessage(
new TranslatableComponent("civmodern.radar.leave",
player.getName(),
new TextComponent(Integer.toString(pos.getX()))
.withStyle(s -> s.applyFormat(ChatFormatting.AQUA)),
new TextComponent(Integer.toString(pos.getZ()))
new TextComponent(hideY() ? (pos.getX() + " " + pos.getZ()) : (pos.getX() + " " + pos.getY() + " " + pos.getZ()))
.withStyle(s -> s.applyFormat(ChatFormatting.AQUA)))
.setStyle(Style.EMPTY
.withClickEvent(
Expand Down Expand Up @@ -312,7 +312,7 @@ private void renderPlayers(PoseStack matrices, float delta) {
RenderSystem.disableBlend();
matrices.scale(0.6f, 0.6f, 0);
TextComponent component = new TextComponent(
player.getScoreboardName() + " (" + ((int) Math.round(Math.sqrt(dx * dx + dz * dz)) + ")"));
player.getScoreboardName() + " (" + (hideY() ? ((int) Math.round(Math.sqrt(dx * dx + dz * dz))) : (int) player.getY()) + ")");
minecraft.font.draw(matrices, component, -minecraft.font.width(component) / 2f, 7, 0xffffff);

matrices.popPose();
Expand Down
4 changes: 2 additions & 2 deletions common/src/main/resources/assets/civmodern/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"civmodern.screen.ice.eat.disable": "Auto eat held item: Disabled",
"civmodern.screen.ice.stop.enable": "Stop on low food: Enabled",
"civmodern.screen.ice.stop.disable": "Stop on low food: Disabled",
"civmodern.radar.enter" : "§r%s §eappeared at §b[%s %s§b]",
"civmodern.radar.enter" : "§r%s §eappeared at §b[%s§b]",
"civmodern.radar.hover" : "Click to highlight position\nControl click to add waypoint",
"civmodern.radar.leave" : "§r%s §edisappeared at §b[%s %s§b]"
"civmodern.radar.leave" : "§r%s §edisappeared at §b[%s§b]"
}

0 comments on commit b7f4a42

Please sign in to comment.