auto-wasp module

auto-wasp: Minecraft 26.3 cheat module, full source for every implementation (1 client: Meteor Client).

1 implementationMovement

Clients with this module

Full module source: 1 implementation

Every implementation below is the complete module file, verbatim. Expand a client to read its code.

Meteor ClientMovementsrc/main/java/meteordevelopment/meteorclient/systems/modules/movement/AutoWasp.javaJava · 231 lines · 8.5 KB

Wasps for you. Unable to traverse around blocks, assumes a clear straight line to the target.

Settingshorizontal-speedvertical-speedavoid-landingpredict-movementonly-friendsaction-on-target-lossoffset
AutoWasp.javaJava · Minecraft 26.2 · 231 lines · 8.5 KB · complete file, verbatimOriginal ↗
1
/*
2
 * This file is part of the Meteor Client distribution (https://github.com/MeteorDevelopment/meteor-client).
3
 * Copyright (c) Meteor Development.
4
 */
5
6
package meteordevelopment.meteorclient.systems.modules.movement;
7
8
import meteordevelopment.meteorclient.events.entity.player.PlayerMoveEvent;
9
import meteordevelopment.meteorclient.events.world.TickEvent;
10
import meteordevelopment.meteorclient.mixin.BlockBehaviourAccessor;
11
import meteordevelopment.meteorclient.mixin.DirectionAccessor;
12
import meteordevelopment.meteorclient.mixininterface.IVec3;
13
import meteordevelopment.meteorclient.settings.*;
14
import meteordevelopment.meteorclient.systems.friends.Friends;
15
import meteordevelopment.meteorclient.systems.modules.Categories;
16
import meteordevelopment.meteorclient.systems.modules.Module;
17
import meteordevelopment.meteorclient.utils.entity.SortPriority;
18
import meteordevelopment.meteorclient.utils.entity.TargetUtils;
19
import meteordevelopment.orbit.EventHandler;
20
import net.minecraft.ChatFormatting;
21
import net.minecraft.core.BlockPos;
22
import net.minecraft.core.Direction;
23
import net.minecraft.core.component.DataComponents;
24
import net.minecraft.network.chat.Component;
25
import net.minecraft.network.protocol.common.ClientboundDisconnectPacket;
26
import net.minecraft.network.protocol.game.ServerboundPlayerCommandPacket;
27
import net.minecraft.world.entity.Entity;
28
import net.minecraft.world.entity.EquipmentSlot;
29
import net.minecraft.world.entity.player.Player;
30
import net.minecraft.world.phys.Vec3;
31
import org.joml.Vector3d;
32
33
public class AutoWasp extends Module {
34
    private final SettingGroup sgGeneral = settings.getDefaultGroup();
35
36
    private final Setting<Double> horizontalSpeed = sgGeneral.add(new DoubleSetting.Builder()
37
        .name("horizontal-speed")
38
        .description("Horizontal elytra speed.")
39
        .defaultValue(2.0)
40
        .build()
41
    );
42
43
    private final Setting<Double> verticalSpeed = sgGeneral.add(new DoubleSetting.Builder()
44
        .name("vertical-speed")
45
        .description("Vertical elytra speed.")
46
        .defaultValue(3.0)
47
        .build()
48
    );
49
50
    private final Setting<Boolean> avoidLanding = sgGeneral.add(new BoolSetting.Builder()
51
        .name("avoid-landing")
52
        .description("Will try to avoid landing if your target is on the ground.")
53
        .defaultValue(true)
54
        .build()
55
    );
56
57
    private final Setting<Boolean> predictMovement = sgGeneral.add(new BoolSetting.Builder()
58
        .name("predict-movement")
59
        .description("Tries to predict the targets position according to their movement.")
60
        .defaultValue(true)
61
        .build()
62
    );
63
64
    private final Setting<Boolean> onlyFriends = sgGeneral.add(new BoolSetting.Builder()
65
        .name("only-friends")
66
        .description("Will only follow friends.")
67
        .defaultValue(false)
68
        .build()
69
    );
70
71
    private final Setting<Action> action = sgGeneral.add(new EnumSetting.Builder<Action>()
72
        .name("action-on-target-loss")
73
        .description("What to do if you lose the target.")
74
        .defaultValue(Action.TOGGLE)
75
        .build()
76
    );
77
78
    private final Setting<Vector3d> offset = sgGeneral.add(new Vector3dSetting.Builder()
79
        .name("offset")
80
        .description("How many blocks offset to wasp at from the target.")
81
        .defaultValue(0, 0, 0)
82
        .build()
83
    );
84
85
    public Player target;
86
    private int jumpTimer = 0;
87
    private boolean incrementJumpTimer = false;
88
89
    public AutoWasp() {
90
        super(Categories.Movement, "auto-wasp", "Wasps for you. Unable to traverse around blocks, assumes a clear straight line to the target.");
91
    }
92
93
    @Override
94
    public void onActivate() {
95
        if (target == null || target.isRemoved()) {
96
            target = (Player) TargetUtils.get(entity -> {
97
                if (!(entity instanceof Player player) || entity == mc.player) return false;
98
                if (player.isDeadOrDying() || player.getHealth() <= 0) return false;
99
                return !onlyFriends.get() || Friends.get().get(player) != null;
100
            }, SortPriority.LowestDistance);
101
102
            if (target == null) {
103
                error("No valid targets.");
104
                toggle();
105
                return;
106
            } else info(target.getName().getString() + " set as target.");
107
        }
108
109
        jumpTimer = 0;
110
        incrementJumpTimer = false;
111
    }
112
113
    @Override
114
    public void onDeactivate() {
115
        target = null;
116
    }
117
118
    @EventHandler
119
    private void onTick(TickEvent.Pre event) {
120
        if (target.isRemoved()) {
121
            warning("Lost target!");
122
123
            switch (action.get()) {
124
                case CHOOSE_NEW_TARGET -> onActivate();
125
                case TOGGLE -> toggle();
126
                case DISCONNECT ->
127
                    mc.player.connection.handleDisconnect(new ClientboundDisconnectPacket(Component.literal("%s[%sAuto Wasp%s] Lost target.".formatted(ChatFormatting.GRAY, ChatFormatting.BLUE, ChatFormatting.GRAY))));
128
            }
129
130
            if (!isActive()) return;
131
        }
132
133
        if (!(mc.player.getItemBySlot(EquipmentSlot.CHEST).has(DataComponents.GLIDER))) return;
134
135
        if (incrementJumpTimer) {
136
            jumpTimer++;
137
        }
138
139
        if (!mc.player.isFallFlying()) {
140
            if (!incrementJumpTimer) incrementJumpTimer = true;
141
142
            if (mc.player.onGround() && incrementJumpTimer) {
143
                mc.player.jumpFromGround();
144
                return;
145
            }
146
147
            if (jumpTimer >= 4) {
148
                jumpTimer = 0;
149
                mc.player.setJumping(false);
150
                mc.player.setSprinting(true);
151
                mc.getConnection().send(new ServerboundPlayerCommandPacket(mc.player, ServerboundPlayerCommandPacket.Action.START_FALL_FLYING));
152
            }
153
        } else {
154
            incrementJumpTimer = false;
155
            jumpTimer = 0;
156
        }
157
    }
158
159
    @EventHandler
160
    private void onMove(PlayerMoveEvent event) {
161
        if (!(mc.player.getItemBySlot(EquipmentSlot.CHEST).has(DataComponents.GLIDER))) return;
162
        if (!mc.player.isFallFlying()) return;
163
164
        double xVel = 0, yVel = 0, zVel = 0;
165
166
        Vec3 targetPos = target.position().add(offset.get().x, offset.get().y, offset.get().z);
167
168
        if (predictMovement.get()) targetPos.add(Entity.collideBoundingBox(target, target.getDeltaMovement(),
169
            target.getBoundingBox(), mc.level, mc.level.getEntityCollisions(target, target.getBoundingBox().expandTowards(target.getDeltaMovement()))));
170
171
        if (avoidLanding.get()) {
172
            double d = target.getBoundingBox().getXsize() / 2; // x length = z length for players
173
174
            //get the block pos of the block underneath the corner of the targets bounding box
175
            for (Direction dir : DirectionAccessor.meteor$getHorizontal()) {
176
                BlockPos pos = BlockPos.containing(targetPos.relative(dir, d).relative(dir.getClockWise(), d)).below();
177
                if (((BlockBehaviourAccessor) mc.level.getBlockState(pos).getBlock()).meteor$isHasCollision() && Math.abs(targetPos.y() - (pos.getY() + 1)) <= 0.25) {
178
                    targetPos = new Vec3(targetPos.x, pos.getY() + 1.25, targetPos.z);
179
                    break;
180
                }
181
            }
182
        }
183
184
        double xDist = targetPos.x() - mc.player.getX();
185
        double zDist = targetPos.z() - mc.player.getZ();
186
187
        double absX = Math.abs(xDist);
188
        double absZ = Math.abs(zDist);
189
190
        double diag = 0;
191
        if (absX > 1.0E-5F && absZ > 1.0E-5F) diag = 1 / Math.sqrt(absX * absX + absZ * absZ);
192
193
        if (absX > 1.0E-5F) {
194
            if (absX < horizontalSpeed.get()) xVel = xDist;
195
            else xVel = horizontalSpeed.get() * Math.signum(xDist);
196
197
            if (diag != 0) xVel *= (absX * diag);
198
        }
199
200
        if (absZ > 1.0E-5F) {
201
            if (absZ < horizontalSpeed.get()) zVel = zDist;
202
            else zVel = horizontalSpeed.get() * Math.signum(zDist);
203
204
            if (diag != 0) zVel *= (absZ * diag);
205
        }
206
207
        double yDist = targetPos.y() - mc.player.getY();
208
        if (Math.abs(yDist) > 1.0E-5F) {
209
            if (Math.abs(yDist) < verticalSpeed.get()) yVel = yDist;
210
            else yVel = verticalSpeed.get() * Math.signum(yDist);
211
        }
212
213
        ((IVec3) event.movement).meteor$set(xVel, yVel, zVel);
214
    }
215
216
    public enum Action {
217
        TOGGLE,
218
        CHOOSE_NEW_TARGET,
219
        DISCONNECT;
220
221
        @Override
222
        public String toString() {
223
            return switch (this) {
224
                case TOGGLE -> "Toggle module";
225
                case CHOOSE_NEW_TARGET -> "Choose new target";
226
                case DISCONNECT -> "Disconnect";
227
            };
228
        }
229
    }
230
}
231