aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/org/chrisoft/trashyaddon/commands/EntityDataCommand.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/org/chrisoft/trashyaddon/commands/EntityDataCommand.java')
-rw-r--r--src/main/java/org/chrisoft/trashyaddon/commands/EntityDataCommand.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/src/main/java/org/chrisoft/trashyaddon/commands/EntityDataCommand.java b/src/main/java/org/chrisoft/trashyaddon/commands/EntityDataCommand.java
new file mode 100644
index 0000000..562860a
--- /dev/null
+++ b/src/main/java/org/chrisoft/trashyaddon/commands/EntityDataCommand.java
@@ -0,0 +1,47 @@
+package org.chrisoft.trashyaddon.commands;
+
+import com.mojang.brigadier.builder.LiteralArgumentBuilder;
+import meteordevelopment.meteorclient.commands.Command;
+import net.minecraft.command.CommandSource;
+import net.minecraft.nbt.NbtCompound;
+import net.minecraft.text.Text;
+import net.minecraft.util.math.Box;
+import net.minecraft.entity.projectile.ProjectileUtil;
+import net.minecraft.client.MinecraftClient;
+import net.minecraft.entity.Entity;
+import net.minecraft.util.math.Vec3d;
+import net.minecraft.util.hit.EntityHitResult;
+
+import static com.mojang.brigadier.Command.SINGLE_SUCCESS;
+
+public class EntityDataCommand extends Command {
+ private final MinecraftClient mc = MinecraftClient.getInstance();
+ public EntityDataCommand() {
+ super("ed", "Erectile Dysfunction /s (Dump client side data of targeted entity.)");
+ }
+
+ @Override
+ public void build(LiteralArgumentBuilder<CommandSource> builder) {
+ builder.executes(context -> {
+ //info("erectile dysfunction start");
+ double RANGE = 5;
+ Entity player = mc.cameraEntity;
+ Vec3d rot = player.getRotationVec(mc.getTickDelta());
+ Vec3d min = player.getCameraPosVec(mc.getTickDelta());
+ Vec3d max = min.add(rot.multiply(RANGE));
+ Box box = player.getBoundingBox().stretch(rot.multiply(RANGE));
+ EntityHitResult eh = ProjectileUtil.raycast(player, min, max, box, x -> true ,RANGE * RANGE);
+ if (eh == null) {
+ error("no entity found");
+ return 100;
+ }
+ Entity e = eh.getEntity();
+ info(Text.literal("entity is ").append(e.getType().getName()));
+ NbtCompound d = new NbtCompound();
+ e.writeNbt(d);
+ info(d.toString());
+
+ return SINGLE_SUCCESS;
+ });
+ }
+}