@@ -0,0 +1,2456 @@
+package info.u_team.u_team_core.intern.command.uteamcore;%0A%0Aimport com.mojang.brigadier.builder.ArgumentBuilder;%0Aimport com.mojang.brigadier.exceptions.*;%0A%0Aimport net.minecraft.command.*;%0Aimport net.minecraft.command.arguments.ResourceLocationArgument;%0Aimport net.minecraft.util.ResourceLocation;%0Aimport net.minecraft.util.math.*;%0Aimport net.minecraft.util.text.*;%0Aimport net.minecraft.util.text.event.*;%0Aimport net.minecraftforge.registries.GameData;%0A%0Apublic class LocateStructureSubCommand %7B%0A%09%0A%09private static final SimpleCommandExceptionType FAILED_EXCEPTION = new SimpleCommandExceptionType(new TranslationTextComponent(%22commands.locate.failed%22));%0A%09%0A%09public static ArgumentBuilder%3CCommandSource, ?%3E register() %7B%0A%09%09return Commands.literal(%22locatestructure%22) //%0A%09%09%09%09.requires(source -%3E source.hasPermissionLevel(2)) //%0A%09%09%09%09.then(Commands.argument(%22structure%22, ResourceLocationArgument.resourceLocation()) //%0A%09%09%09%09%09%09.suggests((context, builder) -%3E ISuggestionProvider.suggest(GameData.getStructureFeatures().keySet().stream().map(ResourceLocation::toString), builder)) //%0A%09%09%09%09%09%09.executes(context -%3E locateStructure(context.getSource(), context.getArgument(%22structure%22, ResourceLocation.class))));%0A%09%7D%0A%09%0A%09private static int locateStructure(CommandSource source, ResourceLocation structureName) throws CommandSyntaxException %7B%0A%09%09final BlockPos pos = new BlockPos(source.getPos());%0A%09%09%0A%09%09final BlockPos foundPos = source.getWorld().findNearestStructure(structureName.toString(), pos, 100, false);%0A%09%09%0A%09%09if (foundPos == null) %7B%0A%09%09%09throw FAILED_EXCEPTION.create();%0A%09%09%7D%0A%09%09%0A%09%09final int distance = MathHelper.floor(getDistance(pos.getX(), pos.getZ(), foundPos.getX(), foundPos.getZ()));%0A%09%09%0A%09%09final ITextComponent text = TextComponentUtils.wrapInSquareBrackets(new TranslationTextComponent(%22chat.coordinates%22, foundPos.getX(), %22~%22, foundPos.getZ())).applyTextStyle((style) -%3E %7B%0A%09%09%09style.setColor(TextFormatting.GREEN).setClickEvent(new ClickEvent(ClickEvent.Action.SUGGEST_COMMAND, %22/tp @s %22 + foundPos.getX() + %22 ~ %22 + foundPos.getZ())).setHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new TranslationTextComponent(%22chat.coordinates.tooltip%22)));%0A%09%09%7D);%0A%09%09source.sendFeedback(new TranslationTextComponent(%22commands.locate.success%22, structureName, text, distance), false);%0A%09%09%0A%09%09return distance;%0A%09%7D%0A%09%0A%09private static float getDistance(int x1, int z1, int x2, int z2) %7B%0A%09%09int i = x2 - x1;%0A%09%09int j = z2 - z1;%0A%09%09return MathHelper.sqrt((float) (i * i + j * j));%0A%09%7D%0A%7D%0A

Add locate structure code