Rise 5.99 AutoBuild module 2 files, 484 lines

Rise 5.99 AutoBuild: Full Source Analysis

AutoBuild queues fixed decorative block patterns (Penis, Surround, Singular) through C08PacketPlayerBlockPlacement, firing them straight into the NetHandler's no-event queue so they skip the module event bus entirely.

dev/rise/module/impl/other/AutoBuild.java · GitHub source ↗

Published 2026-08-13 · Updated 2026-08-13

Analysis

Overview

AutoBuild queues fixed decorative block patterns (Penis, Surround, Singular) through C08PacketPlayerBlockPlacement, firing them straight into the NetHandler's no-event queue so they skip the module event bus entirely. Normal mode builds at the player's feet on a configurable tick interval; Teleport mode waits for the use-item key, ray-traces to a looked-at block, computes a path with MainPathFinder on a separate thread, streams C04PacketPlayerPosition hops along it, builds at the target, then walks the path back in reverse. A blanket onPacketSend handler cancels every C08 that reaches the event bus, so the only placements the server ever sees are the module's own direct-queue packets.

Architecture

The module also owns an onPacketSend handler that cancels every C08PacketPlayerBlockPlacement arriving on the event bus. Because build() uses PacketUtil.sendPacketWithoutEvent, which calls addToSendQueueWithoutEvent and bypasses the bus, its own placements are untouched; the cancel only suppresses placements from vanilla right-clicks or other modules while AutoBuild is active.

Teleport mode

Teleport mode bypasses the tick gate: the outer condition fires whenever the mode is not Normal or Auto Disable is on, so the mode is driven purely by the key and the 100ms timer rather than the tick counter.

Placement patterns and the direct queue

All C08s go through sendPacketWithoutEvent, so they bypass onPacketSend's own cancel and reach the server as an unswung, same-tick burst of placements: one invocation emits between one and five C08s with no C0A animations in between.

source AutoBuild.java

AutoBuild.java223 lines · JavaOriginal ↗
1
/*
2
 Copyright Alan Wood 2021
3
 None of this code to be reused without my written permission
4
 Intellectual Rights owned by Alan Wood
5
 */
