|
| 1 | +package com.nxyi.addon.modules; |
| 2 | + |
| 3 | +import com.nxyi.addon.Addon; |
| 4 | +import com.nxyi.addon.Utils.JinxUtils; |
| 5 | +import com.nxyi.addon.Utils.Line; |
| 6 | +import meteordevelopment.meteorclient.events.world.PlaySoundEvent; |
| 7 | +import meteordevelopment.meteorclient.events.world.TickEvent; |
| 8 | +import meteordevelopment.meteorclient.systems.modules.Module; |
| 9 | +import meteordevelopment.meteorclient.utils.player.Rotations; |
| 10 | +import meteordevelopment.orbit.EventHandler; |
| 11 | +import net.minecraft.command.argument.EntityAnchorArgumentType; |
| 12 | +import net.minecraft.entity.Entity; |
| 13 | +import net.minecraft.entity.EyeOfEnderEntity; |
| 14 | +import net.minecraft.item.EnderEyeItem; |
| 15 | +import net.minecraft.util.math.Direction; |
| 16 | +import net.minecraft.util.math.Vec3d; |
| 17 | +import org.reflections.vfs.Vfs; |
| 18 | + |
| 19 | +public class StrongholdFinder extends Module { |
| 20 | + private boolean hasstarted =false; |
| 21 | + private boolean hasfinished = false; |
| 22 | + private double rot1 = 0; |
| 23 | + private double rot2 = 0; |
| 24 | + private Vec3d pos1 = new Vec3d(0,0,0); |
| 25 | + private Vec3d pos2 = new Vec3d(0,0,0); |
| 26 | + |
| 27 | + private int timer = 0; |
| 28 | + |
| 29 | + public StrongholdFinder() { |
| 30 | + super(Addon.CATEGORY, "StrongholdFinder", "Triangulation Stronghold location"); |
| 31 | + } |
| 32 | + |
| 33 | + @Override |
| 34 | + public void onActivate() { |
| 35 | + hasstarted = false; |
| 36 | + hasfinished =false; |
| 37 | + } |
| 38 | + |
| 39 | + @EventHandler |
| 40 | + private void onthrow(TickEvent.Pre event){ |
| 41 | + if (timer > 0){ |
| 42 | + timer--; |
| 43 | + } |
| 44 | + |
| 45 | + if (hasfinished){ |
| 46 | + info("3"); |
| 47 | + hasfinished = false; |
| 48 | + |
| 49 | + Vec3d intersection = Line.getIntersection(pos1.x, pos1.z, rot1, pos2.x, pos2.z, rot2); |
| 50 | + info("Stronghold location: (highlight) %s ~ %s", (int)intersection.x, (int)intersection.z); |
| 51 | + toggle(); |
| 52 | + } |
| 53 | + } |
| 54 | + |
| 55 | + @EventHandler |
| 56 | + private void onsound(PlaySoundEvent event){ |
| 57 | + if (event.sound.getId().getPath().equals("entity.ender_eye.launch")){ |
| 58 | + if (timer > 0) return; |
| 59 | + else timer = 20; |
| 60 | + |
| 61 | + |
| 62 | + if (!hasstarted) { |
| 63 | + new Thread(() -> { |
| 64 | + info("1"); |
| 65 | + JinxUtils.sleep(1000); |
| 66 | + Entity eye = findeye(); |
| 67 | + pos1 = mc.player.getPos(); |
| 68 | + |
| 69 | + rot1 = Rotations.getYaw(eye); |
| 70 | + |
| 71 | + hasstarted = true; |
| 72 | + }).start(); |
| 73 | + } else { |
| 74 | + new Thread(() -> { |
| 75 | + JinxUtils.sleep(1000); |
| 76 | + info("2"); |
| 77 | + Entity eye = findeye(); |
| 78 | + pos2 = mc.player.getPos(); |
| 79 | + |
| 80 | + rot2 = Rotations.getYaw(eye); |
| 81 | + |
| 82 | + hasfinished = true; |
| 83 | + }).start(); |
| 84 | + } |
| 85 | + } |
| 86 | + } |
| 87 | + |
| 88 | + private Entity findeye(){ |
| 89 | + Entity found = null; |
| 90 | + for (Entity eye : mc.world.getEntities()){ |
| 91 | + if(eye instanceof EyeOfEnderEntity){ |
| 92 | + found = eye; |
| 93 | + } |
| 94 | + } |
| 95 | + return found; |
| 96 | + } |
| 97 | +} |
0 commit comments