diff --git a/common/src/main/java/sh/okx/civmodern/common/radar/Radar.java b/common/src/main/java/sh/okx/civmodern/common/radar/Radar.java index 50a84f4..870d612 100644 --- a/common/src/main/java/sh/okx/civmodern/common/radar/Radar.java +++ b/common/src/main/java/sh/okx/civmodern/common/radar/Radar.java @@ -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) { @@ -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( @@ -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( @@ -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(); diff --git a/common/src/main/resources/assets/civmodern/lang/en_us.json b/common/src/main/resources/assets/civmodern/lang/en_us.json index 62f3c75..412e03c 100644 --- a/common/src/main/resources/assets/civmodern/lang/en_us.json +++ b/common/src/main/resources/assets/civmodern/lang/en_us.json @@ -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]" } \ No newline at end of file