6
package dev.rise.module.impl.other;
7
8
import dev.rise.Rise;
9
import dev.rise.event.impl.other.UpdateEvent;
10
import dev.rise.event.impl.packet.PacketSendEvent;
11
import dev.rise.module.Module;
12
import dev.rise.module.api.ModuleInfo;
13
import dev.rise.module.enums.Category;
14
import dev.rise.module.impl.render.Freecam;
15
import dev.rise.setting.impl.BooleanSetting;
16
import dev.rise.setting.impl.ModeSetting;
17
import dev.rise.setting.impl.NumberSetting;
18
import dev.rise.util.math.TimeUtil;
19
import dev.rise.util.pathfinding.MainPathFinder;
20
import dev.rise.util.pathfinding.Vec3;
21
import dev.rise.util.player.PacketUtil;
22
import net.minecraft.block.BlockAir;
23
import net.minecraft.network.play.client.C03PacketPlayer;
24
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
25
import net.minecraft.network.play.client.C09PacketHeldItemChange;
26
import net.minecraft.util.BlockPos;
27
import net.minecraft.util.EnumFacing;
28
29
import java.util.ArrayList;
30
import java.util.Collections;
31
import java.util.Objects;
32
33
@ModuleInfo(name = "AutoBuild", description = "Builds things around you", category = Category.OTHER)
34
public final class AutoBuild extends Module {
35
36
    private final ModeSetting mode = new ModeSetting("Mode", this, "Normal", "Normal", "Teleport");
37
    private final ModeSetting build = new ModeSetting("Build", this, "Penis", "Penis",/* "Swastika",*/ "Surround", "Singular");
38
    private final NumberSetting height = new NumberSetting("Height", this, 2, 0, 2, 1);
39
    private final NumberSetting tick = new NumberSetting("Tick", this, 1, 1, 20, 1);
40
    private final BooleanSetting autoDisable = new BooleanSetting("Auto Disable", this, false);
41
    private final BooleanSetting nextSlot = new BooleanSetting("Next Slot", this, false);
42
    private final BooleanSetting swing = new BooleanSetting("Swing", this, true);
43
44
    private final TimeUtil timer = new TimeUtil();
45
46
    @Override
47
    public void onUpdateAlwaysInGui() {
48
        height.hidden = !build.is("Penis");
49
50
        tick.hidden = (!mode.is("Normal") || autoDisable.isEnabled());
51
    }
52
53
    @Override
54
    public void onUpdate(final UpdateEvent event) {
55
        if (mc.thePlayer.ticksExisted < 5) {
56
            this.toggleModule();
57
            this.registerNotification("Disabled " + this.getModuleInfo().name() + " due to world change.");
58
            return;
59
        }
60
61
        if (mc.thePlayer.ticksExisted % tick.getValue() == 0 || (!mode.is("Normal") || autoDisable.isEnabled())) {
62
            switch (mode.getMode()) {
63
                case "Normal": {
64
                    build(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ);
65
                    break;
66
                }
67
68
                case "Teleport": {
69
                    if (mc.gameSettings.keyBindUseItem.isKeyDown() && timer.hasReached(100L)) {
70
                        final boolean freecamEnabled = Objects.requireNonNull(Rise.INSTANCE.getModuleManager().getModule("Freecam")).isEnabled();
71
72
                        final BlockPos pos = mc.thePlayer.rayTrace(999, 1).getBlockPos();
73
                        BlockPos tpPos = pos;
74
75
                        switch (build.getMode()) {
76
                            case "Penis":
77
                            case "Surround":
78
                                tpPos = tpPos.offset(EnumFacing.EAST, 2).offset(EnumFacing.SOUTH, 2);
79
                                break;
80
                        }
81
82
                        if (mc.theWorld.getBlockState(pos).getBlock() instanceof BlockAir)
83
                            return;
84
85
                        final BlockPos finalTpPos = tpPos;
86
                        new Thread(() -> {
87
                            double x = mc.thePlayer.posX;
88
                            double y = mc.thePlayer.posY;
89
                            double z = mc.thePlayer.posZ;
90
91
                            if (freecamEnabled) {
92
                                x = Freecam.startX;
93
                                y = Freecam.startY;
94
                                z = Freecam.startZ;
95
                            }
96
97
                            final ArrayList<Vec3> path = MainPathFinder.computePath(new Vec3(x, y, z), new Vec3(finalTpPos.getX(), finalTpPos.getY(), finalTpPos.getZ()));
98
99
                            for (final Vec3 vec : path)
100
                                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));
101
102
                            build(pos.getX(), pos.getY(), pos.getZ());
103
                            Collections.reverse(path);
104
105
                            for (final Vec3 vec : path)
106
                                PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));
107
                        }).start();
108
109
                        timer.reset();
110
                    }
111
                    break;
112
                }
113
            }
114
        }
115
    }
116
117
    @Override
118
    public void onPacketSend(final PacketSendEvent event) {
119
        if (event.getPacket() instanceof C08PacketPlayerBlockPlacement)
120
            event.setCancelled(true);
121
    }
122
123
    private void build(double xPos, final double yPos, double zPos) {
124
        if (nextSlot.isEnabled())
125
            PacketUtil.sendPacketWithoutEvent(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem == 8 ? 0 : mc.thePlayer.inventory.currentItem + 1));
