package org.chrisoft.trashyaddon.commands; import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import meteordevelopment.meteorclient.commands.Command; import net.minecraft.command.CommandSource; import net.minecraft.entity.EntityType; import net.minecraft.entity.decoration.ItemFrameEntity; import net.minecraft.client.MinecraftClient; import net.minecraft.entity.Entity; import java.text.Format; import java.util.Formatter; import java.util.OptionalInt; import static com.mojang.brigadier.Command.SINGLE_SUCCESS; public class MapLocateCommand extends Command { private final MinecraftClient mc = MinecraftClient.getInstance(); public MapLocateCommand() { super("ml", "Find item frames with a certain map in them. Will eventually be replaced with an enhanced ESP module."); } @Override public void build(LiteralArgumentBuilder builder) { builder.then(argument("id", IntegerArgumentType.integer()).executes(context -> { int targetID = IntegerArgumentType.getInteger(context, "id"); for (Entity e : mc.world.getEntities()) { if (e.getType() != EntityType.ITEM_FRAME && e.getType() != EntityType.GLOW_ITEM_FRAME) continue; ItemFrameEntity ife = (ItemFrameEntity) e; OptionalInt oid = ife.getMapId(); if (oid.isEmpty()) continue; int id = oid.getAsInt(); Formatter fmt = new Formatter(); if (id == targetID) info(fmt.format("Map frame found at %.2f %.2f %.2f", ife.getPos().x, ife.getPos().y, ife.getPos().z).toString()); } return SINGLE_SUCCESS; })); } }