0x07 C07PacketPlayerDigging
Player starts/cancels/ends mining a block, or drops an item (press Q).
Published 2026-06-18 · Updated 2026-10-14
Fields
| Field | Type | Description |
|---|---|---|
| position | BlockPos | Position of the affected block |
| facing | EnumFacing | Face of the block being mined |
| status | Enum | START_DESTROY_BLOCK, ABORT_DESTROY_BLOCK, STOP_DESTROY_BLOCK, DROP_ALL_ITEMS, DROP_ITEM, RELEASE_USE_ITEM |
Wire Encoding
| Field | Type | Notes |
|---|---|---|
| Block Pos | Position (long) | Encoded as ((x & 0x3FFFFFF) << 38) | ((y & 0xFFF) << 26) | (z & 0x3FFFFFF) |
| Facing | byte | 0=bottom, 1=top, 2=north, 3=south, 4=west, 5=east |
| Status | byte | 0=start, 1=cancel, 2=finish, 3=dropStack, 4=dropItem, 5=finishUse |
MCP References
NetHandlerPlayServer.processPlayerDigging()Handler Interface
INetHandlerPlayServerNotes
Vanilla Source
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
Deobfuscated MCP 1.8.9 source of C07PacketPlayerDigging, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/client/C07PacketPlayerDigging.java) at build time and verified present.
Deep Dive
Role in the protocol
C07PacketPlayerDigging is the serverbound mining and item-use control channel. The wire form is a packed BlockPos (long), a facing byte, and a status enum byte: START_DESTROY_BLOCK, ABORT_DESTROY_BLOCK, STOP_DESTROY_BLOCK, DROP_ALL_ITEMS, DROP_ITEM, RELEASE_USE_ITEM. It is the only way the server learns that the player began mining, finished or cancelled a dig, dropped an item, or released a use-item action such as a bow draw, eating, or blocking. Client-side it is emitted from PlayerControllerMP.clickBlock (START), onPlayerDamageBlock (ABORT), onPlayerDestroyBlock (STOP), EntityPlayerSP.dropOneItem (DROP) and PlayerControllerMP.onStoppedUsingItem (RELEASE_USE_ITEM).
Vanilla handling
NetHandlerPlayServer.processPlayerDigging switches on the status. DROP_ITEM and DROP_ALL_ITEMS call dropOneItem(false/true) unless the player is a spectator. RELEASE_USE_ITEM calls stopUsingItem, which ends the bow draw or eating and computes the fired arrow or consumed food server-side. The three dig actions share a distance gate: squared distance from the player to the block center (with a +1.5 Y bias) must be under 36.0 and the block Y below the build limit. START calls ItemInWorldManager.tryHarvestBlock when the block is not protected and inside the world border, otherwise the server replies with an S23 block change. STOP calls onPlayerDestroyBlock and ABORT cancels the dig; after STOP or ABORT an S23 is re-sent if the block is not air. There is no per-action rate limit.
Why clients touch it
Four families dominate the corpus. Mining automation: Nuker in Rise 5.99 and 6.x sends START+STOP pairs around every block in a radius, with Teleport and Area modes that walk to the target first; Breaker in Memeware, Rise 5.99 and the Rise 6.x Breaker/NewBreaker/NewNewBreaker suite destroys cake, beds and targeted blocks; Tenacity's SpeedMine accumulates block damage client-side and finishes the dig itself. Item-use automation: FastBow in Memeware, Rise 5.99 and Sigma fires fully charged arrows by releasing early; the Rise 5.99 AutoGap/AutoPot/AutoHead/AutoSoup family and Sigma's FastUse use RELEASE_USE_ITEM to end eating, potting and item use instantly. NoSlow lives in Memeware, Rise 5.99, Rise 6.x (Legit/NCP/Intave), Sigma and Spicy, pairing RELEASE_USE_ITEM with a C08 re-place to cancel the slow. Combat auras in every client use RELEASE_USE_ITEM for autoblock, and Rise 6.x velocity and disabler modules spoof dig state for anti-cheat bypasses. The two new research clients add two more. November Recode 2.0's KillAuraModule uses C07 RELEASE_USE_ITEM as the release half of its autoblock pair (C08 place then C07 release) and cancels outgoing releases in its VANILLA and WATCHDOG autoblock modes. LiquidSense Dev's HYTRun emits C07 RELEASE_USE_ITEM for its no-slow leg, and its SpeedMine runs client-side damage accumulation with a 1.4 hardness multiplier before sending STOP_DESTROY_BLOCK.
Exploit surface
The server processes a START+STOP pair as a complete break with no client-side damage accounting, so any module can mine instantly at the packet level; the only server-side evidence is the block's hardness versus the reported dig duration. RELEASE_USE_ITEM ignores the BlockPos entirely, so Spicy's NoSlow can send it with a random double-range position and the server reads only the status. The 36.0 distance gate is generous versus the client's 6-block reach, and Teleport-mode Nuker satisfies it by walking before digging. DROP_ITEM is a free inventory channel. Anti-cheats counter with dig-speed measurement (hardness versus START-to-STOP gap), per-second block counts for nuker patterns, and the release+re-place gap for NoSlow.
Server-Side Handling
processPlayerDigging resolves the block position, then switches on the status ordinal. Drop actions skip the distance check entirely and go straight to dropOneItem; the spectator gate is the only guard. RELEASE_USE_ITEM also skips position validation and calls stopUsingItem, which is why the random-position trick works: the server reads the enum and nothing else. Dig actions enforce the 36.0 squared-distance gate with the +1.5 Y bias, the build-limit clamp, the world-border check and the block-protection check (an S23 is sent back when the dig is refused). STOP_DESTROY_BLOCK is what actually breaks the block via onPlayerDestroyBlock; START only enters the mining state. The ItemInWorldManager tracks the dig progress server-side, but a module that sends START then STOP back-to-back completes the state machine in one round trip.
Protocol Analysis
The BlockPos is packed into a single long as ((x & 0x3FFFFFF) << 38) | ((y & 0xFFF) << 26) | (z & 0x3FFFFFF). The facing byte and the status byte follow; MCP reads both via readEnumValue, so both are VarInts on the wire. Status ordinals: 0 START_DESTROY_BLOCK, 1 ABORT_DESTROY_BLOCK, 2 STOP_DESTROY_BLOCK, 3 DROP_ALL_ITEMS, 4 DROP_ITEM, 5 RELEASE_USE_ITEM. Drop packets conventionally use BlockPos.ORIGIN with EnumFacing.DOWN; modules copy that convention even for release packets, and Spicy's NoSlow deliberately breaks it with random coordinates. The packet is registered at 0x07 in the SERVERBOUND play state table.
Anti-Cheat Landscape
NCP and Matrix measure the START-to-STOP gap against the block's hardness and flag instant breaks; Nuker patterns are caught by counting unique blocks destroyed per second, which is why Rise 5.99's Nuker ships a Tick throttle and an Instant Only mode that refuses hardness above 0. SpeedMine avoids the dig-speed flag by never lying about the gap: it finishes the client-side damage model and only then sends STOP. NoSlow is detected by the release+re-place packet pattern and by position comparison on the C07, which is what Spicy's random BlockPos defeats. GrimVelocity and StandardVelocity in Rise 6.x spoof START/STOP to satisfy mining-state checks during knockback, and the CubeCraft and Vulcan disablers send STOP/START at the player's own position to reset server dig state. The item-use family (FastBow, FastUse) is flagged by charge-time measurement between the C08 use and the C07 release.
implementation Implementation Cases
The mining and item-use control packet: six status values over a packed position and facing byte. Nuker and Breaker forge START+STOP pairs for instant mining, Tenacity's SpeedMine runs the block math client-side, FastBow releases the bow early through RELEASE_USE_ITEM, and NoSlow pairs the release with a C08 re-place to cancel eating and blocking slows. Autoblock auras in every client fire RELEASE_USE_ITEM around each attack.
Break every block in a radius cube by sending START+STOP pairs at the packet level, with teleport and area variants.
On update, every N ticks, iterate the radius-minus-1 cube; skip air and, in Instant Only mode, any block with hardness above 0; send START_DESTROY_BLOCK then STOP_DESTROY_BLOCK for each target via sendPacketWithoutEvent, with an optional swing. Teleport mode ray-traces 999 blocks on use, pathfinds to the target with C04 packets, nukes, and walks back; Area mode picks a random point inside the .setarea box. An S02 chat filter cancels the plot-protection message.
// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Nuker.java =====
/*
Copyright Alan Wood 2021
None of this code to be reused without my written permission
Intellectual Rights owned by Alan Wood
*/
package dev.rise.module.impl.other;
import dev.rise.Rise;
import dev.rise.command.impl.SetArea;
import dev.rise.event.impl.other.UpdateEvent;
import dev.rise.event.impl.packet.PacketReceiveEvent;
import dev.rise.module.Module;
import dev.rise.module.api.ModuleInfo;
import dev.rise.module.enums.Category;
import dev.rise.module.impl.render.Freecam;
import dev.rise.setting.impl.BooleanSetting;
import dev.rise.setting.impl.ModeSetting;
import dev.rise.setting.impl.NumberSetting;
import dev.rise.util.math.TimeUtil;
import dev.rise.util.pathfinding.MainPathFinder;
import dev.rise.util.pathfinding.Vec3;
import dev.rise.util.player.PacketUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockAir;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.network.play.server.S02PacketChat;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Objects;
import java.util.Random;
@ModuleInfo(name = "Nuker", description = "Breaks blocks around you", category = Category.OTHER)
public final class Nuker extends Module {
private final ModeSetting mode = new ModeSetting("Mode", this, "Normal", "Normal", "Teleport", "Area");
private final NumberSetting delay = new NumberSetting("Delay", this, 100, 0, 5000, 50);
private final NumberSetting range = new NumberSetting("Range", this, 4, 1, 7, 0.5);
private final NumberSetting tick = new NumberSetting("Tick", this, 1, 1, 20, 1);
private final BooleanSetting instantOnly = new BooleanSetting("Instant Only", this, false);
private final BooleanSetting scatter = new BooleanSetting("Scatter", this, false);
private final BooleanSetting swing = new BooleanSetting("Swing", this, true);
private final TimeUtil timer = new TimeUtil();
@Override
public void onUpdateAlwaysInGui() {
delay.hidden = !(mode.is("Teleport") || mode.is("Area"));
tick.hidden = !mode.is("Normal");
}
@Override
public void onUpdate(final UpdateEvent event) {
final double radius = this.range.getValue() - 1;
if (mc.thePlayer.ticksExisted < 5) {
this.toggleModule();
this.registerNotification("Disabled " + this.getModuleInfo().name() + " due to world change.");
return;
}
if (mc.thePlayer.ticksExisted % tick.getValue() == 0 || !mode.is("Normal")) {
switch (mode.getMode()) {
case "Normal": {
nuke(radius, mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ);
break;
}
case "Teleport": {
if (mc.gameSettings.keyBindUseItem.isKeyDown() && timer.hasReached((long) delay.getValue())) {
final boolean freecamEnabled = Objects.requireNonNull(Rise.INSTANCE.getModuleManager().getModule("Freecam")).isEnabled();
final BlockPos pos = mc.thePlayer.rayTrace(999, 1).getBlockPos();
if (mc.theWorld.getBlockState(pos).getBlock() instanceof BlockAir)
return;
new Thread(() -> {
double x = mc.thePlayer.posX;
double y = mc.thePlayer.posY;
double z = mc.thePlayer.posZ;
if (freecamEnabled) {
x = Freecam.startX;
y = Freecam.startY;
z = Freecam.startZ;
}
final ArrayList<Vec3> path = MainPathFinder.computePath(new Vec3(x, y, z), new Vec3(pos.getX(), pos.getY(), pos.getZ()));
for (final Vec3 vec : path)
PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));
nuke(radius, pos.getX(), pos.getY(), pos.getZ());
Collections.reverse(path);
for (final Vec3 vec : path)
PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));
}).start();
timer.reset();
}
break;
}
case "Area": {
final Vec3 pos1 = SetArea.pos1;
final Vec3 pos2 = SetArea.pos2;
if (pos1 == null || pos2 == null) {
this.registerNotification("Set a position for Area Nuker by doing .setarea <1/2/reset> at the positions.");
this.toggleModule();
return;
}
if (timer.hasReached((long) delay.getValue())) {
final boolean freecamEnabled = Objects.requireNonNull(Rise.INSTANCE.getModuleManager().getModule("Freecam")).isEnabled();
final double nukeX = randomPoint(pos1.getX(), pos2.getX());
final double nukeY = randomPoint(pos1.getY(), pos2.getY());
final double nukeZ = randomPoint(pos1.getZ(), pos2.getZ());
new Thread(() -> {
double x = mc.thePlayer.posX;
double y = mc.thePlayer.posY;
double z = mc.thePlayer.posZ;
if (freecamEnabled) {
x = Freecam.startX;
y = Freecam.startY;
z = Freecam.startZ;
}
final ArrayList<Vec3> path = MainPathFinder.computePath(new Vec3(x, y, z), new Vec3(nukeX, nukeY, nukeZ));
for (final Vec3 vec : path)
PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));
nuke(radius, nukeX, nukeY, nukeZ);
Collections.reverse(path);
for (final Vec3 vec : path)
PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));
}).start();
}
break;
}
}
}
}
@Override
public void onPacketReceive(final PacketReceiveEvent event) {
final Packet<?> p = event.getPacket();
if (p instanceof S02PacketChat) {
final S02PacketChat packetChat = (S02PacketChat) p;
final String message = packetChat.getChatComponent().getUnformattedText();
if (!packetChat.isChat() && message.equals("You can't build outside the plot!"))
event.setCancelled(true);
}
}
private void nuke(final double range, final double xPos, final double yPos, final double zPos) {
if (range == 0) {
final BlockPos blockPos = new BlockPos(xPos, yPos, zPos);
final Block block = mc.theWorld.getBlockState(blockPos).getBlock();
if (block instanceof BlockAir || (block.getBlockHardness() > 0 && instantOnly.isEnabled()))
return;
PacketUtil.sendPacketWithoutEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.UP));
PacketUtil.sendPacketWithoutEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, blockPos, EnumFacing.UP));
if (swing.isEnabled())
mc.thePlayer.swingItem();
} else {
for (double x = -range; x < range; x++) {
for (double y = range; y > -range; y--) {
for (double z = -range; z < range; z++) {
if (scatter.isEnabled() && !((mc.thePlayer.ticksExisted % 2 == 0 ? x : z) % 2 == 0))
continue;
final BlockPos blockPos = new BlockPos(xPos + x, yPos + y, zPos + z);
final Block block = mc.theWorld.getBlockState(blockPos).getBlock();
if (block instanceof BlockAir || (block.getBlockHardness() > 0 && instantOnly.isEnabled()))
continue;
PacketUtil.sendPacketWithoutEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.UP));
PacketUtil.sendPacketWithoutEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, blockPos, EnumFacing.UP));
if (swing.isEnabled())
mc.thePlayer.swingItem();
}
}
}
}
}
private double randomPoint(final double one, final double two) {
if (one == two)
return one;
final double delta = two - one;
final double offset = new Random().nextFloat() * delta;
return one + offset;
}
}
// NOTE (AI): The nuke() core sends START_DESTROY_BLOCK then immediately STOP_DESTROY_BLOCK for every non-air block in the radius cube, via sendPacketWithoutEvent so no other module sees the flood. The server processes the pair as a complete break: START calls ItemInWorldManager.func_180784_a (tryHarvestBlock) and STOP calls onPlayerDestroyBlock, so instant mining is achieved at the packet level with no client-side damage accumulation. Instant Only mode skips any block with hardness above 0, which limits the server-side tell. Teleport and Area modes pathfind to the target with C04 packets (also without event), nuke, and walk back, which keeps the C07 distance check (36.0 squared) satisfied. The S02 chat cancel hides the plot-protection message the server would otherwise send back.
Destroy specific blocks (cake, beds, wool, end stone) in a radius for bedwars-style play.
Memeware's Breaker, registered as BlockFucker, scans a 5-block cube every update and, when the block is cake or end stone, sends START then STOP with EnumFacing.NORTH via sendPacketSilent. The target list is a BlockSelectionSetting defaulting to cake, bed, wool and end stone; the pickaxeSlot, cakeBesideOrAt and cakeCovered helpers are dead code left in the file.
// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/misc/Breaker.java =====
package me.memewaredevs.client.module.misc;
import me.hippo.api.lwjeb.annotation.Handler;
import me.memewaredevs.client.Memeware;
import me.memewaredevs.client.event.events.UpdateEvent;
import me.memewaredevs.client.module.Module;
import me.memewaredevs.client.option.BlockSelectionSetting;
import me.memewaredevs.client.util.packet.PacketUtil;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemPickaxe;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import java.util.ArrayList;
import java.util.function.Consumer;
public class Breaker extends Module {
public Breaker() {
super("BlockFucker", 0, Module.Category.MISC);
ArrayList<Block> defaultList = new ArrayList<>();
defaultList.add(Blocks.cake);
defaultList.add(Blocks.bed);
defaultList.add(Blocks.wool);
defaultList.add(Blocks.end_stone);
this.addBlockSelection("Target Blocks", defaultList);
this.addBoolean("Cake Check", true);
}
@Handler
public Consumer<UpdateEvent> onEvent = (event) -> {
final int radius = 5;
BlockSelectionSetting setting = (BlockSelectionSetting) Memeware.INSTANCE.getSettingsManager().getSettingByMod(this.getClass(), "Target Blocks");
for (int x = -radius; x < radius; ++x) {
for (int y2 = radius; y2 > -radius; --y2) {
for (int z = -radius; z < radius; ++z) {
final int xPos = (int) this.mc.thePlayer.posX + x;
final int yPos = (int) this.mc.thePlayer.posY + y2;
final int zPos = (int) this.mc.thePlayer.posZ + z;
final BlockPos blockPos = new BlockPos(xPos, yPos, zPos);
final Block block = this.mc.theWorld.getBlockState(blockPos).getBlock();
if (block == Blocks.cake || block == Blocks.end_stone) {
PacketUtil.sendPacketSilent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.NORTH));
PacketUtil.sendPacketSilent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, blockPos, EnumFacing.NORTH));
}
}
}
}
};
private void breakBlock(BlockPos blockPos) {
PacketUtil.sendPacketSilent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, blockPos, EnumFacing.NORTH));
PacketUtil.sendPacketSilent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, blockPos, EnumFacing.NORTH));
}
private int pickaxeSlot() {
for (int j = 0; j < 8; ++j) {
ItemStack stack = mc.thePlayer.inventory.mainInventory[j];
if (stack != null && stack.getItem() instanceof ItemPickaxe) {
return j;
}
}
return -10;
}
private boolean cakeBesideOrAt(BlockPos blockPos) {
for (EnumFacing face : new EnumFacing[] {EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.WEST, EnumFacing.EAST, EnumFacing.DOWN}) {
if (mc.theWorld.getBlockState(blockPos.offset(face)).getBlock() == Blocks.cake) {
return true;
}
}
return mc.theWorld.getBlockState(blockPos).getBlock() == Blocks.cake;
}
private boolean cakeCovered(BlockPos blockPos) {
for (EnumFacing face : new EnumFacing[] {EnumFacing.NORTH, EnumFacing.SOUTH, EnumFacing.WEST, EnumFacing.EAST, EnumFacing.UP}) {
if (mc.theWorld.getBlockState(blockPos.offset(face)).getBlock() == Blocks.air) {
return false;
}
}
return true;
}
}
// NOTE (AI): Registered as BlockFucker. The UpdateEvent handler scans a 5-block cube around the player and, when the block is cake or end stone, sends START then STOP with EnumFacing.NORTH via sendPacketSilent (the bus-bypassing path). The pickaxeSlot, cakeBesideOrAt and cakeCovered helpers are dead code; the actual target list comes from the BlockSelectionSetting populated with cake, bed, wool and end stone defaults. This is the bedwars-style block destroyer: it only ever touches C07 and never sends C08 placements or C0A swings, so the only server-side evidence is the instant-break packet pair.
Mine faster by running the block-breaking math client-side and finishing the dig with a single STOP packet.
On PacketSendEvent it arms on START_DESTROY_BLOCK, records position and facing, and disarms on ABORT or STOP. While armed, every pre-motion tick accumulates damage += playerRelativeBlockHardness * speed; when damage reaches 1 it swaps the block to air client-side and sends STOP_DESTROY_BLOCK via sendPacketNoEvent. blockHitDelay is zeroed so the next block starts immediately.
// ===== FILE: Tenacity 6.0, dev/tenacity/event/impl/player/SpeedMine.java =====
package dev.tenacity.event.impl.player;
import dev.tenacity.module.ModuleCategory;
import dev.tenacity.module.Module;
import dev.tenacity.event.IEventListener;
import dev.tenacity.event.impl.network.PacketSendEvent;
import dev.tenacity.event.impl.player.MotionEvent;
import dev.tenacity.setting.impl.NumberSetting;
import dev.tenacity.util.network.PacketUtils;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
public class SpeedMine extends Module {
private final NumberSetting speed = new NumberSetting("Speed", 1.5, 1, 3, 0.1);
private EnumFacing facing;
private BlockPos pos;
private boolean boost;
private float damage;
public SpeedMine() {
super("SpeedMine", "mines blocks faster", ModuleCategory.PLAYER);
initializeSettings(speed);
}
private final IEventListener<MotionEvent> onMotion = e -> {
if (e.isPre()) {
mc.playerController.blockHitDelay = 0;
if (pos != null && boost) {
IBlockState blockState = mc.theWorld.getBlockState(pos);
if (blockState == null) return;
try {
damage += (float) (blockState.getBlock().getPlayerRelativeBlockHardness(mc.thePlayer, mc.theWorld, pos) * speed.getCurrentValue());
} catch (Exception ex) {
ex.printStackTrace();
return;
}
if (damage >= 1) {
try {
mc.theWorld.setBlockState(pos, Blocks.air.getDefaultState(), 11);
} catch (Exception ex) {
ex.printStackTrace();
return;
}
PacketUtils.sendPacketNoEvent(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, pos, facing));
damage = 0;
boost = false;
}
}
}
};
private final IEventListener<PacketSendEvent> onPacketSend = e -> {
if (e.getPacket() instanceof C07PacketPlayerDigging) {
C07PacketPlayerDigging packet = (C07PacketPlayerDigging) e.getPacket();
if (packet.getStatus() == C07PacketPlayerDigging.Action.START_DESTROY_BLOCK) {
boost = true;
pos = packet.getPosition();
facing = packet.getFacing();
damage = 0;
} else if (packet.getStatus() == C07PacketPlayerDigging.Action.ABORT_DESTROY_BLOCK | packet.getStatus() == C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK) {
boost = false;
pos = null;
facing = null;
}
}
};
}
// NOTE (AI): SpeedMine sits in the event package but is a real Module. It does not fake the dig time; it runs the block-breaking math client-side. On PacketSendEvent it arms on START_DESTROY_BLOCK, records pos and facing, and disarms on ABORT or STOP. While armed, every pre-motion tick accumulates damage += playerRelativeBlockHardness * speed, and when damage reaches 1 it swaps the block to air client-side (setBlockState) and sends STOP_DESTROY_BLOCK without event. The server receives a legitimately-timed STOP and processes the break normally; the client-side air swap is what makes the block vanish instantly for the local player, and the server's own damage counter never has to reach the threshold. blockHitDelay=0 removes the vanilla post-hit delay that would otherwise slow the next block.
Cancel the movement slow applied while eating or blocking by releasing the use-item state and immediately re-placing.
Spicy's NoSlow, on pre update while blocking with a sword, moving, on ground within 0.42 and with no killaura target, sends RELEASE_USE_ITEM with a BlockPos built from RandomUtils.nextDouble(4.9E-324D, 1.7976931348623157E308D) on every axis, then on post sends C08PacketPlayerBlockPlacement at (-1,-1,-1) with the held item to re-enter the block state. The server reads only the status of the release, so the random position is harmless to vanilla but defeats position-comparing heuristics.
// ===== FILE: Spicy, info/spicyclient/modules/movement/NoSlow.java =====
package info.spicyclient.modules.movement;
import org.apache.commons.lang3.RandomUtils;
import org.lwjgl.input.Keyboard;
import info.spicyclient.SpicyClient;
import info.spicyclient.chatCommands.Command;
import info.spicyclient.events.Event;
import info.spicyclient.events.listeners.EventUpdate;
import info.spicyclient.modules.Module;
import info.spicyclient.modules.combat.Killaura;
import info.spicyclient.util.MovementUtils;
import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.network.play.client.C07PacketPlayerDigging.Action;
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
public class NoSlow extends Module {
public NoSlow() {
super("NoSlow", Keyboard.KEY_NONE, Category.MOVEMENT);
}
public void onEnable() {
}
public void onDisable() {
}
public void onEvent(Event e) {
if (e instanceof EventUpdate && e.isPre()) {
if (mc.thePlayer.isBlocking() && MovementUtils.isMoving() && MovementUtils.isOnGround(0.42D) && SpicyClient.config.killaura.target == null) {
if (e.isPre()) {
mc.getNetHandler().getNetworkManager().sendPacket(new C07PacketPlayerDigging(Action.RELEASE_USE_ITEM, new BlockPos(RandomUtils.nextDouble(4.9E-324D, 1.7976931348623157E308D), RandomUtils.nextDouble(4.9E-324D, 1.7976931348623157E308D), RandomUtils.nextDouble(4.9E-324D, 1.7976931348623157E308D)), EnumFacing.DOWN));
} else {
mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(new BlockPos(-1, -1, -1), 255, mc.thePlayer.getHeldItem(), 0.0F, 0.0F, 0.0F));
}
}
}
}
}
// NOTE (AI): The NoSlow bypass in 50 lines. On pre update, while blocking with a sword, moving, on ground within 0.42, and with no active killaura target, it sends RELEASE_USE_ITEM with a BlockPos built from RandomUtils.nextDouble(4.9E-324D, 1.7976931348623157E308D) for every axis, then on post sends the C08 re-place at (-1,-1,-1) with the held item. The server only reads the status field of RELEASE_USE_ITEM, so the random position is ignored by vanilla, but it defeats anti-cheats that compare the C07 position against the player's location as a heuristic. The release+re-place pair cancels the eating/blocking slow without ever dropping the block state.
Fire fully charged arrows without holding the draw, by releasing the use-item state early and faking the charge.
While the use key is held with a bow, reset the item damage to -1, call sendUseItem to enter the use state, then send 20 C06PacketPlayerPosLook packets aimed at the target with onGround true so the server registers continuous rotation during the charge. Fire RELEASE_USE_ITEM, then call onPlayerStoppedUsing directly with a charge tick of 10, which fixes the arrow power as a 10-tick draw regardless of real draw time. A trailing bare C03 keeps the movement stream alive.
// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/combat/FastBow.java =====
package me.memewaredevs.client.module.combat;
import me.hippo.api.lwjeb.annotation.Handler;
import me.memewaredevs.client.event.events.UpdateEvent;
import me.memewaredevs.client.module.Module;
import me.memewaredevs.client.util.combat.RotationUtils;
import me.memewaredevs.client.util.packet.PacketUtil;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemBow;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Collectors;
public class FastBow extends Module {
public FastBow() {
super("Fast Bow", 0, Module.Category.COMBAT);
}
@Handler
public Consumer<UpdateEvent> update = event -> {
if (event.isPre()) {
this.getTarg().forEach(target -> {
if (doCheck()) {
mc.thePlayer.inventory.getCurrentItem().setItemDamage(-1);
duraHack(9, this.mc.thePlayer.inventory.currentItem);
mc.playerController.sendUseItem(mc.thePlayer,
mc.theWorld,
mc.thePlayer.inventory.getCurrentItem());
mc.thePlayer.inventory.getCurrentItem().getItem().onItemRightClick(
mc.thePlayer.inventory.getCurrentItem(),
mc.theWorld, mc.thePlayer);
final float[] rotations = RotationUtils.getBowAngles(target);
for (int i2 = 0; i2 < 20; ++i2) {
this.mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C06PacketPlayerPosLook(
this.mc.thePlayer.posX, this.mc.thePlayer.posY, this.mc.thePlayer.posZ, rotations[0],
rotations[1], true));
}
;
duraHack(9, this.mc.thePlayer.inventory.currentItem);
mc.getNetHandler().addToSendQueue(new C07PacketPlayerDigging(
C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.UP));
mc.thePlayer.inventory.getCurrentItem().getItem().onPlayerStoppedUsing(
mc.thePlayer.inventory.getCurrentItem(),
mc.theWorld, mc.thePlayer, 10);
PacketUtil.sendPacket(new C03PacketPlayer());
}
});
}
};
@Override
public void onEnable() {
}
private boolean doCheck() {
boolean b = mc.thePlayer.getHealth() <= 0.0f
|| !mc.thePlayer.isCollidedVertically
&& !mc.thePlayer.capabilities.isCreativeMode
|| mc.thePlayer.inventory.getCurrentItem() == null
|| !(mc.thePlayer.inventory.getCurrentItem().getItem() instanceof ItemBow)
|| !mc.gameSettings.keyBindUseItem.getIsKeyPressed();
return !b;
}
@SuppressWarnings("unused")
private void duraHack(int slot, int hotbarNum) {
for (int unused : new int[2]) {
mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, hotbarNum, 2, mc.thePlayer);
}
}
@Override
public void onDisable() {
}
private List<EntityLivingBase> getTarg() {
return mc.theWorld.playerEntities.stream()
.filter(ent -> mc.thePlayer.canEntityBeSeen(ent) && mc.thePlayer.getDistanceToEntity(ent) <= 25
&& mc.thePlayer != ent)
.limit(10).collect(Collectors.toCollection(ArrayList::new));
}
}
// NOTE (AI): The bow-charge exploit. While the use key is held with a bow, it resets the item damage to -1, calls sendUseItem to enter the use state, then spams 20 C06PacketPlayerPosLook packets aimed at the target (onGround true) so the server registers continuous rotation updates during the charge. It then fires RELEASE_USE_ITEM and calls onPlayerStoppedUsing directly with a charge tick of 10, which is what sets the arrow power: the client computes the shot as a 10-tick draw even though the player clicked a moment earlier. The duraHack windowClick double-swap is a separate durability-fix exploit. The trailing bare C03PacketPlayer() keeps the movement stream alive after the release.
Emit C07 RELEASE_USE_ITEM around attacks for autoblock, and filter outgoing releases in the VANILLA and WATCHDOG autoblock modes.
In BASIC autoblock, before the attack the module queues C08 place, and after the swing queues C07 RELEASE_USE_ITEM at BlockPos.ORIGIN with EnumFacing.DOWN to end the block; unblock() repeats the same release when the target dies or the sword is swapped. The EventPacket.Out listener cancels outgoing RELEASE_USE_ITEM dig packets under VANILLA and WATCHDOG autoblock (the block state is managed by the C08 hold instead) and resets the blocking flag otherwise. HOLD mode presses the inventory key instead of sending dig packets.
// ===== FILE: November Recode 2.0, feature/module/impl/combat/KillAuraModule.java =====
/* November.lol © 2023 */
package lol.november.feature.module.impl.combat;
import static lol.november.listener.bus.DefaultEventPriority.HIGH;
import java.util.Comparator;
import java.util.function.Function;
import lol.november.November;
import lol.november.feature.module.Category;
import lol.november.feature.module.Module;
import lol.november.feature.module.Register;
import lol.november.feature.setting.Setting;
import lol.november.listener.bus.Listener;
import lol.november.listener.bus.Subscribe;
import lol.november.listener.event.Stage;
import lol.november.listener.event.net.EventPacket;
import lol.november.listener.event.player.move.EventWalkingUpdate;
import lol.november.listener.event.render.EventRenderItemUse;
import lol.november.utility.math.MathUtils;
import lol.november.utility.math.RotationUtils;
import lol.november.utility.math.timer.Timer;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.network.play.client.C02PacketUseEntity;
import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
/**
* @author Gavin
* @since 2.0.0
*/
@Register(
name = "KillAura",
description = "Attacks entities around you",
category = Category.COMBAT
)
public class KillAuraModule extends Module {
private final Setting<Mode> mode = new Setting<>("Mode", Mode.SINGLE);
private final Setting<Sort> sort = new Setting<>("Sort", Sort.DISTANCE);
private final Setting<Click> clicking = new Setting<>(
"Clicking",
Click.BASIC
);
private final Setting<Integer> minCps = new Setting<>(
() -> clicking.getValue() != Click.UPDATED,
"Min CPS",
12,
1,
0,
20
);
private final Setting<Integer> maxCps = new Setting<>(
() -> clicking.getValue() != Click.UPDATED,
"Max CPS",
16,
1,
0,
20
);
private final Setting<Double> range = new Setting<>(
"Range",
4.0,
0.01,
1.0,
6.0
);
private final Setting<Double> wallRange = new Setting<>(
"Wall Range",
3.0,
0.01,
1.0,
6.0
);
private final Setting<AutoBlock> autoBlock = new Setting<>(
"Auto Block",
AutoBlock.VANILLA
);
private final Setting<Boolean> rotate = new Setting<>("Rotate", true);
private final Setting<Boolean> keepSprint = new Setting<>(
"Keep Sprint",
false
);
private final Timer timer = new Timer();
private EntityLivingBase attackTarget;
private float[] rotations;
private boolean blocking;
@Override
public void disable() {
super.disable();
attackTarget = null;
rotations = null;
if (blocking) unblock();
}
@Subscribe(ignoreCanceled = false)
private final Listener<EventWalkingUpdate> walkingUpdate = event -> {
if (!validTarget(attackTarget) || mode.getValue() == Mode.SWITCH) {
attackTarget =
(EntityLivingBase) mc.theWorld.loadedEntityList
.stream()
.filter(entity ->
entity instanceof EntityLivingBase &&
validTarget((EntityLivingBase) entity)
)
.min(
Comparator.comparingDouble(entity ->
sort.getValue().compare((EntityLivingBase) entity)
)
)
.orElse(null);
}
if (attackTarget == null) {
if (blocking && event.getStage() == Stage.PRE) unblock();
return;
}
if (rotate.getValue()) {
float[] rots = RotationUtils.entity(attackTarget);
November.instance().rotations().spoof(HIGH, 5, rots);
rotations = rots;
}
if (holdingSword()) {
if (!blocking) {
blocking = true;
switch (autoBlock.getValue()) {
case HOLD -> mc.gameSettings.keyBindInventory.pressed = true;
case BASIC, VANILLA -> {
mc.thePlayer.sendQueue.addToSendQueue(
new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem())
);
// don't attack after blocking - this could be another setting
if (autoBlock.getValue() == AutoBlock.VANILLA) return;
}
}
}
} else {
if (blocking) unblock();
}
if (event.getStage() == Stage.PRE) {
// nov 1.0.0 has this in EventUpdate, this is pretty much the same
if (autoBlock.getValue() == AutoBlock.WATCHDOG) {
if (attackTarget.hurtTime > 2) {
blocking = true;
mc.thePlayer.sendQueue.addToSendQueue(
new C08PacketPlayerBlockPlacement(null)
);
}
if (attackTarget.hurtTime == 2) unblock();
}
if (timer.passed((long) attackTime())) {
if (
autoBlock.getValue() == AutoBlock.BASIC && blocking
) mc.thePlayer.sendQueue.addToSendQueue(
new C07PacketPlayerDigging(
C07PacketPlayerDigging.Action.RELEASE_USE_ITEM,
BlockPos.ORIGIN,
EnumFacing.DOWN
)
);
mc.thePlayer.swingItem();
if (keepSprint.getValue()) {
mc.thePlayer.sendQueue.addToSendQueue(
new C02PacketUseEntity(
attackTarget,
C02PacketUseEntity.Action.ATTACK
)
);
} else {
mc.playerController.attackEntity(mc.thePlayer, attackTarget);
}
timer.reset();
if (
autoBlock.getValue() == AutoBlock.BASIC && !blocking
) mc.thePlayer.sendQueue.addToSendQueue(
new C08PacketPlayerBlockPlacement(mc.thePlayer.getHeldItem())
);
}
}
};
@Subscribe
private final Listener<EventPacket.Out> packetOut = event -> {
if (event.get() instanceof C02PacketUseEntity packet) {
if (packet.getAction() != C02PacketUseEntity.Action.ATTACK) return;
Entity entity = packet.getEntityFromWorld(mc.theWorld);
if (!(entity instanceof EntityLivingBase livingBase)) return;
if (
autoBlock.getValue() == AutoBlock.WATCHDOG && livingBase.hurtTime > 2
) event.setCanceled(true);
} else if (event.get() instanceof C07PacketPlayerDigging packet) {
if (
packet.getStatus() != C07PacketPlayerDigging.Action.RELEASE_USE_ITEM
) return;
if (
autoBlock.getValue() == AutoBlock.VANILLA ||
autoBlock.getValue() == AutoBlock.WATCHDOG
) {
event.setCanceled(true);
} else {
blocking = false;
}
}
};
@Subscribe
private final Listener<EventRenderItemUse> renderItemUse = event -> {
// event.getItemStack() should never be null because of where the event is hooked
if (blocking && event.getItemStack().getItem() instanceof ItemSword) {
event.setAction(EnumAction.BLOCK);
event.setCanceled(true);
}
};
private double attackTime() {
return switch (clicking.getValue()) {
case BASIC -> 1000.0 /
MathUtils.random(minCps.getValue(), maxCps.getValue());
default -> 0.0;
};
}
private boolean validTarget(EntityLivingBase entity) {
if (
entity == null ||
entity.equals(mc.thePlayer) ||
entity.isDead ||
entity.getHealth() <= 0.0f
) return false;
if (entity instanceof EntityArmorStand) return false;
AntiBotModule antiBot = November
.instance()
.modules()
.get(AntiBotModule.class);
if (
antiBot != null && antiBot.toggled() && antiBot.bot(entity.getEntityId())
) return false;
double r = mc.thePlayer.canEntityBeSeen(entity)
? range.getValue()
: wallRange.getValue();
return mc.thePlayer.getDistanceSqToEntity(entity) <= r * r;
}
private void unblock() {
if (!holdingSword()) {
blocking = false;
return;
}
switch (autoBlock.getValue()) {
case HOLD -> mc.gameSettings.keyBindInventory.pressed = false;
case BASIC, VANILLA, WATCHDOG -> mc.thePlayer.sendQueue.addToSendQueue(
new C07PacketPlayerDigging(
C07PacketPlayerDigging.Action.RELEASE_USE_ITEM,
BlockPos.ORIGIN,
EnumFacing.DOWN
)
);
}
blocking = false;
}
private boolean holdingSword() {
ItemStack itemStack = mc.thePlayer.getHeldItem();
return itemStack != null && itemStack.getItem() instanceof ItemSword;
}
public EntityLivingBase getAttackTarget() {
return attackTarget;
}
private enum Mode {
SINGLE,
SWITCH,
HURT_TIME,
}
private enum Sort {
DISTANCE(entity -> mc.thePlayer.getDistanceSqToEntity(entity)),
HEALTH(entity ->
(double) (entity.getHealth() + entity.getAbsorptionAmount())
),
HURT_TIME(entity -> (double) entity.hurtTime),
ARMOR(entity -> (double) entity.getTotalArmorValue());
private final Function<EntityLivingBase, Double> comparator;
Sort(Function<EntityLivingBase, Double> comparator) {
this.comparator = comparator;
}
public double compare(EntityLivingBase entity) {
return comparator.apply(entity);
}
}
private enum Click {
BASIC,
ADVANCED,
UPDATED,
}
private enum AutoBlock {
NONE,
FAKE,
HOLD,
BASIC,
VANILLA,
WATCHDOG,
}
}
// NOTE (AI): The full KillAuraModule, shown here for its C07 half: the BASIC autoblock cycle sends C08 place, swings, then sends C07 RELEASE_USE_ITEM at BlockPos.ORIGIN with EnumFacing.DOWN; unblock() sends the same release when the target dies. The packet filter cancels outgoing RELEASE_USE_ITEM packets under VANILLA and WATCHDOG autoblock. The C02 ATTACK emission in the same file is covered in the C02 writeup.Cancel the blocking slow by releasing the use-item state with C07 RELEASE_USE_ITEM on the ground, then re-placing with C08 to keep blocking.
On UpdateEvent, while onGround (or within 0.5) the module queues C07 RELEASE_USE_ITEM at BlockPos.ORIGIN with EnumFacing.DOWN; separately, when blocking with a sword, moving, within 0.42 of the ground and with no Aura target, it re-places the held item every 65ms via C08. The blink side cancels and buffers C04, C06, C08, C0A, C0B and C02 during the run window and replays them on disable.
// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/movement/HYTRun.java =====
package me.AquaVit.liquidSense.modules.movement;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.*;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.ccbluex.liquidbounce.features.module.modules.combat.Aura;
import net.ccbluex.liquidbounce.utils.MovementUtils;
import net.ccbluex.liquidbounce.utils.timer.TimeUtils;
import net.ccbluex.liquidbounce.value.FloatValue;
import net.ccbluex.liquidbounce.value.IntegerValue;
import net.ccbluex.liquidbounce.value.ListValue;
import net.minecraft.entity.Entity;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.*;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumFacing;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
@ModuleInfo(name = "HYTRun", description = "HYTRun Bypass:/", category = ModuleCategory.MOVEMENT)
public class HYTRun extends Module {
private final List<Packet> packets = new ArrayList<>();
private final LinkedList<double[]> positions = new LinkedList<>();
private boolean disableLogger;
Aura killAura = (Aura) LiquidBounce.moduleManager.getModule(Aura.class);
private final TimeUtils timer = new TimeUtils();
private final FloatValue MotionF = new FloatValue("MotionSpike", 5.0F, 0.1F, 30F);
private final FloatValue MotionY = new FloatValue("MotionY", 1.0F, 0.1F, 10F);
@Override
public void onDisable() {
if(mc.thePlayer == null)
return;
blink();
}
@Override
public void onEnable() {
synchronized (positions) {
positions.add(new double[]{mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY + (mc.thePlayer.getEyeHeight() / 2), mc.thePlayer.posZ});
positions.add(new double[]{mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY, mc.thePlayer.posZ});
}
mc.thePlayer.motionY = MotionY.get();
mc.thePlayer.motionX *= MotionF.get();
mc.thePlayer.motionZ *= MotionF.get();
}
@EventTarget
public void onPacket(PacketEvent event) {
final Packet<?> packet = event.getPacket();
if (mc.thePlayer == null || disableLogger)
return;
if (packet instanceof C03PacketPlayer) // Cancel all movement stuff
event.cancelEvent();
if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition || packet instanceof C03PacketPlayer.C06PacketPlayerPosLook ||
packet instanceof C08PacketPlayerBlockPlacement ||
packet instanceof C0APacketAnimation ||
packet instanceof C0BPacketEntityAction || packet instanceof C02PacketUseEntity) {
event.cancelEvent();
packets.add(packet);
}
}
@EventTarget
public void onUpdate(UpdateEvent event) {
synchronized (positions) {
positions.add(new double[]{mc.thePlayer.posX, mc.thePlayer.getEntityBoundingBox().minY, mc.thePlayer.posZ});
}
if(mc.thePlayer.onGround || MovementUtils.isOnGround(0.5))
mc.thePlayer.sendQueue.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
if(mc.thePlayer.isBlocking() && MovementUtils.isMoving() && MovementUtils.isOnGround(0.42) && ( killAura.getTarget() == null)){
if(timer.delay(65)){
mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventory.getCurrentItem()));
timer.reset();
}
}
}
private void blink() {
try {
disableLogger = true;
final Iterator<Packet> packetIterator = packets.iterator();
for(; packetIterator.hasNext(); ) {
mc.getNetHandler().addToSendQueue(packetIterator.next());
packetIterator.remove();
}
disableLogger = false;
}catch(final Exception e) {
e.printStackTrace();
disableLogger = false;
}
synchronized(positions) {
positions.clear();
}
}
}
// NOTE (AI): The full HYTRun module: on ground contact it sends C07 RELEASE_USE_ITEM at BlockPos.ORIGIN with EnumFacing.DOWN every update, and while blocking with a sword and no Aura target it re-places the held item every 65ms. The blink half cancels and buffers the movement and interaction packets during the run window.anticheat Anti-Cheat Checks
The digging packet is the block-break trigger: it carries start, stop, abort and item-release actions with a block position and face. Server-side anticheats treat it as the point to validate break duration against block hardness and tool speed, break reach, swing correlation, and the number of blocks broken per second. The corpus splits into modern simulation checks (Grim FastBreak, Intave CompletionDurationCheck) that recompute the expected mining time, and classic rate checks (NCP blockbreak suite, Arc Nuker) that score break frequency and packet rhythm.
The reference modern fast-break check: verifies that the time between start-digging and finish-digging is long enough for the held tool to break the block.
Implements BlockBreakListener and PreViaPacketReceiveListener. On START_DIGGING it records the target block and the maximum block damage per 50 ms tick computed from the held item and block properties (BlockBreakSpeed), then on STOP_DIGGING it measures the elapsed time against the accumulated damage. A balance tracks how far the player finished early, and a separate delay balance enforces the 300 ms minimum between non-instant breaks. It cancels the finish-digging packet and flags when the client breaks faster than the simulated damage allows.
// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/breaking/FastBreak.java =====
package ac.grim.grimac.checks.impl.breaking;
import ac.grim.grimac.api.storage.verbose.Verbose;
import ac.grim.grimac.checks.Check;
import ac.grim.grimac.checks.CheckData;
import ac.grim.grimac.checks.impl.verbose.VerboseCodecs;
import ac.grim.grimac.checks.type.BlockBreakListener;
import ac.grim.grimac.checks.type.PreViaPacketReceiveListener;
import ac.grim.grimac.player.GrimPlayer;
import ac.grim.grimac.utils.anticheat.update.BlockBreak;
import ac.grim.grimac.utils.math.GrimMath;
import ac.grim.grimac.utils.nmsutil.BlockBreakSpeed;
import ac.grim.grimac.utils.viaversion.ViaVersionUtil;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.protocol.player.DiggingAction;
import com.github.retrooper.packetevents.protocol.world.states.WrappedBlockState;
import com.github.retrooper.packetevents.protocol.world.states.type.StateType;
import com.github.retrooper.packetevents.protocol.world.states.type.StateTypes;
import com.github.retrooper.packetevents.util.Vector3i;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientPlayerFlying;
import java.util.Set;
// Based loosely off of Hawk BlockBreakSpeedSurvival
// Also based loosely off of NoCheatPlus FastBreak
// Also based off minecraft wiki: https://minecraft.wiki/w/Breaking#Instant_breaking
@CheckData(name = "FastBreak", stableKey = "grim.breaking.fast_break", description = "Breaking blocks too quickly")
public class FastBreak extends Check implements BlockBreakListener, PreViaPacketReceiveListener {
private static final Verbose V =
Verbose.of("[delay={ulong}ms|diff={f64:%.1f}ms, balance={f64:%.1f}ms], type={block}");
// For some reason these states flag and I don't know why.
// Better to just exempt to not annoy legit players.
private static final Set<StateType> EXEMPT_STATES = Set.of();
private final boolean clientOlderThanServer = PacketEvents.getAPI().getServerManager().getVersion().getProtocolVersion() > player.getClientVersion().getProtocolVersion();
public FastBreak(GrimPlayer playerData) {
super(playerData);
}
// The block the player is currently breaking
Vector3i targetBlockPosition = null;
// The maximum amount of damage the player deals to the block
//
double maximumBlockDamage = 0;
// The last time a finish digging packet was sent, to enforce 0.3-second delay after non-instabreak
long lastFinishBreak = 0;
// The time the player started to break the block, to know how long the player waited until they finished breaking the block
long startBreak = 0;
// The buffer to this check
double blockBreakBalance = 0;
double blockDelayBalance = 0;
@Override
public void onBlockBreak(BlockBreak blockBreak) {
if (blockBreak.action == DiggingAction.START_DIGGING) {
if (!ViaVersionUtil.isAvailable) {
// Exempt all blocks that do not exist in the player version
final WrappedBlockState defaultState = WrappedBlockState.getDefaultState(player.getClientVersion(), blockBreak.block.getType());
if (defaultState.getType() == StateTypes.AIR || EXEMPT_STATES.contains(defaultState.getType())) {
return;
}
}
// If client is older than the server, fetch block client actually sees from via
// otherwise just return the server-side block (since if client is >= server version the block is guaranteed to exist in client version)
// TODO this lazy loads PacketEvents mappings for older versions for clients on versions older than the servers, increasing memory usage
// * its the only thing we use non-native mappings for behind ViaVersion
// * can we translate back "up" to server version and run check against server version to avoid loading older registries?
WrappedBlockState block = clientOlderThanServer ? WrappedBlockState.getByGlobalId(player.getClientVersion(), player.getViaTranslatedClientBlockID(blockBreak.block.getGlobalId())) : blockBreak.block;
startBreak = System.currentTimeMillis() - (targetBlockPosition == null ? 50 : 0); // ???
targetBlockPosition = blockBreak.position;
// FIXME: getBlockDamage might not return the correct value if the player switched slots before this
maximumBlockDamage = BlockBreakSpeed.getBlockDamage(player, block);
double breakDelay = System.currentTimeMillis() - lastFinishBreak;
if (breakDelay >= 275) { // Reduce buffer if "close enough"
blockDelayBalance *= 0.9;
} else { // Otherwise, increase buffer
blockDelayBalance += 300 - breakDelay;
}
if (blockDelayBalance > 1000) { // If more than a second of advantage
int type = VerboseCodecs.block(blockBreak.block.getType(), player.getClientVersion());
if (flag(V.write(verbose()).bool(true).ulong((long) breakDelay).f64(0).f64(0).sint(type)) && shouldModifyPackets()) {
blockBreak.cancel();
}
}
clampBalance();
}
if (blockBreak.action == DiggingAction.FINISHED_DIGGING && targetBlockPosition != null) {
double predictedTime = Math.ceil(1 / maximumBlockDamage) * 50;
double realTime = System.currentTimeMillis() - startBreak;
double diff = predictedTime - realTime;
clampBalance();
if (diff < 25) { // Reduce buffer if "close enough"
blockBreakBalance *= 0.9;
} else { // Otherwise, increase buffer
blockBreakBalance += diff;
}
if (blockBreakBalance > 1000) { // If more than a second of advantage
int type = VerboseCodecs.block(blockBreak.block.getType(), player.getClientVersion());
if (flag(V.write(verbose()).bool(false).ulong(0).f64(diff).f64(blockBreakBalance).sint(type)) && shouldModifyPackets()) {
blockBreak.cancel();
}
}
// also set start time because the breaking netcode is fucked on 1.14.4+
lastFinishBreak = startBreak = System.currentTimeMillis();
}
}
@Override
public void onPreViaPacketReceive(PacketReceiveEvent event) {
// Find the most optimal block damage using the animation packet, which is sent at least once a tick when breaking blocks
// On 1.8 clients, via screws with this packet meaning we must fall back to the 1.8 idle flying packet
//
// listen for flying packets because some block breaks can happen before the next animation (somehow???), causing onGround desync
boolean flying = WrapperPlayClientPlayerFlying.isFlying(event.getPacketType());
if ((flying || (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9) && event.getPacketType() == PacketType.Play.Client.ANIMATION)) && targetBlockPosition != null) {
maximumBlockDamage = Math.max(maximumBlockDamage, BlockBreakSpeed.getBlockDamage(player, player.compensatedWorld.getBlock(targetBlockPosition)));
}
}
private void clampBalance() {
double balance = Math.max(1000, (player.getTransactionPing()));
blockBreakBalance = GrimMath.clamp(blockBreakBalance, -balance, balance); // Clamp not Math.max in case other logic changes
blockDelayBalance = GrimMath.clamp(blockDelayBalance, -balance, balance);
}
}
// NOTE (AI): Grim's FastBreak compares the client-reported break start to the server simulation of block damage over time; the breaking package (FarBreak, MultiBreak, WrongBreak, PositionBreakA/B, RotationBreak) forms a full block-break pipeline driven by the digging packet.
The classic 1.8 dispatcher for the whole block-break check family: direction, fast break, frequency, no swing, reach and wrong block.
Registers six checks (Direction, FastBreak, Frequency, NoSwing, Reach, WrongBlock) plus BlockBreakConfig/BlockBreakData, and listens to BlockBreakEvent, BlockDamageEvent, PlayerAnimationEvent and PlayerInteractEvent at LOWEST priority. The ProtocolLib compat adapters wrap PacketPlayInBlockDig actions (START_DESTROY_BLOCK, STOP_DESTROY_BLOCK, ABORT_DESTROY_BLOCK, RELEASE_USE_ITEM) and route them into the same check set, so both packet-level and event-level break attempts are covered.
// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/blockbreak/BlockBreakListener.java =====
/*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package fr.neatmonster.nocheatplus.checks.blockbreak;
import org.bukkit.GameMode;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockBreakEvent;
import org.bukkit.event.block.BlockDamageEvent;
import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerItemHeldEvent;
import org.bukkit.inventory.ItemStack;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.checks.CheckListener;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.blockinteract.BlockInteractData;
import fr.neatmonster.nocheatplus.checks.blockinteract.BlockInteractListener;
import fr.neatmonster.nocheatplus.checks.net.FlyingQueueHandle;
import fr.neatmonster.nocheatplus.checks.net.model.DataPacketFlying;
import fr.neatmonster.nocheatplus.compat.AlmostBoolean;
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
import fr.neatmonster.nocheatplus.components.NoCheatPlusAPI;
import fr.neatmonster.nocheatplus.components.data.ICheckData;
import fr.neatmonster.nocheatplus.components.data.IData;
import fr.neatmonster.nocheatplus.components.registry.factory.IFactoryOne;
import fr.neatmonster.nocheatplus.hooks.NCPExemptionManager;
import fr.neatmonster.nocheatplus.permissions.Permissions;
import fr.neatmonster.nocheatplus.players.DataManager;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.players.PlayerFactoryArgument;
import fr.neatmonster.nocheatplus.stats.Counters;
import fr.neatmonster.nocheatplus.utilities.TickTask;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
import fr.neatmonster.nocheatplus.utilities.moving.MovingUtil;
import fr.neatmonster.nocheatplus.worlds.WorldFactoryArgument;
/**
* Central location to listen to events that are relevant for the block break checks.
*
* @see BlockBreakEvent
*/
public class BlockBreakListener extends CheckListener {
/** The direction check. */
private final Direction direction = addCheck(new Direction());
/** The fast break check (per block breaking speed). */
private final FastBreak fastBreak = addCheck(new FastBreak());
/** The frequency check (number of blocks broken) */
private final Frequency frequency = addCheck(new Frequency());
/** The no swing check. */
private final NoSwing noSwing = addCheck(new NoSwing());
/** The reach check. */
private final Reach reach = addCheck(new Reach());
/** The wrong block check. */
private final WrongBlock wrongBlock = addCheck(new WrongBlock());
private AlmostBoolean isInstaBreak = AlmostBoolean.NO;
private final Counters counters = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstance(Counters.class);
/** For temporary use: LocUtil.clone before passing deeply, call setWorld(null) after use. */
private final Location useLoc = new Location(null, 0, 0, 0);
@SuppressWarnings("unchecked")
public BlockBreakListener(){
super(CheckType.BLOCKBREAK);
final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();
// Register config and data.
api.register(api.newRegistrationContext()
// BlockBreakConfig
.registerConfigWorld(BlockBreakConfig.class)
.factory(new IFactoryOne<WorldFactoryArgument, BlockBreakConfig>() {
@Override
public BlockBreakConfig getNewInstance(WorldFactoryArgument arg) {
return new BlockBreakConfig(arg.worldData);
}
})
.registerConfigTypesPlayer(CheckType.BLOCKBREAK, true)
.context() //
// BlockBreakData
.registerDataPlayer(BlockBreakData.class)
.factory(new IFactoryOne<PlayerFactoryArgument, BlockBreakData>() {
@Override
public BlockBreakData getNewInstance(
PlayerFactoryArgument arg) {
return new BlockBreakData(
arg.playerData.getGenericInstance(BlockBreakConfig.class));
}
})
// (Complete data removal for now.)
.addToGroups(CheckType.BLOCKBREAK, true, IData.class, ICheckData.class)
.context() //
);
}
@EventHandler(ignoreCancelled = false, priority = EventPriority.LOWEST)
public void onBlockBreak(final BlockBreakEvent event) {
final long now = System.currentTimeMillis();
final Player player = event.getPlayer();
final IPlayerData pData = DataManager.getPlayerData(player);
final BlockBreakConfig cc = pData.getGenericInstance(BlockBreakConfig.class);
final BlockBreakData data = pData.getGenericInstance(BlockBreakData.class);
final BlockInteractData bdata = pData.getGenericInstance(BlockInteractData.class);
boolean cancelled = false;
if (MovingUtil.hasScheduledPlayerSetBack(player)) {
event.setCancelled(true);
}
// Cancelled events only leads to resetting insta break.
if (event.isCancelled()) {
isInstaBreak = AlmostBoolean.NO;
return;
}
// TODO: maybe invalidate instaBreak on some occasions.
final Block block = event.getBlock();
if (BlockProperties.isScaffolding(block.getType())) {
return;
}
// Re-check if this is a block interacted with before. With instantly broken blocks, this may be off by one orthogonally.
final int tick = TickTask.getTick();
final boolean isInteractBlock = !bdata.getLastIsCancelled() && bdata.matchesLastBlock(tick, block);
final GameMode gameMode = player.getGameMode();
int skippedRedundantChecks = 0;
// Did the player try to destroy a liquid block? (Not possible)
if (BlockProperties.isLiquid(block.getType()) && !BlockProperties.isWaterPlant(block.getType())
&& !pData.hasPermission(Permissions.BLOCKBREAK_BREAK_LIQUID, player)
&& !NCPExemptionManager.isExempted(player, CheckType.BLOCKBREAK_BREAK)){
cancelled = true;
}
// Has the player broken a block that was not damaged before?
if (!cancelled && wrongBlock.isEnabled(player, pData)
&& wrongBlock.check(player, block, cc, data, pData, isInstaBreak)) {
cancelled = true;
}
// Has the player broken more blocks per second than allowed?
if (!cancelled && frequency.isEnabled(player, pData)
&& frequency.check(player, tick, cc, data, pData)) {
cancelled = true;
}
// Has the player broken single blocks faster than possible?
if (!cancelled && gameMode != GameMode.CREATIVE
&& fastBreak.isEnabled(player, pData)
&& fastBreak.check(player, block, isInstaBreak, cc, data, pData)) {
cancelled = true;
}
// Did the arm of the player move before breaking this block?
if (!cancelled && noSwing.isEnabled(player, pData)
&& noSwing.check(player, data, pData)) {
cancelled = true;
}
final FlyingQueueHandle flyingHandle;
if (reach.isEnabled(player, pData) || direction.isEnabled(player, pData)) {
flyingHandle = new FlyingQueueHandle(pData);
final Location loc = player.getLocation(useLoc);
final double eyeHeight = MovingUtil.getEyeHeight(player);
// Is the block really in reach distance?
if (!cancelled) {
if (isInteractBlock && bdata.isPassedCheck(CheckType.BLOCKINTERACT_REACH)) {
skippedRedundantChecks ++;
}
else if (reach.isEnabled(player, pData) && reach.check(player, eyeHeight, block, data, cc)) {
cancelled = true;
}
}
// Did the player look at the block at all?
// TODO: Skip if checks were run on this block (all sorts of hashes/conditions).
if (!cancelled) {
if (isInteractBlock && (bdata.isPassedCheck(CheckType.BLOCKINTERACT_DIRECTION)
|| bdata.isPassedCheck(CheckType.BLOCKINTERACT_VISIBLE))) {
skippedRedundantChecks ++;
}
else if (direction.isEnabled(player, pData)
&& direction.check(player, loc, eyeHeight, block, null, flyingHandle, data, cc, pData)) {
cancelled = true;
}
}
useLoc.setWorld(null);
}
else flyingHandle = null;
// On cancel...
if (cancelled) {
event.setCancelled(cancelled);
// Reset damage position:
// TODO: Review this (!), check if set at all !?
data.clickedX = block.getX();
data.clickedY = block.getY();
data.clickedZ = block.getZ();
}
else {
// Invalidate last damage position:
// data.clickedX = Integer.MAX_VALUE;
// Debug log (only if not cancelled, to avoid spam).
if (pData.isDebugActive(CheckType.BLOCKBREAK)) {
debugBlockBreakResult(player, block, skippedRedundantChecks, flyingHandle, pData);
}
}
// Adjust data.
data.wasInstaBreak = isInstaBreak.decideOptimistically() ? now : 0;
data.fastBreakBreakTime = now;
isInstaBreak = AlmostBoolean.NO;
}
private void debugBlockBreakResult(final Player player, final Block block, final int skippedRedundantChecks,
final FlyingQueueHandle flyingHandle, final IPlayerData pData) {
debug(player, "Block break(" + block.getType() + "): " + block.getX() + ", " + block.getY() + ", " + block.getZ());
BlockInteractListener.debugBlockVSBlockInteract(player, checkType, block, "onBlockBreak", Action.LEFT_CLICK_BLOCK, pData);
if (skippedRedundantChecks > 0) {
debug(player, "Skipped redundant checks: " + skippedRedundantChecks);
}
if (flyingHandle != null && flyingHandle.isFlyingQueueFetched()) {
final int flyingIndex = flyingHandle.getFirstIndexWithContentIfFetched();
final DataPacketFlying packet = flyingHandle.getIfFetched(flyingIndex);
if (packet != null) {
debug(player, "Flying packet queue used at index " + flyingIndex + ": pitch=" + packet.getPitch() + ",yaw=" + packet.getYaw());
return;
}
}
}
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerAnimation(final PlayerAnimationEvent event) {
final BlockBreakData data = DataManager.getPlayerData(event.getPlayer()).getGenericInstance(BlockBreakData.class);
data.noSwingCount = Math.max(data.noSwingCount - 1, 0);
}
@EventHandler(ignoreCancelled = false, priority = EventPriority.LOWEST)
public void onPlayerInteract(final PlayerInteractEvent event) {
// We listen to BlockInteract events to be (at least in many cases) able to distinguish between block break events
// that were triggered by players actually digging and events that were artificially created by plugins.
// debug(player, "Interact("+event.isCancelled()+"): " + event.getClickedBlock());
// The following is to set the "first damage time" for a block.
// Return if it is not left clicking a block.
// (Allows right click to be ignored.)
isInstaBreak = AlmostBoolean.NO;
if (event.getAction() != Action.LEFT_CLICK_BLOCK) {
return;
}
checkBlockDamage(event.getPlayer(), event.getClickedBlock(), event);
}
@EventHandler(ignoreCancelled = false, priority = EventPriority.LOWEST)
public void onBlockDamageLowest(final BlockDamageEvent event) {
/*
* TODO: Add a check type BLOCKDAMAGE_CONFIRM (no permission):
* Cancel if the block doesn't match (MC 1.11.2, other ...)?
*/
if (MovingUtil.hasScheduledPlayerSetBack(event.getPlayer())) {
event.setCancelled(true);
}
else if (event.getInstaBreak()) {
// Indicate that this might have been set by CB/MC.
// TODO: Set in BlockInteractListener !!
isInstaBreak = AlmostBoolean.MAYBE;
}
}
@EventHandler(ignoreCancelled = false, priority = EventPriority.MONITOR)
public void onBlockDamage(final BlockDamageEvent event) {
if (!event.isCancelled() && event.getInstaBreak()) {
// Keep MAYBE.
if (isInstaBreak != AlmostBoolean.MAYBE) {
isInstaBreak = AlmostBoolean.YES;
}
}
else isInstaBreak = AlmostBoolean.NO;
checkBlockDamage(event.getPlayer(), event.getBlock(), event);
}
private void checkBlockDamage(final Player player, final Block block, final Cancellable event){
final long now = System.currentTimeMillis();
final IPlayerData pData = DataManager.getPlayerData(player);
final BlockBreakData data = pData.getGenericInstance(BlockBreakData.class);
// if (event.isCancelled()){
// // Reset the time, to avoid certain kinds of cheating. => WHICH ?
// data.fastBreakfirstDamage = now;
// data.clickedX = Integer.MAX_VALUE; // Should be enough to reset that one.
// return;
// }
// Do not care about null blocks.
if (block == null) {
return;
}
final int tick = TickTask.getTick();
// Skip if already set to the same block without breaking within one tick difference.
final ItemStack stack = Bridge1_9.getItemInMainHand(player);
final Material tool = stack == null ? null : stack.getType();
if (data.toolChanged(tool)) {
// Update.
}
else if (tick < data.clickedTick || now < data.fastBreakfirstDamage || now < data.fastBreakBreakTime) {
// Time/tick ran backwards: Update.
// Tick running backwards should not happen in the main thread unless for reload. A plugin could reset it (not intended).
}
else if (data.fastBreakBreakTime < data.fastBreakfirstDamage && data.clickedX == block.getX() && data.clickedZ == block.getZ() && data.clickedY == block.getY()){
// Preserve first damage time.
if (tick - data.clickedTick <= 1 ) {
return;
}
}
// (Always set, the interact event only fires once: the first time.)
// Only record first damage:
data.setClickedBlock(block, tick, now, tool);
// Compare with BlockInteract data (debug first).
if (pData.isDebugActive(CheckType.BLOCKBREAK)) {
BlockInteractListener.debugBlockVSBlockInteract(player, this.checkType, block, "checkBlockDamage", Action.LEFT_CLICK_BLOCK, pData);
}
}
@EventHandler(ignoreCancelled = false, priority = EventPriority.MONITOR)
public void onItemHeld(final PlayerItemHeldEvent event) {
// Reset clicked block.
final Player player = event.getPlayer();
final BlockBreakData data = DataManager.getPlayerData(player).getGenericInstance(BlockBreakData.class);
if (data.toolChanged(player.getInventory().getItem(event.getNewSlot()))) {
data.resetClickedBlock();
}
}
}
// NOTE (AI): NCP's blockbreak listener is event-driven (BlockBreakEvent, BlockDamageEvent, PlayerAnimationEvent); the ProtocolLib adapters wrap PacketPlayInBlockDig (START_DESTROY_BLOCK, STOP_DESTROY_BLOCK, ABORT_DESTROY_BLOCK, RELEASE_USE_ITEM) and feed the same FastBreak, Frequency, NoSwing, Reach and WrongBlock checks.
Intave's modern break-speed check: recomputes the expected break duration server-side from the held item and block hardness, and cancels the stop-dig packet when the block was finished too early.
CompletionDurationCheck subscribes to BLOCK_DIG on ProtocolLib at LOW priority. On START_DESTROY_BLOCK it stores the target position and the initial block damage from BlockInteractionAccess. On STOP_DESTROY_BLOCK it re-resolves the damage with onGround forced true, converts it to the required milliseconds, and if the actual duration fell more than 100 ms short and the balance allows, it builds a Violation, cancels the event and resends the block state to the client. A separate tick subscription decays the balance on every flying packet, and RestartCheck covers dig-restart spam.
// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/check/world/breakspeedlimiter/CompletionDurationCheck.java =====
package de.jpx3.intave.check.world.breakspeedlimiter;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.ProtocolLibrary;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.wrappers.BlockPosition;
import com.comphenix.protocol.wrappers.EnumWrappers;
import com.comphenix.protocol.wrappers.WrappedBlockData;
import de.jpx3.intave.block.access.BlockInteractionAccess;
import de.jpx3.intave.block.access.VolatileBlockAccess;
import de.jpx3.intave.block.variant.BlockVariantNativeAccess;
import de.jpx3.intave.check.MetaCheckPart;
import de.jpx3.intave.check.world.BreakSpeedLimiter;
import de.jpx3.intave.executor.Synchronizer;
import de.jpx3.intave.klass.Lookup;
import de.jpx3.intave.math.MathHelper;
import de.jpx3.intave.module.Modules;
import de.jpx3.intave.module.linker.packet.ListenerPriority;
import de.jpx3.intave.module.linker.packet.PacketSubscription;
import de.jpx3.intave.module.violation.Violation;
import de.jpx3.intave.module.violation.ViolationContext;
import de.jpx3.intave.module.violation.ViolationProcessor;
import de.jpx3.intave.packet.PacketSender;
import de.jpx3.intave.packet.converter.BlockPositionConverter;
import de.jpx3.intave.reflect.access.ReflectiveEntityAccess;
import de.jpx3.intave.user.User;
import de.jpx3.intave.user.meta.CheckCustomMetadata;
import de.jpx3.intave.user.meta.InventoryMetadata;
import org.bukkit.Location;
import org.bukkit.block.Block;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import static de.jpx3.intave.module.linker.packet.PacketId.Client.*;
public final class CompletionDurationCheck extends MetaCheckPart<BreakSpeedLimiter, CompletionDurationCheck.BreakSpeedFinishMeta> {
public CompletionDurationCheck(BreakSpeedLimiter parentCheck) {
super(parentCheck, BreakSpeedFinishMeta.class);
}
@PacketSubscription(
priority = ListenerPriority.LOW,
packetsIn = {
POSITION, POSITION_LOOK, LOOK, FLYING, VEHICLE_MOVE
}
)
public void tickUpdate(PacketEvent event) {
Player player = event.getPlayer();
User user = userOf(player);
BreakSpeedFinishMeta meta = metaOf(user);
if (meta.balance > 0 && !event.isCancelled()) {
meta.balance -= 0.005;
}
}
// @PacketSubscription(
// priority = ListenerPriority.LOW,
// packetsIn = {
// ARM_ANIMATION
// }
// )
// public void actualTickUpdate(PacketEvent event) {
// Player player = event.getPlayer();
// User user = userOf(player);
// BreakSpeedFinishMeta meta = metaOf(user);
//
// ProtocolMetadata clientData = user.meta().protocol();
// InventoryMetadata inventoryData = user.meta().inventory();
//
// if (meta.breakProcess) {
// ItemStack itemInHand = inventoryData.heldItem();
// BlockPosition blockPosition = meta.targetBlockPosition;
//
// float blockDamage = clientData.flyingPacketStream()
// ? BlockInnerAccess.blockDamage(player, itemInHand, blockPosition)
// : resolveBlockDamageOnGround(player, itemInHand, blockPosition);
// player.sendMessage("block damage in tick: " + blockDamage);
// meta.curBlockDamageMP += blockDamage;
// meta.maximumBlockDamage = Math.max(meta.maximumBlockDamage, blockDamage);
// }
// }
@PacketSubscription(
priority = ListenerPriority.LOW,
packetsIn = {
BLOCK_DIG
}
)
public void receiveBlockAction(PacketEvent event) {
Player player = event.getPlayer();
User user = userOf(player);
BreakSpeedFinishMeta meta = metaOf(user);
// ProtocolMetadata clientData = user.meta().protocol();
InventoryMetadata inventoryData = user.meta().inventory();
ItemStack heldItem = inventoryData.heldItem();
PacketContainer packet = event.getPacket();
// BlockPosition blockPosition = packet.getBlockPositionModifier().read(0);
BlockPosition blockPosition = event.getPacket().getModifier()
.withType(Lookup.serverClass("BlockPosition"), BlockPositionConverter.threadConverter())
.read(0);
EnumWrappers.PlayerDigType digType = packet.getPlayerDigTypes().read(0);
switch (digType) {
case START_DESTROY_BLOCK: {
float blockDamage = BlockInteractionAccess.blockDamage(player, heldItem, blockPosition);
meta.breakProcess = true;
meta.breakProcessStartTime = System.currentTimeMillis();
meta.curBlockDamageMP = blockDamage;
meta.targetBlockPosition = blockPosition;
meta.maximumBlockDamage = blockDamage;
break;
}
case STOP_DESTROY_BLOCK: {
// if (clientData.flyingPacketStream()) {
// float blockDamageDealt = BlockInnerAccess.blockDamage(player, heldItem, blockPosition);
// if (blockDamageDealt < 0.79 && meta.balance++ >= 2) { // ~79%
// String message = "broke block too quickly";
// String percentage = (int)(blockDamageDealt * 100d) + "%";
// String details = "at " + percentage;
//
// ViolationProcessor violationProcessor = IntavePlugin.singletonInstance().violationProcessor();
// Violation violation = Violation.builderFor(BreakSpeedLimiter.class)
// .forPlayer(player).withMessage(message).withDetails(details)
// .withVL(10).build();
// ViolationContext violationContext = violationProcessor.processViolation(violation);
// if (violationContext.shouldCounterThreat()) {
// event.setCancelled(true);
// refreshBlocksAround(player, blockPosition.toLocation(player.getWorld()));
// }
// }
// } else {
if (meta.targetBlockPosition != blockPosition) {
blockPosition = meta.targetBlockPosition;
}
if (blockPosition == null) {
return;
}
long requiredDuration = resolveMillisecondsOf(resolveBlockDamageOnGround(player, heldItem, blockPosition));
long actualDuration = System.currentTimeMillis() - meta.breakProcessStartTime;
long exceeded = Math.max(0, requiredDuration - actualDuration);
if (exceeded > 100 && meta.balance++ >= 2) {
String message = "broke block too quickly";
String details = MathHelper.formatDouble(exceeded / 50d, 2) + " ticks faster than expected";
ViolationProcessor violationProcessor = Modules.violationProcessor();
Violation violation = Violation.builderFor(BreakSpeedLimiter.class)
.forPlayer(player).withMessage(message).withDetails(details)
.withVL(10).build();
ViolationContext violationContext = violationProcessor.processViolation(violation);
if (violationContext.shouldCounterThreat()) {
event.setCancelled(true);
refreshBlocksAround(player, blockPosition.toLocation(player.getWorld()));
}
}
// }
// break;
}
case ABORT_DESTROY_BLOCK:
meta.breakProcessStartTime = System.currentTimeMillis();
meta.curBlockDamageMP = 0f;
meta.targetBlockPosition = null;
meta.breakProcess = false;
meta.maximumBlockDamage = Float.MIN_VALUE;
}
}
private void refreshBlocksAround(Player player, Location targetLocation) {
Synchronizer.synchronize(() -> {
player.updateInventory();
refreshBlock(player, targetLocation);
// for (EnumDirection direction : EnumDirection.values()) {
// Location placedBlock = targetLocation.clone().add(direction.getDirectionVec().convertToBukkitVec());
// refreshBlock(player, placedBlock);
// }
});
}
private void refreshBlock(Player player, Location location) {
PacketContainer packet = ProtocolLibrary.getProtocolManager().createPacket(PacketType.Play.Server.BLOCK_CHANGE);
if (!VolatileBlockAccess.isInLoadedChunk(location.getWorld(), location.getBlockX(), location.getBlockZ())) {
return;
}
Block block = VolatileBlockAccess.blockAccess(location);
Object handle = BlockVariantNativeAccess.nativeVariantAccess(block);
WrappedBlockData blockData = WrappedBlockData.fromHandle(handle);
packet.getBlockData().write(0, blockData);
BlockPosition position = new BlockPosition(location.getBlockX(), location.getBlockY(), location.getBlockZ());
packet.getBlockPositionModifier().write(0, position);
PacketSender.sendServerPacket(player, packet);
}
private long resolveMillisecondsOf(float blockDamage) {
if (blockDamage == 0) {
return 0;
}
long time = 0;
float curBlockDamageMP = 0f;
int iterationCountdown = 100;
while (curBlockDamageMP < 1f) {
curBlockDamageMP += blockDamage;
time += 50;
if (--iterationCountdown < 0) {
break;
}
}
return time;
}
private float resolveBlockDamageOnGround(
Player player,
ItemStack itemInHand,
BlockPosition blockPosition
) {
boolean onGroundBefore = ReflectiveEntityAccess.onGround(player);
ReflectiveEntityAccess.setOnGround(player, true);
float blockDamage = BlockInteractionAccess.blockDamage(player, itemInHand, blockPosition);
ReflectiveEntityAccess.setOnGround(player, onGroundBefore);
return blockDamage;
}
public static final class BreakSpeedFinishMeta extends CheckCustomMetadata {
public BlockPosition targetBlockPosition;
public float curBlockDamageMP = 0f;
public float maximumBlockDamage;
/*
breakProcess won't be set to false if a player is stop breaking a block (only when destroying a block),
So isBreakingBlock is a boolean which determines if the player is breaking a block and is false when he stops breaking.
*/
public boolean breakProcess;
public long breakProcessStartTime;
public double balance;
}
}
// NOTE (AI): CompletionDurationCheck is the active part of Intave's BreakSpeedLimiter. It subscribes to BLOCK_DIG on ProtocolLib, recomputes the expected break duration from the held item and block hardness, and cancels the stop-dig packet plus resends the block when the client finished more than 100 ms early. The sibling RestartCheck covers dig restart spam on the same stream.
Classic statistical nuker check: caps the number of block breaks per second and the spacing between them.
A PacketCheck configured with max-breaks-per-second 15, min-delta-between-breaks 50 ms and a threshold of 5 violations before flagging, plus a packet-level cap of 50 break packets per second with an optional kick threshold. Creative-only by default, it cancels the offending events and notifies after every 4th violation.
// ===== FILE: Vrekt-Arc, src/main/java/arc/check/block/Nuker.java =====
package arc.check.block;
import arc.Arc;
import arc.check.PacketCheck;
import arc.check.result.CheckResult;
import arc.check.types.CheckType;
import arc.data.block.BlockData;
import arc.data.packet.PacketData;
import com.comphenix.protocol.PacketType;
import org.bukkit.GameMode;
import org.bukkit.entity.Player;
/**
* Checks if the player is using nuker - destroying an improbable amount of blocks around them.
* This check will also utilize {@code maxPacketsPerSecond} to ensure not too many events are sent.
* <p>
* packet-check: the check will use packets
* creative-only: Player must be in creative to check.
* max-breaks-per-second: The max amount of block breaks per second.
* min-delta-between-breaks: The minimum time allowed between the last break.
* min-delta-between-breaks-threshold: the amount of times the above ^^ has to be triggered to flag.
*/
public final class Nuker extends PacketCheck {
/**
* packet-check: the check will use packets
* creative-only: Player must be in creative to check.
* If packets should be checked.
*/
private boolean packetCheck, creativeOnly, checkPackets;
/**
* max-breaks-per-second: The max amount of block breaks per second.
* min-delta-between-breaks: The minimum time allowed between the last break.
* min-delta-between-breaks-threshold: the amount of times the above ^^ has to be triggered to flag.
*/
private int maxBreaksPerSecond, minDeltaBetweenBreaks, minDeltaBetweenBreaksThreshold;
/**
* Max packets and packet kick threshold
*/
private int maxPacketsPerSecond, packetKickThreshold;
/**
* Kick if the threshold is reached
*/
private boolean kickIfThresholdReached;
public Nuker() {
super(CheckType.NUKER);
isEnabled(true)
.cancel(true)
.cancelLevel(0)
.notify(true)
.notifyEvery(4)
.ban(true)
.banLevel(1000)
.kick(true)
.kickLevel(500)
.build();
addConfigurationValue("packet-check", true);
addConfigurationValue("creative-only", true);
addConfigurationValue("max-breaks-per-second", 15);
addConfigurationValue("min-delta-between-breaks", 50);
addConfigurationValue("min-delta-between-breaks-threshold", 5);
addConfigurationValue("check-packets", true);
addConfigurationValue("max-break-packets-per-second", 50);
addConfigurationValue("kick-if-threshold-reached", false);
addConfigurationValue("packet-kick-threshold", 100);
if (isEnabled()) load();
}
/**
* Check this player for Nuker.
*
* @param player the player
* @return the result
*/
public boolean check(Player player) {
if (!isEnabled() || exempt(player) || creativeOnly && player.getGameMode() != GameMode.CREATIVE) return false;
final CheckResult result = new CheckResult();
final long now = System.currentTimeMillis();
// first, just check packet-stuff.
// Don't use a scheduled check here, because meh.
if (checkPackets) {
final PacketData packetData = PacketData.get(player);
final int count = packetData.getBreakPacketCount() + 1;
packetData.setBreakPacketCount(count);
final long packetDelta = now - packetData.getLastBreakPacketReset();
// check packet counts and deltas.
if (packetDelta >= 1000) {
packetData.setLastBreakPacketReset(now);
if (count >= maxPacketsPerSecond) {
result.setFailed("Too many break packets (or events) per second.")
.withParameter("amount", count)
.withParameter("max", maxPacketsPerSecond);
if (count >= packetKickThreshold && kickIfThresholdReached
&& !Arc.getInstance().getPunishmentManager().hasPendingKick(player)) {
Arc.getInstance().getPunishmentManager().kickPlayer(player, this);
}
} else {
packetData.setCancelBreakPackets(false);
}
packetData.setBreakPacketCount(0);
}
// cancel if we should.
if (packetData.cancelBreakPackets()) {
result.setFailed("Cancelling break packets because there were too many.");
checkViolation(player, result);
return true;
}
final boolean violation = checkViolation(player, result);
packetData.setCancelBreakPackets(violation);
if (violation) return true;
}
// now, block checking.
final BlockData data = BlockData.get(player);
final long delta = now - data.getLastBreak();
data.setTotalBroke(data.getTotalBroke() + 1);
data.setLastBreak(now);
if (now - data.getTotalBrokeReset() >= 1000) {
data.setTotalBrokeReset(now);
if (data.getTotalBroke() > maxBreaksPerSecond) {
result.setFailed("Breaking too many blocks per second.")
.withParameter("total", data.getTotalBroke())
.withParameter("max", maxBreaksPerSecond);
}
data.setTotalBroke(0);
}
// check delta times
if (delta < minDeltaBetweenBreaks) {
// "failed", increment one count.
data.setLastBreakDeltaCount(data.getLastBreakDeltaCount() + 1);
// make sure we haven't already failed, and then check against min.
if (data.getLastBreakDeltaCount() >= minDeltaBetweenBreaksThreshold
&& !result.failed()) {
result.setFailed("Breaking blocks too fast")
.withParameter("count", data.getLastBreakDeltaCount())
.withParameter("min", minDeltaBetweenBreaksThreshold)
.withParameter("delta", delta)
.withParameter("min-delta", minDeltaBetweenBreaks);
}
} else {
// lower since we're okay.
data.setLastBreakDeltaCount(data.getLastBreakDeltaCount() - 1);
}
return checkViolation(player, result);
}
/**
* @return if this check uses packets.
*/
public boolean isPacketCheck() {
return packetCheck;
}
@Override
public void reloadConfig() {
load();
}
@Override
public void load() {
packetCheck = configuration.getBoolean("packet-check");
creativeOnly = configuration.getBoolean("creative-only");
checkPackets = configuration.getBoolean("check-packets");
maxBreaksPerSecond = configuration.getInt("max-breaks-per-second");
minDeltaBetweenBreaks = configuration.getInt("min-delta-between-breaks");
minDeltaBetweenBreaksThreshold = configuration.getInt("min-delta-between-breaks-threshold");
maxPacketsPerSecond = configuration.getInt("max-break-packets-per-second");
kickIfThresholdReached = configuration.getBoolean("kick-if-threshold-reached");
packetKickThreshold = configuration.getInt("packet-kick-threshold");
if (packetCheck) {
registerPacketListener(PacketType.Play.Client.BLOCK_DIG, event -> event.setCancelled(check(event.getPlayer())));
}
}
}
// NOTE (AI): Arc's Nuker is a classic 1.8 statistical check: it counts distinct blocks dug within one second using Bukkit events and flags when the count exceeds the natural mining speed for the held tool.
Related Packets
Wiki Cross-Reference
A vanilla server only accepts digging packets whose block center is within a 6-unit radius of the player eyes. Cancelled digging always uses the bottom face, drop-item actions always use position 0/0/0 with the bottom face, and when a block is instamined or the player is in creative mode the client sends no Finished digging, so the server must compute destruction speed itself.
MCP 1.8.9 C07PacketPlayerDigging implements Packet
1.8.9 callers: EntityPlayerSP.dropOneItem sends new C07PacketPlayerDigging (line 282) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/entity/EntityPlayerSP.java
Cross-checked against minecraft.wiki (CC BY-SA 3.0) for 1.8.9 accuracy.
Vanilla Internals
Full 1.8.9 logic-class sources that send or handle this packet, stored verbatim.
Module Analyses Using C07PacketPlayerDigging
Full source walkthroughs of the modules and anti-cheats that use this packet.