126
127
        switch (build.getMode()) {
128
            case "Penis": {
129
                if (mode.is("Normal")) {
130
                    xPos += 2;
131
                    zPos += 2;
132
                }
133
134
                final BlockPos pos = new BlockPos(xPos, yPos, zPos);
135
136
                // The middle
137
                PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos, EnumFacing.UP.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
138
139
                // The balls
140
                switch (mc.thePlayer.getHorizontalFacing()) {
141
                    case EAST:
142
                    case WEST:
143
                        PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.up(), EnumFacing.NORTH.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
144
                        PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.up(), EnumFacing.SOUTH.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
145
                        break;
146
147
                    case NORTH:
148
                    case SOUTH:
149
                        PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.up(), EnumFacing.EAST.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
150
                        PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.up(), EnumFacing.WEST.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
151
                        break;
152
                }
153
154
                // The penises height
155
                for (int i = 1; i <= height.getValue()/*Change this variable to control the penises height*/; i++)
156
                    PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.up(i), EnumFacing.UP.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
157
                break;
158
            }
159
160
//            case "Swastika": {
161
//                if (mode.is("Normal")) {
162
//                    xPos += 2;
163
//                    zPos += 2;
164
//                }
165
//
166
//                final BlockPos pos = new BlockPos(xPos, yPos, zPos);
167
//
168
//                // The middle
169
//                PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos, EnumFacing.UP.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
170
//
171
//                // The swastikas height
172
//                for (int i = 1; i <= 4/*Change this variable to control the swastikas height (don't change)*/; i++)
173
//                    PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.up(i), EnumFacing.UP.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
174
//
175
//                // The right bottom
176
//                PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.offset(EnumFacing.NORTH, 2), EnumFacing.UP.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
177
//                PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.up().offset(EnumFacing.NORTH, 2), EnumFacing.UP.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
178
//                PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.up(2).offset(EnumFacing.NORTH, 2), EnumFacing.UP.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
179
//                PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.up(3).offset(EnumFacing.NORTH), EnumFacing.UP.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
180
//
181
//                // The right top
182
//                PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.up(5), EnumFacing.NORTH.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
183
//                PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.up(5).offset(EnumFacing.NORTH), EnumFacing.NORTH.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
184
//
185
//                // The left bottom
186
//                PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.up(), EnumFacing.SOUTH.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
187
//                PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.up().offset(EnumFacing.SOUTH), EnumFacing.SOUTH.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
188
//
189
//                // The left top
190
//                PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.up(3), EnumFacing.SOUTH.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
191
//                PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.up(3).offset(EnumFacing.SOUTH), EnumFacing.SOUTH.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
192
//                PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.up(4).offset(EnumFacing.SOUTH, 2), EnumFacing.SOUTH.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
193
//                PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.up(5).offset(EnumFacing.SOUTH, 2), EnumFacing.SOUTH.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
194
//                break;
195
//            }
196
197
            case "Surround": {
198
                final BlockPos pos = new BlockPos(xPos, yPos, zPos);
199
200
                // Creating a for loop and offsetting in each direction to create a surround
201
                for (final EnumFacing facing : EnumFacing.VALUES) {
202
                    if (facing == EnumFacing.UP || facing == EnumFacing.DOWN)
203
                        continue;
204
205
                    PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos.offset(facing), EnumFacing.UP.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
206
                }
207
                break;
208
            }
209
210
            case "Singular": {
211
                final BlockPos pos = new BlockPos(xPos, yPos, zPos);
212
                PacketUtil.sendPacketWithoutEvent(new C08PacketPlayerBlockPlacement(pos, EnumFacing.UP.getIndex(), mc.thePlayer.getCurrentEquippedItem(), 0, 0, 0));
213
                break;
214
            }
215
        }
216
217
        if (autoDisable.isEnabled())
218
            this.toggleModule();
219
220
        if (nextSlot.isEnabled())
221
            PacketUtil.sendPacketWithoutEvent(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));
222
    }
223
}

What this file does

The whole module is one class. onUpdate drives the tick gate and dispatches Normal vs Teleport mode; onPacketSend cancels every C08 that reaches the event bus; build() is the placement engine that fires between one and five C08PacketPlayerBlockPlacement packets per invocation through the no-event queue, with an optional C09PacketHeldItemChange switch-around when Next Slot is on. The Swing setting declared at the top is never read, so the module never sends C0A arm-swing packets. Teleport mode hands the pathfinding to MainPathFinder on a new Thread and streams the out-and-back journey as C04PacketPlayerPosition hops.

source MainPathFinder.java (teleport pathfinder)

