| 1 | package thunder.hack.features.modules.combat;
|
| 2 |
|
| 3 | import meteordevelopment.orbit.EventHandler;
|
| 4 | import net.minecraft.network.protocol.game.*;
|
| 5 | import net.minecraft.world.InteractionHand;
|
| 6 | import net.minecraft.world.item.Items;
|
| 7 | import thunder.hack.events.impl.PacketEvent;
|
| 8 | import thunder.hack.features.modules.Module;
|
| 9 | import thunder.hack.setting.Setting;
|
| 10 | import thunder.hack.setting.impl.SettingGroup;
|
| 11 | import thunder.hack.utility.Timer;
|
| 12 | import java.util.Random;
|
| 13 |
|
| 14 | public final class BowPop extends Module {
|
| 15 | public Setting<Boolean> rotation = new Setting<>("Rotation", false);
|
| 16 | public Setting<ModeEn> Mode = new Setting<>("Mode", ModeEn.Maximum);
|
| 17 | public Setting<Float> factor = new Setting<>("Factor", 1f, 1f, 20f);
|
| 18 | public Setting<exploitEn> exploit = new Setting<>("Exploit", exploitEn.Strong);
|
| 19 | public Setting<Float> scale = new Setting<>("Scale", 0.01f, 0.01f, 0.4f);
|
| 20 | public Setting<Boolean> minimize = new Setting<>("Minimize", false);
|
| 21 | public Setting<Float> delay = new Setting<>("Delay", 5f, 0f, 10f);
|
| 22 | public final Setting<SettingGroup> selection = new Setting<>("Selection", new SettingGroup(false, 0));
|
| 23 | public final Setting<Boolean> bow = new Setting<>("Bows", true).addToGroup(selection);
|
| 24 | public final Setting<Boolean> pearls = new Setting<>("EPearls", true).addToGroup(selection);
|
| 25 | public final Setting<Boolean> xp = new Setting<>("XP", true).addToGroup(selection);
|
| 26 | public final Setting<Boolean> eggs = new Setting<>("Eggs", true).addToGroup(selection);
|
| 27 | public final Setting<Boolean> potions = new Setting<>("SplashPotions", true).addToGroup(selection);
|
| 28 | public final Setting<Boolean> snowballs = new Setting<>("Snowballs", true).addToGroup(selection);
|
| 29 |
|
| 30 | public static Timer delayTimer = new Timer();
|
| 31 | private final Random rnd = new Random();
|
| 32 |
|
| 33 | public BowPop() {
|
| 34 | super("BowPop", Category.COMBAT);
|
| 35 | }
|
| 36 |
|
| 37 | @EventHandler
|
| 38 | private void onPacketSend(PacketEvent.Send event) {
|
| 39 | if (fullNullCheck() || !delayTimer.passedMs((long) (delay.getValue() * 1000))) return;
|
| 40 | if (event.getPacket() instanceof ServerboundPlayerActionPacket && ((ServerboundPlayerActionPacket) event.getPacket()).getAction() == ServerboundPlayerActionPacket.Action.RELEASE_USE_ITEM && (mc.player.getUseItem().getItem() == Items.BOW && bow.getValue())
|
| 41 | || event.getPacket() instanceof ServerboundUseItemPacket && ((ServerboundUseItemPacket) event.getPacket()).getHand() == InteractionHand.MAIN_HAND && ((mc.player.getMainHandItem().getItem() == Items.ENDER_PEARL && pearls.getValue()) || (mc.player.getMainHandItem().getItem() == Items.EXPERIENCE_BOTTLE && xp.getValue()) || (mc.player.getMainHandItem().getItem() == Items.EGG && eggs.getValue()) || (mc.player.getMainHandItem().getItem() == Items.SPLASH_POTION && potions.getValue()) || (mc.player.getMainHandItem().getItem() == Items.SNOWBALL && snowballs.getValue()))) {
|
| 42 |
|
| 43 | mc.player.connection.send(new ServerboundPlayerCommandPacket(mc.player, ServerboundPlayerCommandPacket.Action.START_SPRINTING));
|
| 44 |
|
| 45 | double[] strict_direction = new double[]{100f * -Math.sin(Math.toRadians(mc.player.getYRot())), 100f * Math.cos(Math.toRadians(mc.player.getYRot()))};
|
| 46 |
|
| 47 | if (exploit.getValue() == exploitEn.Fast) {
|
| 48 | for (int i = 0; i < getRuns(); i++) {
|
| 49 | spoof(mc.player.getX(), minimize.getValue() ? mc.player.getY() : mc.player.getY() - 1e-10, mc.player.getZ(), true);
|
| 50 | spoof(mc.player.getX(), mc.player.getY() + 1e-10, mc.player.getZ(), false);
|
| 51 | }
|
| 52 | }
|
| 53 | if (exploit.getValue() == exploitEn.Strong) {
|
| 54 | for (int i = 0; i < getRuns(); i++) {
|
| 55 | spoof(mc.player.getX(), mc.player.getY() + 1e-10, mc.player.getZ(), false);
|
| 56 | spoof(mc.player.getX(), minimize.getValue() ? mc.player.getY() : mc.player.getY() - 1e-10, mc.player.getZ(), true);
|
| 57 | }
|
| 58 | }
|
| 59 | if (exploit.getValue() == exploitEn.Phobos) {
|
| 60 | for (int i = 0; i < getRuns(); i++) {
|
| 61 | spoof(mc.player.getX(), mc.player.getY() + 0.00000000000013, mc.player.getZ(), true);
|
| 62 | spoof(mc.player.getX(), mc.player.getY() + 0.00000000000027, mc.player.getZ(), false);
|
| 63 | }
|
| 64 | }
|
| 65 | if (exploit.getValue() == exploitEn.Strict) {
|
| 66 | for (int i = 0; i < getRuns(); i++) {
|
| 67 | if (rnd.nextBoolean()) {
|
| 68 | spoof(mc.player.getX() - strict_direction[0], mc.player.getY(), mc.player.getZ() - strict_direction[1], false);
|
| 69 | } else {
|
| 70 | spoof(mc.player.getX() + strict_direction[0], mc.player.getY(), mc.player.getZ() + strict_direction[1], true);
|
| 71 | }
|
| 72 | }
|
| 73 | }
|
| 74 | if (exploit.getValue() == exploitEn.WB) {
|
| 75 | for (int i = 0; i < getRuns(); i++) {
|
| 76 | spoof(mc.player.getX() + getWorldBorderRnd(), mc.player.getY(), mc.player.getZ() + getWorldBorderRnd(), false);
|
| 77 | }
|
| 78 | }
|
| 79 | delayTimer.reset();
|
| 80 | }
|
| 81 | }
|
| 82 |
|
| 83 | private void spoof(double x, double y, double z, boolean ground) {
|
| 84 | if (rotation.getValue())
|
| 85 | sendPacket(new ServerboundMovePlayerPacket.PosRot(x, y, z, mc.player.getYRot(), mc.player.getXRot(), ground, mc.player.horizontalCollision));
|
| 86 | else sendPacket(new ServerboundMovePlayerPacket.Pos(x, y, z, ground, mc.player.horizontalCollision));
|
| 87 | }
|
| 88 |
|
| 89 | private int getRuns() {
|
| 90 | return switch (Mode.getValue()) {
|
| 91 | case Normal -> (int) Math.floor(factor.getValue());
|
| 92 | case Maximum -> (int) (30f * factor.getValue());
|
| 93 | case Factorised -> 10 + (int) ((factor.getValue() - 1));
|
| 94 | };
|
| 95 | }
|
| 96 |
|
| 97 | private int getWorldBorderRnd() {
|
| 98 | if (mc.isLocalServer()) return 1;
|
| 99 |
|
| 100 | int n = rnd.nextInt(29000000);
|
| 101 | if (rnd.nextBoolean()) return n;
|
| 102 | return -n;
|
| 103 | }
|
| 104 |
|
| 105 | private enum exploitEn {
|
| 106 | Strong, Fast, Strict, Phobos, WB
|
| 107 | }
|
| 108 |
|
| 109 | private enum ModeEn {
|
| 110 | Normal, Maximum, Factorised
|
| 111 | }
|
| 112 | }
|
| 113 |
|