Skip to content

Commit

Permalink
fix end city locator and include distance in notification
Browse files Browse the repository at this point in the history
  • Loading branch information
acheong08 committed Mar 8, 2024
1 parent b9c1ec1 commit 2994d30
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ configurations {

dependencies {
// This will make it work on most platforms. It automatically chooses the right dependencies at runtime.
extraLibs('dev.duti.acheong:cubiomes:1.22.1') { transitive = false }
extraLibs('dev.duti.acheong:cubiomes:1.22.1:linux64') { transitive = false }
extraLibs('dev.duti.acheong:cubiomes:1.22.1:osx') { transitive = false }
extraLibs('dev.duti.acheong:cubiomes:1.22.1:windows64') { transitive = false }
extraLibs('dev.duti.acheong:cubiomes:1.22.2') { transitive = false }
extraLibs('dev.duti.acheong:cubiomes:1.22.2:linux64') { transitive = false }
extraLibs('dev.duti.acheong:cubiomes:1.22.2:osx') { transitive = false }
extraLibs('dev.duti.acheong:cubiomes:1.22.2:windows64') { transitive = false }
// To change the versions see the gradle.properties file
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_version}:v2"
Expand Down
5 changes: 5 additions & 0 deletions src/main/java/anticope/rejects/commands/LocateCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,17 @@ public void build(LiteralArgumentBuilder<CommandSource> builder) {

}
if (pos != null) {
// Calculate distance
int distance = (int) Math.hypot(pos.x - playerPos.getX(), pos.z - playerPos.getZ());
MutableText text = Text.literal(String.format(
"%s located at ",
Utils.nameToTitle(feature.toString().replaceAll("_", "-"))));
Vec3d coords = new Vec3d(pos.x, 0, pos.z);
text.append(ChatUtils.formatCoords(coords));
text.append(".");
if (distance > 0) {
text.append(String.format(" (%d blocks away)", distance));
}
info(text);
return SINGLE_SUCCESS;
}
Expand Down

0 comments on commit 2994d30

Please sign in to comment.