MainPathFinder.java261 lines · JavaOriginal ↗
1
package dev.rise.util.pathfinding;
2
3
import dev.rise.util.InstanceAccess;
4
import net.minecraft.block.*;
5
import net.minecraft.block.material.Material;
6
import net.minecraft.init.Blocks;
7
import net.minecraft.util.BlockPos;
8
9
import java.util.ArrayList;
10
import java.util.Comparator;
11
12
public class MainPathFinder implements InstanceAccess {
13
    private final Vec3 startVec3;
14
    private final Vec3 endVec3;
15
    private ArrayList<Vec3> path = new ArrayList();
16
    private final ArrayList<PathHub> pathHubs = new ArrayList();
17
    private final ArrayList<PathHub> workingPathHubList = new ArrayList();
18
    private static final Vec3[] directions = new Vec3[]{new Vec3(1.0, 0.0, 0.0), new Vec3(-1.0, 0.0, 0.0),
19
            new Vec3(0.0, 0.0, 1.0), new Vec3(0.0, 0.0, -1.0)};
20
21
    public MainPathFinder(final Vec3 startVec3, final Vec3 endVec3) {
22
        this.startVec3 = startVec3.addVector(0.0, 0.0, 0.0).floor();
23
        this.endVec3 = endVec3.addVector(0.0, 0.0, 0.0).floor();
24
    }
25
26
    public ArrayList<Vec3> getPath() {
27
        return this.path;
28
    }
29
30
    public void compute() {
31
        this.compute(1000, 4);
32
    }
33
34
    public void compute(final int loops, final int depth) {
35
        this.path.clear();
36
        this.workingPathHubList.clear();
37
38
        final ArrayList<Vec3> initPath = new ArrayList<>();
39
        initPath.add(this.startVec3);
40
41
        this.workingPathHubList
42
                .add(new PathHub(this.startVec3, null, initPath, this.startVec3.squareDistanceTo(this.endVec3), 0.0, 0.0));
43
44
        block0:
45
        for (int i = 0; i < loops; ++i) {
46
            this.workingPathHubList.sort(new CompareHub());
47
            int j = 0;
48
49
            if (this.workingPathHubList.size() == 0) {
50
                break;
51
            }
52
53
            for (final PathHub pathHub : new ArrayList<>(this.workingPathHubList)) {
54
                final Vec3 loc2;
55
56
                if (++j > depth) {
57
                    continue block0;
58
                }
59
60
                this.workingPathHubList.remove(pathHub);
61
                this.pathHubs.add(pathHub);
62
63
                for (final Vec3 direction : directions) {
64
                    final Vec3 loc = pathHub.getLoc().add(direction).floor();
65
                    if (isValid(loc, false) && this.putHub(pathHub, loc, 0.0)) {
66
                        break block0;
67
                    }
68
                }
69
70
                final Vec3 loc1 = pathHub.getLoc().addVector(0.0, 1.0, 0.0).floor();
71
                if (isValid(loc1, false) && this.putHub(pathHub, loc1, 0.0)
72
                        || isValid(loc2 = pathHub.getLoc().addVector(0.0, -1.0, 0.0).floor(), false)
73
                        && this.putHub(pathHub, loc2, 0.0)) {
74
                    break block0;
75
                }
76
            }
77
        }
78
79
        this.pathHubs.sort(new CompareHub());
80
        this.path = this.pathHubs.get(0).getPathway();
81
    }
82
83
    public static boolean isValid(final Vec3 loc, final boolean checkGround) {
84
        return isValid((int) loc.getX(), (int) loc.getY(), (int) loc.getZ(),
85
                checkGround);
86
    }
87
88
    public static boolean isValid(final int x, final int y, final int z, final boolean checkGround) {
89
        final BlockPos block1 = new BlockPos(x, y, z);
90
        final BlockPos block2 = new BlockPos(x, y + 1, z);
91
        final BlockPos block3 = new BlockPos(x, y - 1, z);
92
        return !isNotPassable(block1) && !isNotPassable(block2)
93
                && (isNotPassable(block3) || !checkGround)
94
                && canWalkOn(block3);
95
    }
96
97
    private static boolean isNotPassable(final BlockPos block) {
98
        final Block b = mc.theWorld.getBlockState(new BlockPos(block.getX(), block.getY(), block.getZ())).getBlock();
99
100
        return b.isFullBlock()
101
                || b instanceof BlockSlab
102
                || b instanceof BlockStairs
103
                || b instanceof BlockCactus
104
                || b instanceof BlockChest
105
                || b instanceof BlockEnderChest
106
                || b instanceof BlockSkull
107
                || b instanceof BlockPane
108
                || b instanceof BlockFence
109
                || b instanceof BlockWall
110
                || b instanceof BlockGlass
111
                || b instanceof BlockPistonBase
112
                || b instanceof BlockPistonExtension
113
                || b instanceof BlockPistonMoving
114
                || b instanceof BlockStainedGlass
115
                || b instanceof BlockTrapDoor
116
                || b instanceof BlockEndPortalFrame
117
                || b instanceof BlockEndPortal
118
                || b instanceof BlockBed
119
                || b instanceof BlockWeb
120
                || b instanceof BlockBarrier
121
                || b instanceof BlockLadder
122
                || b instanceof BlockCarpet;
123
    }
124
125
    private static boolean canWalkOn(final BlockPos block) {
126
        return !(mc.theWorld.getBlockState(new BlockPos(block.getX(), block.getY(),
127
                block.getZ())).getBlock() instanceof BlockFence)
128
                && !(mc.theWorld.getBlockState(new BlockPos(block.getX(), block.getY(),
129
                block.getZ())).getBlock() instanceof BlockWall);
130
    }
131
132
    public PathHub doesHubExistAt(final Vec3 loc) {
133
        for (final PathHub pathHub : this.pathHubs) {
134
            if (pathHub.getLoc().getX() != loc.getX() || pathHub.getLoc().getY() != loc.getY()
135
                    || pathHub.getLoc().getZ() != loc.getZ()) {
136
                continue;
137
            }
138
            return pathHub;
139
        }
140
141
        for (final PathHub pathHub : this.workingPathHubList) {
142
            if (pathHub.getLoc().getX() != loc.getX() || pathHub.getLoc().getY() != loc.getY()
143
                    || pathHub.getLoc().getZ() != loc.getZ()) {
144
                continue;
145
            }
146
            return pathHub;
147
        }
148
        return null;
149
    }
150
151
    public boolean putHub(final PathHub parent, final Vec3 loc, final double cost) {
152
        final PathHub existingPathHub = this.doesHubExistAt(loc);
153
        double totalCost = cost;
154
155
        if (parent != null) {
156
            totalCost += parent.getMaxCost();
157
        }
158
159
        if (existingPathHub == null) {
160
            final double minDistanceSquared = 9.5;
161
            if (loc.getX() == this.endVec3.getX() && loc.getY() == this.endVec3.getY() && loc.getZ() == this.endVec3.getZ() || loc.squareDistanceTo(this.endVec3) <= minDistanceSquared) {
162
                this.path.clear();
163
                this.path = parent.getPathway();
164
                this.path.add(loc);
165
                return true;
166
            }
167
168
            final ArrayList<Vec3> path = new ArrayList<>(parent.getPathway());
169
            path.add(loc);
170
171
            this.workingPathHubList.add(new PathHub(loc, parent, path, loc.squareDistanceTo(this.endVec3), cost, totalCost));
172
        } else if (existingPathHub.getCurrentCost() > cost) {
173
            final ArrayList<Vec3> path = new ArrayList<>(parent.getPathway());
174
            path.add(loc);
175
            existingPathHub.setLoc(loc);
176
            existingPathHub.setParentPathHub(parent);
177
            existingPathHub.setPathway(path);
178
            existingPathHub.setSqDist(loc.squareDistanceTo(this.endVec3));
179
            existingPathHub.setCurrentCost(cost);
180
            existingPathHub.setMaxCost(totalCost);
181
        }
182
        return false;
183
    }
184
185
    public static boolean canPassThrough(final BlockPos pos) {
186
        final Block block = mc.theWorld
187
                .getBlockState(new BlockPos(pos.getX(), pos.getY(), pos.getZ())).getBlock();
188
        return block.getMaterial() == Material.air || block.getMaterial() == Material.plants
189
                || block.getMaterial() == Material.vine || block == Blocks.ladder || block == Blocks.water
190
                || block == Blocks.flowing_water || block == Blocks.wall_sign || block == Blocks.standing_sign;
191
    }
192
193
    public static ArrayList<Vec3> computePath(Vec3 topFrom, final Vec3 to) {
194
        if (!canPassThrough(new BlockPos(topFrom.mc()))) {
195
            topFrom = topFrom.addVector(0.0, 1.0, 0.0);
196
        }
197
198
        final PathFinder pathfinder = new PathFinder(topFrom, to);
199
        pathfinder.compute();
200
        int i = 0;
201
        Vec3 lastLoc = null;
202
        Vec3 lastDashLoc = null;
203
        final ArrayList<Vec3> path = new ArrayList<>();
204
        final ArrayList<Vec3> pathFinderPath = pathfinder.getPath();
205
206
        for (final Vec3 pathElm : pathFinderPath) {
207
            if (i == 0 || i == pathFinderPath.size() - 1) {
208
                if (lastLoc != null) {
209
                    path.add(lastLoc.addVector(0.5, 0.0, 0.5));
210
                }
211
                path.add(pathElm.addVector(0.5, 0.0, 0.5));
212
                lastDashLoc = pathElm;
213
            } else {
214
                boolean canContinue = true;
215
                if (pathElm.squareDistanceTo(lastDashLoc) > 5 * 5) {
216
                    canContinue = false;
217
                } else {
218
                    final double smallX = Math.min(lastDashLoc.getX(), pathElm.getX());
219
                    final double smallY = Math.min(lastDashLoc.getY(), pathElm.getY());
220
                    final double smallZ = Math.min(lastDashLoc.getZ(), pathElm.getZ());
221
                    final double bigX = Math.max(lastDashLoc.getX(), pathElm.getX());
222
                    final double bigY = Math.max(lastDashLoc.getY(), pathElm.getY());
223
                    final double bigZ = Math.max(lastDashLoc.getZ(), pathElm.getZ());
224
                    int x = (int) smallX;
225
                    block1:
226
                    while (x <= bigX) {
227
                        int y2 = (int) smallY;
228
                        while (y2 <= bigY) {
229
                            int z = (int) smallZ;
230
                            while (z <= bigZ) {
231
                                if (!isValid(x, y2, z, false)) {
232
                                    canContinue = false;
233
                                    break block1;
234
                                }
235
                                ++z;
236
                            }
237
                            ++y2;
238
                        }
239
                        ++x;
240
                    }
241
                }
242
243
                if (!canContinue) {
244
                    path.add(lastLoc.addVector(0.5, 0.0, 0.5));
245
                    lastDashLoc = lastLoc;
246
                }
247
            }
248
            lastLoc = pathElm;
249
            ++i;
250
        }
251
        return path;
252
    }
253
254
    public static class CompareHub implements Comparator<PathHub> {
255
        @Override
256
        public int compare(final PathHub o1, final PathHub o2) {
257
            return (int) (o1.getSqDist() + o1.getMaxCost()
258
                    - (o2.getSqDist() + o2.getMaxCost()));
259
        }
260
    }
261
}

