diff --git a/src/main/java/dev/dubhe/gugle/carpet/commands/HereCommand.java b/src/main/java/dev/dubhe/gugle/carpet/commands/HereCommand.java index 8aadc3d..a5e8e3d 100644 --- a/src/main/java/dev/dubhe/gugle/carpet/commands/HereCommand.java +++ b/src/main/java/dev/dubhe/gugle/carpet/commands/HereCommand.java @@ -58,6 +58,23 @@ public static int execute(@NotNull CommandContext context) { ) .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal(dimension.location().toString()))) ); + double scale = 0; + if (dimension == Level.NETHER) { + scale = 8; + } else if (dimension == Level.OVERWORLD) { + scale = 0.125; + } + MutableComponent toPos = Component.literal("[%.2f, %.2f, %.2f]".formatted(position.x * scale, position.y * scale, position.z * scale)).withStyle( + Style.EMPTY + .applyFormat( + dimension == Level.OVERWORLD ? + ChatFormatting.RED : + dimension == Level.NETHER ? + ChatFormatting.GREEN : + ChatFormatting.AQUA + ) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal(dimension.location().toString()))) + ); MutableComponent addMap = Component.literal("[+X]").withStyle( Style.EMPTY .applyFormat(ChatFormatting.GREEN) @@ -74,8 +91,8 @@ public static int execute(@NotNull CommandContext context) { ) )) ); - return Component.literal("%s at".formatted(name)) - .append(" ").append(pos) - .append(" ").append(addMap); + MutableComponent component = Component.literal("%s at".formatted(name)).append(" ").append(pos); + if (scale > 0) component.append("->").append(toPos); + return component.append(" ").append(addMap); } } diff --git a/src/main/java/dev/dubhe/gugle/carpet/commands/LocCommand.java b/src/main/java/dev/dubhe/gugle/carpet/commands/LocCommand.java index ececc86..7d65e7c 100644 --- a/src/main/java/dev/dubhe/gugle/carpet/commands/LocCommand.java +++ b/src/main/java/dev/dubhe/gugle/carpet/commands/LocCommand.java @@ -187,6 +187,23 @@ public static int list(CommandContext context) { ) .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal(locPoint.dimType.location().toString()))) ); + double scale = 0; + if (locPoint.dimType == Level.NETHER) { + scale = 8; + } else if (locPoint.dimType == Level.OVERWORLD) { + scale = 0.125; + } + MutableComponent toPos = Component.literal("[%.2f, %.2f, %.2f]".formatted(locPoint.x * scale, locPoint.y * scale, locPoint.z * scale)).withStyle( + Style.EMPTY + .applyFormat( + locPoint.dimType == Level.OVERWORLD ? + ChatFormatting.RED : + locPoint.dimType == Level.NETHER ? + ChatFormatting.GREEN : + ChatFormatting.AQUA + ) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, Component.literal(locPoint.dimType.location().toString()))) + ); MutableComponent addMap = Component.literal("[+X]").withStyle( Style.EMPTY .applyFormat(ChatFormatting.GREEN) @@ -208,8 +225,10 @@ public static int list(CommandContext context) { .applyFormat(ChatFormatting.RED) .withClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, "/loc remove %s".formatted(locPoint.id))) ); - return Component.literal("▶ ").append(component) - .append(" ").append(pos) + MutableComponent component1 = Component.literal("▶ ").append(component) + .append(" ").append(pos); + if (scale > 0) component1.append("->").append(toPos); + return component1 .append(" ").append(addMap) .append(" ").append(remove); }