click-tp module

click-tp: 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/ClickTP.javaJava · 92 lines · 4.1 KB

Teleports you to the block you click on.

ClickTP.javaJava · Minecraft 26.2 · 92 lines · 4.1 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.world.TickEvent;
9
import meteordevelopment.meteorclient.systems.modules.Categories;
10
import meteordevelopment.meteorclient.systems.modules.Module;
11
import meteordevelopment.orbit.EventHandler;
12
import net.minecraft.client.Camera;
13
import net.minecraft.core.BlockPos;
14
import net.minecraft.core.Direction;
15
import net.minecraft.network.protocol.game.ServerboundMovePlayerPacket;
16
import net.minecraft.world.InteractionHand;
17
import net.minecraft.world.InteractionResult;
18
import net.minecraft.world.item.BlockItem;
19
import net.minecraft.world.item.ItemUseAnimation;
20
import net.minecraft.world.level.ClipContext;
21
import net.minecraft.world.level.block.state.BlockState;
22
import net.minecraft.world.phys.BlockHitResult;
23
import net.minecraft.world.phys.EntityHitResult;
24
import net.minecraft.world.phys.HitResult;
25
import net.minecraft.world.phys.Vec3;
26
import net.minecraft.world.phys.shapes.VoxelShape;
27
28
public class ClickTP extends Module {
29
30
    public ClickTP() {
31
        super(Categories.Movement, "click-tp", "Teleports you to the block you click on.");
32
    }
33
34
    @EventHandler
35
    private void onTick(TickEvent.Post event) {
36
        if (mc.player.getInventory().getSelectedItem().getUseAnimation() != ItemUseAnimation.NONE) return;
37
        if (!mc.options.keyUse.isDown()) return;
38
39
        if (mc.hitResult != null) {
40
            if (mc.hitResult.getType() == HitResult.Type.ENTITY && mc.player.interactOn(((EntityHitResult) mc.hitResult).getEntity(), InteractionHand.MAIN_HAND, mc.hitResult.getLocation()) != InteractionResult.PASS)
41
                return;
42
            if (mc.hitResult.getType() == HitResult.Type.BLOCK && mc.player.getMainHandItem().getItem() instanceof BlockItem)
43
                return;
44
        }
45
46
        Camera camera = mc.gameRenderer.mainCamera();
47
        Vec3 cameraPos = camera.position();
48
49
        // Calculate the direction the camera is looking based on its pitch and yaw, and extend this direction 210 units away from the camera position
50
        // 210 is used here as the maximum distance for this exploit is 200 blocks
51
        // This is done to be able to click tp while in freecam
52
        Vec3 direction = Vec3.directionFromRotation(camera.xRot(), camera.yRot()).scale(210);
53
        Vec3 targetPos = cameraPos.add(direction);
54
55
        ClipContext context = new ClipContext(
56
            cameraPos,   // start position of the ray
57
            targetPos,   // end position of the ray
58
            ClipContext.Block.OUTLINE,
59
            ClipContext.Fluid.NONE,
60
            mc.player
61
        );
62
63
        BlockHitResult hitResult = mc.level.clip(context);
64
65
        if (hitResult.getType() == HitResult.Type.BLOCK) {
66
            BlockPos pos = hitResult.getBlockPos();
67
            Direction side = hitResult.getDirection();
68
69
            if (mc.level.getBlockState(pos).useWithoutItem(mc.level, mc.player, hitResult) != InteractionResult.PASS)
70
                return;
71
72
            BlockState state = mc.level.getBlockState(pos);
73
74
            VoxelShape shape = state.getCollisionShape(mc.level, pos);
75
            if (shape.isEmpty()) shape = state.getShape(mc.level, pos);
76
77
            double height = shape.isEmpty() ? 1 : shape.max(Direction.Axis.Y);
78
79
            Vec3 newPos = new Vec3(pos.getX() + 0.5 + side.getStepX(), pos.getY() + height, pos.getZ() + 0.5 + side.getStepZ());
80
            int packetsRequired = (int) Math.ceil(mc.player.position().distanceTo(newPos) / 10) - 1; // subtract 1 to account for the final packet with movement
81
            if (packetsRequired > 19) packetsRequired = 0;
82
83
            for (int packetNumber = 0; packetNumber < (packetsRequired); packetNumber++) {
84
                mc.player.connection.send(new ServerboundMovePlayerPacket.StatusOnly(true, true));
85
            }
86
87
            mc.player.connection.send(new ServerboundMovePlayerPacket.Pos(newPos.x, newPos.y, newPos.z, true, true));
88
            mc.player.setPos(newPos);
89
        }
90
    }
91
}
92