What this file does

A block-grid A*-style pathfinder over four horizontal directions (the directions array holds +X, -X, +Z, -Z), with a start and end Vec3 floored to block coordinates and an open PathHub list expanded via compute(). Teleport mode calls MainPathFinder.computePath(start, end) on a worker thread, then converts every Vec3 in the returned path into a C04PacketPlayerPosition with onGround true, streams it through the no-event queue to reach the build site, and reverses the path to come back.

anticheat Countering Checks

The anticheat code that detects or counters the techniques this module uses. Full source, with the detection mechanism explained below each box.

anticheat FastPlace (placement rate)

FastPlace.java103 lines · Java
1
/*
2
 * This program is free software: you can redistribute it and/or modify
3
 *   it under the terms of the GNU General Public License as published by
4
 *   the Free Software Foundation, either version 3 of the License, or
5
 *   (at your option) any later version.
6
 *
7
 *   This program is distributed in the hope that it will be useful,
8
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 *   GNU General Public License for more details.
11
 *
12
 *   You should have received a copy of the GNU General Public License
13
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
 */
15
package fr.neatmonster.nocheatplus.checks.blockplace;
16
17
import org.bukkit.block.Block;
18
import org.bukkit.entity.Player;
19
20
import fr.neatmonster.nocheatplus.checks.Check;
21
import fr.neatmonster.nocheatplus.checks.CheckType;
22
import fr.neatmonster.nocheatplus.players.IPlayerData;
23
import fr.neatmonster.nocheatplus.utilities.TickTask;
24
25
/**
26
 * A check used to verify if the player isn't placing blocks too quickly.
27
 */
28
public class FastPlace extends Check {
29
30
    /**
31
     * Instantiates a new fast place check.
32
     */
33
    public FastPlace() {
34
        super(CheckType.BLOCKPLACE_FASTPLACE);
35
    }
36
37
    /**
38
     * Checks a player.
39
     * 
40
     * @param player
41
     *            the player
42
     * @param block
43
     *            the block
44
     * @param tick
45
     * @param data
46
     * @param cc
47
     * @param pData
48
     * @return true, if successful
49
     */
50
    public boolean check(final Player player, final Block block, final int tick, final BlockPlaceData data, 
51
                         final BlockPlaceConfig cc, final IPlayerData pData) {
52
53
        data.fastPlaceBuckets.add(System.currentTimeMillis(), 1f);
54
        final boolean lag = pData.getCurrentWorldData().shouldAdjustToLag(type);
55
        // Full period frequency.
56
        final float fullScore = data.fastPlaceBuckets.score(1f);
57
58
        // Short term limit.
59
        if (tick < data.fastPlaceShortTermTick) {
60
            // TickTask got reset.
61
            data.fastPlaceShortTermTick = tick;
62
            data.fastPlaceShortTermCount = 1;
63
        }
64
        else if (tick - data.fastPlaceShortTermTick < cc.fastPlaceShortTermTicks) {
65
            // Account for server side lag.
66
            if (!lag || TickTask.getLag(50L * (tick - data.fastPlaceShortTermTick), true) < 1.2f) {
67
                // Within range, add.
68
                data.fastPlaceShortTermCount ++;
69
            }
70
            else {
71
                // Too much lag, reset.
72
                data.fastPlaceShortTermTick = tick;
73
                data.fastPlaceShortTermCount = 1;
74
            }
75
        }
76
        else { 
77
            data.fastPlaceShortTermTick = tick;
78
            data.fastPlaceShortTermCount = 1;
79
        }
80
81
        // Find out if one of both are violations:
82
        final float fullViolation;
83
        if (fullScore > cc.fastPlaceLimit) {
84
            // Account for server side lag.
85
            fullViolation = lag ? fullScore / TickTask.getLag(data.fastPlaceBuckets.bucketDuration() * data.fastPlaceBuckets.numberOfBuckets(), true) - cc.fastPlaceLimit
86
                                : fullScore - cc.fastPlaceLimit;
87
        }
88
        else fullViolation = 0;
89
        final float shortTermViolation = data.fastPlaceShortTermCount - cc.fastPlaceShortTermLimit; 
90
        final float violation = Math.max(fullViolation, shortTermViolation);
91
        boolean cancel = false;
92
93
        if (violation > 0.0) {
94
            final double change = (double) violation;
95
            data.fastPlaceVL += change;
96
            cancel = executeActions(player, data.fastPlaceVL, change, cc.fastPlaceActions).willCancel();
97
        }
98
        else if (data.fastPlaceVL > 0D && fullScore < cc.fastPlaceLimit * .75) {
99
            data.fastPlaceVL *= 0.95;
100
        }
101
        return cancel;
102
    }
103
}

How it counteracts this module

NCP's FastPlace check scores every placement into data.fastPlaceBuckets (a frequency bucket accumulator keyed by wall-clock time) and maintains a short-term window: fastPlaceShortTermCount increments for every placement landing within cc.fastPlaceShortTermTicks of the first, resetting when the window elapses or server lag exceeds the adaption threshold. AutoBuild emits one to five C08s per invocation and, at the default Tick=1, repeats that burst every single tick - a placement rate no hand can produce, so both the full-period bucket score and the short-term count grow on the first burst. The check's cancellation actions (cc.fastPlaceActions) then eat subsequent placements outright.

anticheat NoSwing (arm movement between places)

NoSwing.java63 lines · Java
1
/*
2
 * This program is free software: you can redistribute it and/or modify
3
 *   it under the terms of the GNU General Public License as published by
4
 *   the Free Software Foundation, either version 3 of the License, or
5
 *   (at your option) any later version.
6
 *
7
 *   This program is distributed in the hope that it will be useful,
8
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 *   GNU General Public License for more details.
11
 *
12
 *   You should have received a copy of the GNU General Public License
13
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
 */
15
package fr.neatmonster.nocheatplus.checks.blockplace;
16
17
import org.bukkit.entity.Player;
18
19
import fr.neatmonster.nocheatplus.checks.Check;
20
import fr.neatmonster.nocheatplus.checks.CheckType;
21
22
/**
23
 * We require that the player moves their arm between block places, this is what gets checked here.
24
 */
25
public class NoSwing extends Check {
26
27
    /**
28
     * Instantiates a new no swing check.
29
     */
30
    public NoSwing() {
31
        super(CheckType.BLOCKPLACE_NOSWING);
32
    }
33
34
    /**
35
     * Checks a player.
36
     * 
37
     * @param player
38
     *            the player
39
     * @param data 
40
     * @param cc 
41
     * @return true, if successful
42
     */
43
    public boolean check(final Player player, final BlockPlaceData data, final BlockPlaceConfig cc) {
44
45
        boolean cancel = false;
46
47
        // Did they swing their arm before?
48
        if (++data.noSwingCount <= 1) {
49
            // Reward with lowering of the violation level.
50
            data.noSwingVL *= 0.9D;
51
        } else {
52
            // They failed, increase violation level.
53
            data.noSwingCount = 0;
54
            data.noSwingVL += 1D;
55
56
            // Execute whatever actions are associated with this check and the violation level and find out if we should
57
            // cancel the event.
58
            cancel = executeActions(player, data.noSwingVL, 1D, cc.noSwingActions).willCancel();
59
        }
60
61
        return cancel;
62
    }
63
}

How it counteracts this module

NoSwing requires an arm swing (C0A) between consecutive placements: each placement without a preceding swing increments data.noSwingCount, and once it exceeds 1 the violation level grows by 1 and the configured actions run. AutoBuild never sends C0A packets at all - the Swing setting is declared but never referenced, and build() queues only C08s - so every multi-block invocation is a chain of swingless placements. The Penis pattern's middle-plus-balls-plus-height sequence (up to five C08s in one tick) is exactly the burst NoSwing was written for: no human can place five blocks without ever moving their arm.

anticheat Direction (placement outside field of view)

Direction.java52 lines · Java
1
/*
2
 * This program is free software: you can redistribute it and/or modify
3
 *   it under the terms of the GNU General Public License as published by
4
 *   the Free Software Foundation, either version 3 of the License, or
5
 *   (at your option) any later version.
6
 *
7
 *   This program is distributed in the hope that it will be useful,
8
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 *   GNU General Public License for more details.
11
 *
12
 *   You should have received a copy of the GNU General Public License
13
 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
14
 */
15
package fr.neatmonster.nocheatplus.checks.blockplace;
16
17
import org.bukkit.entity.Player;
18
19
import fr.neatmonster.nocheatplus.actions.ActionList;
20
import fr.neatmonster.nocheatplus.checks.CheckType;
21
import fr.neatmonster.nocheatplus.checks.generic.block.AbstractBlockDirectionCheck;
22
23
/**
24
 * The Direction check will find out if a player tried to interact with
25
 * something that's not in their field of view.
26
 */
27
public class Direction extends AbstractBlockDirectionCheck<BlockPlaceData, BlockPlaceConfig> {
28
29
    /**
30
     * Instantiates a new direction check.
31
     */
32
    public Direction() {
33
        super(CheckType.BLOCKPLACE_DIRECTION);
34
    }
35
36
    @Override
37
    protected double addVL(Player player, double distance, BlockPlaceData data, BlockPlaceConfig cc) {
38
        data.directionVL += distance;
39
        return data.directionVL;
40
    }
41
42
    @Override
43
    protected ActionList getActions(BlockPlaceConfig cc) {
44
        return cc.directionActions;
45
    }
46
47
    @Override
48
    protected void cooldown(Player player, BlockPlaceData data, BlockPlaceConfig cc) {
49
        data.directionVL *= 0.9D;
50
    }
51
52
}

How it counteracts this module

The Direction check (an AbstractBlockDirectionCheck) computes the angular distance between the player's look vector and the block being interacted with, adding the distance to directionVL and firing the configured actions once the accumulated score crosses the threshold. AutoBuild places at fixed offsets - two blocks east/south of the player in Normal Penis mode, above the player's feet for the height loop, and on all four horizontal faces in Surround mode - while the player's view stays wherever it was when the burst fired. Those side and above placements sit outside the field of view, which is precisely the interaction pattern Direction is built to flag.

anticheat BlockInteractSpeed (same-tick placements)

BlockInteractSpeed.java55 lines · Java
1
/*
2
 * This file is part of Hawk Anticheat.
3
 * Copyright (C) 2018 Hawk Development Team
4
 *
5
 * This program is free software: you can redistribute it and/or modify
6
 * it under the terms of the GNU General Public License as published by
7
 * the Free Software Foundation, either version 3 of the License, or
8
 * (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
17
 */
18
19
package me.islandscout.hawk.check.interaction.terrain;
20
21
import me.islandscout.hawk.HawkPlayer;
22
import me.islandscout.hawk.check.BlockInteractionCheck;
23
import me.islandscout.hawk.event.InteractWorldEvent;
24
import org.bukkit.entity.Player;
25
26
import java.util.HashMap;
27
import java.util.Map;
28
import java.util.UUID;
29
30
public class BlockInteractSpeed extends BlockInteractionCheck {
31
32
    private final Map<UUID, Long> lastPlaceTick;
33
34
    public BlockInteractSpeed() {
35
        super("blockplacespeed", "%player% failed block place speed. VL: %vl%");
36
        lastPlaceTick = new HashMap<>();
37
    }
38
39
    @Override
40
    protected void check(InteractWorldEvent e) {
41
        Player p = e.getPlayer();
42
        HawkPlayer pp = e.getHawkPlayer();
43
        if (pp.getCurrentTick() == lastPlaceTick.getOrDefault(p.getUniqueId(), 0L))
44
            punishAndTryCancelAndBlockRespawn(pp, 1, e);
45
        else
46
            reward(pp);
47
48
        lastPlaceTick.put(p.getUniqueId(), pp.getCurrentTick());
49
    }
50
51
    @Override
52
    public void removeData(Player p) {
53
        lastPlaceTick.remove(p.getUniqueId());
54
    }
55
}

How it counteracts this module

Hawk's BlockInteractSpeed records the server tick of every block interaction per player and punishes any second interaction landing in the same tick (pp.getCurrentTick() == lastPlaceTick), rewarding otherwise. AutoBuild's build() emits between one and five C08PacketPlayerBlockPlacement packets in a single invocation, all processed in the same tick, so every multi-block pattern trips the same-tick comparison immediately. Even the single-block Singular mode fails when Tick=1 because consecutive invocations arrive one tick apart - the minimum human cadence for block placement is several ticks per block.

← Back to Analysis Hub