0x02 C02PacketUseEntity
Player interacts with (attacks or right-clicks) an entity.
Published 2026-06-18 · Updated 2026-10-14
Fields
| Field | Type | Description |
|---|---|---|
| entityId | VarInt | Target entity ID |
| action | Enum | INTERACT, ATTACK, or INTERACT_AT |
| hitVec | (float,float,float) | Target position on the entity (for INTERACT_AT) |
Wire Encoding
| Field | Type | Notes |
|---|---|---|
| Entity ID | VarInt | |
| Type | VarInt Enum | 0=INTERACT, 1=ATTACK, 2=INTERACT_AT |
| Hit X (if INTERACT_AT) | float | |
| Hit Y (if INTERACT_AT) | float | |
| Hit Z (if INTERACT_AT) | float |
MCP References
NetHandlerPlayServer.processUseEntity()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 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
Deobfuscated MCP 1.8.9 source of C02PacketUseEntity, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/client/C02PacketUseEntity.java) at build time and verified present.
Deep Dive
Role in the protocol
C02PacketUseEntity is the only serverbound channel in 1.8.9 by which the client tells the server it interacted with an entity. The wire form is a VarInt entityId, a VarInt enum action (INTERACT, ATTACK, INTERACT_AT) and, for INTERACT_AT only, three floats for the hit position on the target. Every attack, mount, item-frame edit and armor-stand manipulation goes through it. Because the packet carries no position, rotation or timestamp, the server validates it purely against its own copy of player and entity state, which is exactly what makes it trivial to spoof from a modified client.
Vanilla handling
NetHandlerPlayServer.processUseEntity resolves the target from the packet's entity id, then enforces a distance gate: squared distance must be under 36.0 (6 blocks) when the target is visible to the player, or 9.0 (3 blocks) when it is not. INTERACT routes to playerEntity.interactWith, INTERACT_AT to the per-vector entity handler, and ATTACK first kicks the player for targeting EntityItem, EntityXPOrb, EntityArrow or self ("Attempting to attack an invalid entity"), then calls attackTargetEntityWithCurrentItem. There is no rate limit and no attack-cooldown validation; the 1.8.9 swing cooldown is enforced only client-side in PlayerControllerMP and EntityPlayerSP.
Why clients touch it
All eight clients ship combat modules that live on this packet. Aura and KillAura variants send ATTACK in every client: Memeware and Nekoware split Single/Multi/Hypixel/Switch auras, Rise 5.99 and 6.x use Aura and KillAura, Sigma, Spicy and Tenacity each have Killaura modules. Criticals exists in Memeware, Nekoware, Rise 5.99, Sigma and Spicy, injecting C04 offset packets before the ATTACK. TPAura and TeleportAura in Memeware, Rise 5.99, Rise 6.x and Tenacity walk the server-side player to the target before attacking. ComboOneHit (Rise 5.99 and 6.x) floods ATTACK packets, and Spicy's TriggerBot and Wtap round out the combat surface. Freecam (Rise), Infinite (Rise 5.99), WorldGuardRegen, GodMode and AntiFireBall (Rise 6.x), PlayerHacks (Rise 5.99) and Sigma's AntiFreeze all filter or forge C02 as a secondary effect. The two new research clients extend the same surface. November Recode 2.0 ships KillAuraModule and WTapModule on its EventPacket bus: the aura queues C02 ATTACK directly when Keep Sprint is enabled and filters outgoing ATTACK packets in its WATCHDOG autoblock mode, and the wtap module reacts to outgoing attacks with sprint resets. LiquidSense Dev contributes the Hypixel movement family (HYTFly, HYTHighJump, HYTLongJump, HYTRun) which cancels and buffers C02 inside a blink window, plus the LiquidBounce Blink and Fly Zoom modes that hold C02 and release it with the rest of the buffer.
Exploit surface
The server trusts three things: the entity id, the distance, and the action. Attack rate is unbounded, so ComboOneHit's 50-1000 packet bursts are legal wire traffic. INTERACT_AT's hitVec is client-chosen and unvalidated, which is why Sigma and Spicy Killaura spam INTERACT_AT with random hitVecs plus INTERACT as a disabler sequence, and why Rise 5.99's BedwarsTP can mount entities from outside reach. Friend protection is purely a client courtesy: Rise 5.99's Aura consults its friends list, Sigma's Killaura checks FriendManager.isFriend, Tenacity's KillAuraModule checks FriendCommand.isFriend, but nothing server-side knows about friends, so a client that skips the check can hit anyone. Anti-cheats counter with reach math, attack-rate caps, rotation-motion correlation, and ghost-interact detection.
Server-Side Handling
processUseEntity runs on the main thread via PacketThreadUtil and calls markPlayerActive, which resets the idle-kick timer. The entity lookup uses packetIn.getEntityFromWorld(worldServerForDimension(player.dimension)). Distance is checked as squared distance: 36.0 when canEntityBeSeen passes, 9.0 otherwise, with no horizontal/vertical split and no per-axis clamp. For ATTACK the invalid-target kick fires before any damage is dealt. There is no vanilla per-tick attack limit: the swing cooldown and the 20-tick hit cooldown live in client-side code (PlayerControllerMP.attackEntity and EntityPlayer.attackEntityAsMob), so a forged client can emit arbitrarily many attacks per tick and the server will process them all.
Protocol Analysis
The action is serialized with readEnumValue/writeEnumValue, a VarInt ordinal (0=INTERACT, 1=ATTACK, 2=INTERACT_AT). INTERACT_AT adds three floats read after the enum; the other two actions carry no payload, so the packet length varies by action. The Entity-based constructors resolve the entity id at construction time (entity.getEntityId), so modules that queue C02 after the target dies or unloads send a stale id that the server resolves to null and silently ignores. The Vec3 constructor always selects INTERACT_AT. The packet is registered at 0x02 in the SERVERBOUND play state table.
Anti-Cheat Landscape
NCP flags reach by comparing the server-side player position against the target at ATTACK time and tracks hit rates per second; ComboOneHit-style floods are its primary target. Rotation-aware checks flag attacks whose preceding C05/C06 rotation does not point at the target, which is why Memeware-style auras that send ATTACK without a rotation packet get flagged on newer anti-cheats while rotation-injecting auras pass. The INTERACT_AT plus INTERACT disabler sequence (Sigma, Spicy) is detected by anti-cheats that count ghost interacts. TPAura is trivially caught by movement checks, because the unconfirmed C04 walk trips the vanilla 'moved too quickly' math when the path is skipped. Friend checks are invisible to the server and exist purely as client-side target filtering.
implementation Implementation Cases
The combat funnel of 1.8.9: a VarInt entity id and an action enum are all the server needs to apply damage. KillAura family targets and attacks, Criticals injects C04 fall arcs ahead of the ATTACK, TPAura teleports the server-side player to the target first, ComboOneHit floods the channel, and TriggerBot/Wtap automate the last bits of the attack loop. Friend protection exists only inside the aura target filters, never as a standalone module, across the 8 clients.
Select a target within reach and emit C02 ATTACK packets at a controlled rate, with optional autoblock around the attack.
Target selection from client-side entity lists (CombatUtil.getTarget in Memeware, PlayerUtil.getEntities in Rise), aim injected into the motion event so the outgoing C05/C06 carries the rotation, then ATTACK fired through the client's packet path. Memeware's SingleAura alternates C07 RELEASE_USE_ITEM and C08 placement at a fake BlockPos to block between attacks. Friend filtering happens inside target selection: Rise 5.99 checks its friends list, Sigma checks FriendManager.isFriend, Tenacity checks FriendCommand.isFriend.
// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/combat/aura/SingleAura.java =====
package me.memewaredevs.client.module.combat.aura;
import me.memewaredevs.client.event.events.UpdateEvent;
import me.memewaredevs.client.module.combat.Aura;
import me.memewaredevs.client.module.combat.AutoPotion;
import me.memewaredevs.client.util.combat.CombatUtil;
import me.memewaredevs.client.util.combat.RotationUtils;
import me.memewaredevs.client.util.misc.Timer;
import me.memewaredevs.client.util.packet.PacketUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
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;
public class SingleAura {
private static Timer timer = new Timer();
private static boolean block;
public static boolean unblock;
private static boolean unblocked;
public static void doUpdate(final Aura aura, final UpdateEvent e, final Minecraft mc) {
boolean invisible = aura.getBool("Invisibles");
double range = aura.getDouble("Range");
boolean players = aura.getBool("Players");
boolean monsters = aura.getBool("Monsters");
boolean teams = false;
final Entity entity = CombatUtil.getTarget(teams, monsters, players, range, invisible);
final boolean autoBlock = aura.getBool("Auto Block");
final long clickSpeed = aura.getDouble("Click Speed").longValue();
Aura.isBlocking = mc.thePlayer.getHeldItem() != null
&& mc.thePlayer.getHeldItem().getItem() instanceof ItemSword && autoBlock && CombatUtil.canBlock(
teams, false, true, range + 4.0, true);
BlockPos a = new BlockPos(-0.2223, -0.132, -0.312);
if (Aura.isBlocking) {
if (e.isPost() && block) {
PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(a, 255, mc.thePlayer.getHeldItem(), 0.0F, 0.0F, 0.0F));
unblock = true;
}
}
block = true;
if (AutoPotion.isPotting())
return;
Aura.currentEntity = (EntityLivingBase) entity;
if (entity != null) {
final float[] rots = RotationUtils.getRotations((EntityLivingBase) entity);
e.setYaw(rots[0]);
e.setPitch(rots[1]);
if (unblocked) {
mc.thePlayer.swingItem();
PacketUtil.sendPacket(new C02PacketUseEntity(entity, C02PacketUseEntity.Action.ATTACK));
unblocked = false;
}
if (timer.delay(1000L / clickSpeed) && e.isPre()) {
PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, a.offsetDown(), EnumFacing.UP));
unblocked = true;
block = false;
timer.reset();
}
}
}
}
// NOTE (AI): Memeware's SingleAura is the module-level attack core shared by the Aura module. It resolves the target through CombatUtil.getTarget, injects the aim into the UpdateEvent (e.setYaw/Pitch so the outgoing C05/C06 carries it), and fires the ATTACK via PacketUtil.sendPacket, which routes through the packet event bus so Criticals and other listeners see it. The autoblock half uses a fake BlockPos(-0.2223, -0.132, -0.312) for the C08 placement and a C07 RELEASE_USE_ITEM at a.offsetDown(): the server registers the use-item state change without any real block being touched, which is the standard 1.8.9 block-hack autoblock pattern. Note the swing is only sent when the previous release already went out (unblocked flag), keeping one attack per click-speed window.
Force every melee hit to register as a critical by injecting C04 position packets that recreate the falling-jump arc immediately before the ATTACK.
A PacketOutEvent handler waits for C02 with ACTION ATTACK, then queues C04 packets at y+0.1232225 (onGround false), y+1.0554E-9 (false) and y (true), rate-limited by a 320ms timer so the burst cannot fire twice inside one attack. The server applies fall-damage math to the reported arc, so the attack lands as a crit. Ground-spoof variants instead mutate the motion event's Y and ground flag with a decaying 0.001 offset so every movement packet looks like a fresh fall.
// ===== FILE: Memeware 7.3, me/memewaredevs/client/module/combat/Criticals.java =====
package me.memewaredevs.client.module.combat;
import me.hippo.api.lwjeb.annotation.Handler;
import me.memewaredevs.client.event.events.PacketOutEvent;
import me.memewaredevs.client.event.events.UpdateEvent;
import me.memewaredevs.client.module.Module;
import me.memewaredevs.client.util.misc.Timer;
import me.memewaredevs.client.util.packet.PacketUtil;
import net.minecraft.network.play.client.C02PacketUseEntity;
import net.minecraft.network.play.client.C03PacketPlayer;
import java.util.function.Consumer;
public class Criticals extends Module {
private Timer critTimer = new Timer();
private double groundSpoofDist = 0.001;
public Criticals() {
super("Criticals", 0, Module.Category.COMBAT);
addModes("Ground Spoof", "Packet", "Mineplex");
}
@Handler
public Consumer<PacketOutEvent> update = e -> {
if (mc.thePlayer == null) {
return;
}
if (isMode("Mineplex")) {
if (e.getPacket() instanceof C03PacketPlayer) {
C03PacketPlayer packet = (C03PacketPlayer) e.getPacket();
if (mc.thePlayer.isCollidedVertically && mc.thePlayer.ticksExisted % 2 == 0) {
packet.onGround = false;
if (e.getPacket() instanceof C03PacketPlayer.C04PacketPlayerPosition || e.getPacket() instanceof C03PacketPlayer.C06PacketPlayerPosLook) {
PacketUtil.sendPacketSilent(new C03PacketPlayer.C04PacketPlayerPosition(packet.x, packet.y + 1.02E-9, packet.z, false));
}
}
}
}
if (isMode("Cubecraft")) {
if (e.getPacket() instanceof C02PacketUseEntity) {
C02PacketUseEntity packet = (C02PacketUseEntity) e.getPacket();
if (packet.getAction() == C02PacketUseEntity.Action.ATTACK) {
if (critTimer.delay(320)) {
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(
mc.thePlayer.posX, mc.thePlayer.posY + 0.1232225, mc.thePlayer.posZ, false));
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(
mc.thePlayer.posX, mc.thePlayer.posY + 1.0554E-9, mc.thePlayer.posZ, false));
mc.thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer.C04PacketPlayerPosition(
mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, true));
critTimer.reset();
}
}
}
}
};
@Handler
public Consumer<UpdateEvent> eventConsumer = event -> {
if (groundSpoofDist < 0.0001) {
groundSpoofDist = 0.001;
}
if (isMode("GroundSpoof") && mc.thePlayer.isSwingInProgress && mc.thePlayer.isCollidedVertically) {
event.setY(event.getY() + groundSpoofDist);
event.setGround(false);
groundSpoofDist -= 1.0E-11;
}
};
@Override
public void onEnable() {
groundSpoofDist = 0.001;
}
@Override
public void onDisable() {
groundSpoofDist = 0.001;
}
}
// NOTE (AI): The Cubecraft branch is the interesting one for C02: it hooks PacketOutEvent, waits for an ATTACK action, then injects three C04PacketPlayerPosition packets (y+0.1232225 false, y+1.0554E-9 false, y true) with a 320ms cooldown, so the server's fall-distance state sees the classic critical-hit arc right before the attack lands. The declared mode list is Ground Spoof / Packet / Mineplex, so the Cubecraft branch is dead code, and the Mineplex branch mutates C03 onGround instead. GroundSpoof mode never touches C02: it edits the UpdateEvent Y and ground flag with a decaying 0.001 offset so every movement packet reports a fresh fall arc. This file is the canonical example of C02-triggered C04 injection shared by Memeware and Nekoware.
Attack entities far beyond reach by teleporting the server-side player to the target with a C04 path, attacking, and walking back.
On PreMotionEvent, pick a target up to 120 blocks away, compute a path with a pathfinder, replay it as C04 position packets via sendPacketWithoutEvent (bypassing the event bus), fire the C02 ATTACK, then reverse the path. Because a raw C02 send does not fire the client's AttackEvent, the module calls the event manually and only attacks if it is not cancelled. Multi mode walks a path per target. mc.timer.timerSpeed accelerates the whole cycle.
// ===== FILE: Rise 5.99, dev/rise/module/impl/combat/TPAura.java =====
package dev.rise.module.impl.combat;
import dev.rise.Rise;
import dev.rise.event.impl.motion.PreMotionEvent;
import dev.rise.event.impl.other.AttackEvent;
import dev.rise.event.impl.other.WorldChangedEvent;
import dev.rise.event.impl.render.Render3DEvent;
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.NoteSetting;
import dev.rise.setting.impl.NumberSetting;
import dev.rise.ui.clickgui.impl.ClickGUI;
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 dev.rise.util.player.PlayerUtil;
import dev.rise.util.render.RenderUtil;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.play.client.C02PacketUseEntity;
import net.minecraft.network.play.client.C03PacketPlayer;
import org.lwjgl.input.Mouse;
import java.awt.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
@Getter
@Setter
@ModuleInfo(name = "TPAura", description = "Attacks entities from far ranges by teleporting to them and back", category = Category.COMBAT)
public class TPAura extends Module {
private final NoteSetting generalSettings = new NoteSetting("General Settings", this);
private final ModeSetting mode = new ModeSetting("Mode", this, "Single", "Single", "Multi");
private final NumberSetting cps = new NumberSetting("CPS", this, 5, 1, 20, 1);
private final NumberSetting range = new NumberSetting("Range", this, 20, 4, 120, 1);
private final NumberSetting timerSpeed = new NumberSetting("Timer", this, 1, 0.1, 3, 0.1);
private final NumberSetting maxTargets = new NumberSetting("Max Targets", this, 25, 2, 50, 1);
private final NoteSetting targets = new NoteSetting("Target Settings", this);
private final BooleanSetting players = new BooleanSetting("Players", this, true);
private final BooleanSetting nonPlayers = new BooleanSetting("Non Players", this, true);
private final BooleanSetting ignoreTeammates = new BooleanSetting("Ignore Teammates", this, true);
private final BooleanSetting invisibles = new BooleanSetting("Invisibles", this, false);
private final BooleanSetting attackDead = new BooleanSetting("Attack Dead", this, false);
private final NoteSetting renderSettings = new NoteSetting("Render Settings", this);
private final BooleanSetting render = new BooleanSetting("Render", this, true);
private final NoteSetting other = new NoteSetting("Other Settings", this);
private final BooleanSetting disableOnWorldChange = new BooleanSetting("Disable On World Change", this, true);
private final BooleanSetting attackInInterfaces = new BooleanSetting("Attack in Interfaces", this, false);
private final BooleanSetting onClick = new BooleanSetting("On Click", this, false);
private ArrayList<Vec3> path;
private Entity target;
private final TimeUtil timer = new TimeUtil();
@Override
public void onWorldChanged(final WorldChangedEvent event) {
if (this.disableOnWorldChange.isEnabled()) {
this.registerNotification("Disabled " + this.getModuleInfo().name() + " due to world change.");
this.toggleModule();
}
}
@Override
public void onUpdateAlwaysInGui() {
maxTargets.hidden = !mode.is("Multi");
}
@Override
public void onPreMotion(final PreMotionEvent event) {
if ((mc.currentScreen != null && !(mc.currentScreen instanceof ClickGUI)) && !attackInInterfaces.isEnabled()) {
target = null;
path = null;
return;
}
if (!(!onClick.isEnabled() || Mouse.isButtonDown(0) && mc.currentScreen == null)) {
target = null;
path = null;
return;
}
/* Getting target */
if (!timer.hasReached((long) (((20 - cps.getValue()) * 50) - Math.random() * 100))) return;
timer.reset();
final List<EntityLivingBase> targets = PlayerUtil.getEntities(range.getValue(), players.isEnabled(), nonPlayers.isEnabled(), attackDead.isEnabled(), invisibles.isEnabled(), ignoreTeammates.isEnabled());
final int maxTargets = (int) Math.round(this.maxTargets.getValue());
if (mode.is("Multi") && targets.size() > maxTargets)
targets.subList(maxTargets, targets.size()).clear();
if (targets.isEmpty()) {
target = null;
return;
}
target = targets.get(0);
/* Setting useful variables */
final EntityPlayer player = mc.thePlayer;
final boolean freecamEnabled = Objects.requireNonNull(Rise.INSTANCE.getModuleManager().getModule("Freecam")).isEnabled();
double x = player.posX;
double y = player.posY;
double z = player.posZ;
if (freecamEnabled) {
x = Freecam.startX;
y = Freecam.startY;
z = Freecam.startZ;
}
final double targetX = target.posX;
final double targetY = target.posY;
final double targetZ = target.posZ;
mc.timer.timerSpeed = (float) timerSpeed.getValue();
/* Creating a new thread */
final double finalZ = z;
final double finalY = y;
final double finalX = x;
new Thread(() -> {
switch (mode.getMode()) {
case "Single": {
/* Getting path */
path = MainPathFinder.computePath(new Vec3(finalX, finalY, finalZ), new Vec3(targetX, targetY, targetZ));
for (final Vec3 vec : path)
PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), false));
mc.thePlayer.swingItem();
/*
* Calls attack event so other modules can use information from the entity
* When the C02 packet is sent the attack event does not
* get called, so we have to manually call it ourselves in here.
*/
final AttackEvent attackEvent = new AttackEvent(target);
attackEvent.call();
if (!attackEvent.isCancelled())
PacketUtil.sendPacketWithoutEvent(new C02PacketUseEntity(target, C02PacketUseEntity.Action.ATTACK));
Collections.reverse(path);
for (final Vec3 vec : path)
PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), false));
break;
}
case "Multi": {
for (final Entity entity : targets) {
/* Getting path */
path = MainPathFinder.computePath(new Vec3(finalX, finalY, finalZ), new Vec3(entity.posX, entity.posY, entity.posZ));
for (final Vec3 vec : path)
PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));
mc.thePlayer.swingItem();
/*
* Calls attack event so other modules can use information from the entity
* When the C02 packet is sent the attack event does not
* get called, so we have to manually call it ourselves in here.
*/
final AttackEvent attackEvent = new AttackEvent(entity);
attackEvent.call();
if (!attackEvent.isCancelled())
PacketUtil.sendPacketWithoutEvent(new C02PacketUseEntity(entity, C02PacketUseEntity.Action.ATTACK));
Collections.reverse(path);
for (final Vec3 vec : path)
PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(vec.getX(), vec.getY(), vec.getZ(), true));
}
break;
}
}
}).start();
}
@Override
protected void onDisable() {
mc.timer.timerSpeed = 1;
}
@Override
public void onRender3DEvent(final Render3DEvent event) {
/* Drawing path to target */
if (!render.isEnabled() || path == null || target == null) return;
Vec3 lastPoint = null;
final Color c = new Color(Rise.CLIENT_THEME_COLOR).brighter();
for (final Vec3 point : path) {
if (lastPoint != null) {
RenderUtil.draw3DLine(lastPoint.getX(), lastPoint.getY() + 0.01, lastPoint.getZ(), point.getX(), point.getY() + 0.01, point.getZ(), c.getRed(), c.getGreen(), c.getBlue(), 255, 1);
}
lastPoint = point;
}
}
}
// NOTE (AI): The core exploit: the server validates ATTACK purely by squared distance (36.0 visible, 9.0 not), so TPAura walks the server-side entity there with a pathfinder. Every leg of the walk uses PacketUtil.sendPacketWithoutEvent, which bypasses the event bus, so no other module reacts to the fake movement. Because a raw C02 send does not fire Rise's AttackEvent, the module manually calls new AttackEvent(target).call() so Criticals and other attack listeners still run, and only sends the C02 if the event is not cancelled. The reverse path returns the player, and mc.timer.timerSpeed amplifies the whole cycle. Single mode walks once per cps window; Multi mode walks a path per target up to maxTargets.
Kill in the Combo gamemode by sending dozens to thousands of ATTACK packets per swing.
onAttackEvent fires after a normal attack and loops (int)packets.getValue() times (50 default, 1000 max), each iteration sending C02 ATTACK via sendPacketWithoutEvent so the flood never re-triggers attack listeners. The server processes every packet as a valid hit because vanilla applies no per-tick attack cap.
// ===== FILE: Rise 5.99, dev/rise/module/impl/combat/ComboOneHit.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.combat;
import dev.rise.event.impl.other.AttackEvent;
import dev.rise.module.Module;
import dev.rise.module.api.ModuleInfo;
import dev.rise.module.enums.Category;
import dev.rise.setting.impl.NumberSetting;
import dev.rise.util.player.PacketUtil;
import net.minecraft.network.play.client.C02PacketUseEntity;
@ModuleInfo(name = "ComboOneHit", description = "Instantly kills people in the Combo gamemode", category = Category.COMBAT)
public final class ComboOneHit extends Module {
public final NumberSetting packets = new NumberSetting("Packets", this, 50, 1, 1000, 25);
@Override
public void onAttackEvent(final AttackEvent event) {
for (int i = 0; i < (int) packets.getValue(); i++) {
PacketUtil.sendPacketWithoutEvent(new C02PacketUseEntity(event.getTarget(), C02PacketUseEntity.Action.ATTACK));
}
}
}
// NOTE (AI): The entire module is a rate-abuse loop: one AttackEvent triggers 50 to 1000 identical ATTACK packets, each sent with sendPacketWithoutEvent so the flood itself does not re-trigger attack listeners. It only works because vanilla 1.8.9 servers apply no per-tick attack cap; any anti-cheat that counts hits-per-second kills it instantly. The Combo gamemode this targets has no such check. Rise 6.1.30 and 6.2.4 ship the same module with PacketUtil.send, the 6.x equivalent of sendPacketWithoutEvent.
Attack whatever the crosshair is on the instant the client raytrace hits an entity, and automate the W-tap sprint reset around attacks.
TriggerBot checks mc.objectMouseOver on every EventMotion; when the raytrace type is ENTITY and the APS timer elapsed, it swings and queues C02 ATTACK via addToSendQueue. Wtap hooks EventSendPacket, and on any outgoing ATTACK with food above 6 queues STOP_SPRINTING then START_SPRINTING (C0B) so the server-side sprint reset happens around every hit, recreating the manual W-tap that resets the attack cooldown in 1.8 combat.
// ===== FILE: Spicy, info/spicyclient/modules/combat/TriggerBot.java =====
package info.spicyclient.modules.combat;
import org.apache.commons.lang3.RandomUtils;
import org.lwjgl.input.Keyboard;
import info.spicyclient.chatCommands.Command;
import info.spicyclient.events.Event;
import info.spicyclient.events.listeners.EventGetBlockReach;
import info.spicyclient.events.listeners.EventMotion;
import info.spicyclient.events.listeners.EventPacket;
import info.spicyclient.events.listeners.EventSendPacket;
import info.spicyclient.events.listeners.EventUpdate;
import info.spicyclient.modules.Module;
import info.spicyclient.settings.NumberSetting;
import info.spicyclient.util.Timer;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C02PacketUseEntity;
import net.minecraft.network.play.client.C02PacketUseEntity.Action;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.MovingObjectPosition.MovingObjectType;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
import net.minecraft.network.play.client.C0BPacketEntityAction;
public class TriggerBot extends Module {
private NumberSetting aps = new NumberSetting("APS", 10, 0, 20, 1);
public TriggerBot() {
super("TriggerBot", Keyboard.KEY_NONE, Category.COMBAT);
resetSettings();
}
@Override
public void resetSettings() {
this.settings.clear();
this.addSettings(aps);
}
public void onEnable() {
}
public void onDisable() {
}
public Timer timer = new Timer();
public void onEvent(Event e) {
if (e instanceof EventMotion) {
if (mc.objectMouseOver.typeOfHit.equals(MovingObjectType.ENTITY) && timer.hasTimeElapsed((long) (1000/aps.getValue()), true)) {
mc.thePlayer.swingItem();
mc.thePlayer.sendQueue.addToSendQueue(new C02PacketUseEntity(mc.objectMouseOver.entityHit, Action.ATTACK));
/*
if (mc.thePlayer.getCurrentEquippedItem() == null) {
return;
}
mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.getCurrentEquippedItem()));
*/
}
}
}
}
// NOTE (AI): TriggerBot is the minimal C02 user: no rotation injection, no packet events. On every EventMotion it checks the client raytrace (mc.objectMouseOver) for an entity hit and an APS timer, then swings and queues ATTACK via addToSendQueue, which goes through the normal send path and the vanilla attack animation. The commented-out C08 block placement shows the intended autoblock extension that was never enabled. Spicy's Wtap module complements it on the same packet: on EventSendPacket it watches for ATTACK and, when food is above 6, queues STOP_SPRINTING then START_SPRINTING (C0B) around the attack to fake a W-tap reset server-side.
November Recode's aura: emit C02 ATTACK through the send queue when Keep Sprint is on, or through the vanilla attackEntity path otherwise, and filter outgoing ATTACK packets while the Watchdog autoblock sequence is armed.
On EventWalkingUpdate PRE, once the CPS timer elapses, the module swings and either queues C02 ATTACK directly (keepSprint setting) or calls playerController.attackEntity so the vanilla path emits the packet. The EventPacket.Out listener then inspects every outgoing C02: under the WATCHDOG autoblock mode an ATTACK aimed at a living target whose hurtTime is above 2 is cancelled, because the autoblock sequence is still replaying the block state. The same listener also filters outgoing C07 RELEASE_USE_ITEM releases during VANILLA and WATCHDOG autoblock. Rotation is spoofed through the rotation pipeline with HIGH priority 5 ticks before the attack.
// ===== 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 aura: target selection from the loaded entity list (armor stands and anti-bot ids excluded), rotation spoofing, six autoblock modes, and the packet filter half. Keep Sprint off routes through playerController.attackEntity, which emits C02 through the vanilla path; Keep Sprint on queues the packet directly. The WATCHDOG mode's hurtTime window is the interesting part: outgoing ATTACKs are cancelled while the target's hurtTime is above 2 so the autoblock re-arm is never raced by a hit.Hypixel movement bypasses that cancel outgoing C02 ATTACK packets (together with C04, C06, C0A, C0B and C08) during their flight window, buffer them, and replay them when the window closes.
Each module runs a doAsFly/stage state machine: while active, the PacketEvent handler cancels every C03 variant plus C02, C0A, C0B and C08 and appends them to a list; a stage counter counts the buffered packets, and once the threshold is reached the list is flushed back through addToSendQueue. HYTFly flushes when stage reaches 1, HYTHighJump, HYTLongJump and HYTRun flush on ground contact or disable. The C02 cancel means an attack sent during the flight window is held until the movement stream resumes.
// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/movement/HYTFly.java =====
package me.AquaVit.liquidSense.modules.movement;
import net.ccbluex.liquidbounce.Gui.Notifications.Notificationsn;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.PacketEvent;
import net.ccbluex.liquidbounce.event.UpdateEvent;
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.Velocity;
import net.ccbluex.liquidbounce.features.module.modules.render.HUD;
import net.ccbluex.liquidbounce.utils.ChatUtil;
import net.ccbluex.liquidbounce.value.FloatValue;
import net.ccbluex.liquidbounce.value.IntegerValue;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.*;
import java.util.ArrayList;
import java.util.List;
import static net.ccbluex.liquidbounce.utils.MovementUtils.isMoving;
import static net.ccbluex.liquidbounce.utils.MovementUtils.strafe;
@ModuleInfo(name = "HYTFly", description = "Hyt Fly Bypass:/", category = ModuleCategory.MOVEMENT)
public class HYTFly extends Module {
private List<Packet<?>> packets = new ArrayList<>();
boolean doAsFly = false;
double stage = 0;
double timer = 0;
double y = 0;
boolean jump = false;
private final FloatValue motionXZ = new FloatValue("MotionXZ", 2.5f, 0f, 10f);
private final FloatValue motionY = new FloatValue("MotionY", 1.8f, 0.42f, 6f);
private final FloatValue Bob = new FloatValue("Bob",0.5f,0f,2f);
private final IntegerValue delay = new IntegerValue("Delay", 2, 0, 10);
private final IntegerValue BindSlowSpeed = new IntegerValue("BindSlowSpeed", 7, 1, 10);
private final FloatValue DownY = new FloatValue("DownY", 1.25f, 0.42f, 2f);
private final FloatValue NormalDownY = new FloatValue("NormalDownY", 0.05f, 0.01f, 2f);
Velocity vl = (Velocity)LiquidBounce.moduleManager.getModule(Velocity.class);
HUD hd = (HUD)LiquidBounce.moduleManager.getModule("HUD");
public void move() {
mc.thePlayer.cameraYaw = Bob.get();
if (mc.thePlayer.posY <= y && !mc.gameSettings.keyBindSneak.isKeyDown()) {
mc.thePlayer.motionY = motionY.get();
} else {
if(mc.gameSettings.keyBindForward.isKeyDown()){
double dir = mc.thePlayer.rotationYaw / 180 * Math.PI;
if (mc.thePlayer.motionY < 0 && !mc.gameSettings.keyBindSneak.isKeyDown()) mc.thePlayer.motionY = 0 - NormalDownY.get();
if (mc.thePlayer.motionY < 0 && mc.gameSettings.keyBindSneak.isKeyDown()) mc.thePlayer.motionY = 0 - DownY.get();
mc.thePlayer.motionX = -Math.sin(dir) * motionXZ.get();
mc.thePlayer.motionZ = Math.cos(dir) * motionXZ.get();
}else{
if (mc.thePlayer.motionY < 0 && !mc.gameSettings.keyBindSneak.isKeyDown()) mc.thePlayer.motionY = 0 - NormalDownY.get();
if (mc.thePlayer.motionY < 0 && mc.gameSettings.keyBindSneak.isKeyDown()) mc.thePlayer.motionY = 0 - DownY.get();
}
}
}
@Override
public void onEnable() {
y = mc.thePlayer.posY;
timer = 999;
packets.clear();
LiquidBounce.moduleManager.getModule("Velocity").setState(false);
if(hd.no.get()) {
ChatUtil.sendClientMessage("Debug Disable Velocity", Notificationsn.Type.INFO);
}
}
@Override
public void onDisable() {
mc.timer.timerSpeed = 1f;
doAsFly = false;
packets.clear();
}
@EventTarget
public void onUpdate(UpdateEvent event) {
if (!doAsFly) timer++;
if (timer > delay.get()) {
timer = 0;
doAsFly = true;
stage = 0;
move();
}
if (mc.gameSettings.keyBindJump.isKeyDown()) {
mc.timer.timerSpeed = (BindSlowSpeed.get() / 10);
}else{
mc.timer.timerSpeed = 1f;
}
if (stage >= 1) {
doAsFly = false;
if (packets.size() > 0) {
for (Packet<?> packet : packets) {
mc.thePlayer.sendQueue.addToSendQueue(packet);
packets.remove(packet);
}
}
}
}
@EventTarget
public void onPacket(PacketEvent event) {
if (!doAsFly) return;
final Packet<?> packet = event.getPacket();
if (packet instanceof C03PacketPlayer) event.cancelEvent();
if (packet instanceof C03PacketPlayer.C04PacketPlayerPosition|| packet instanceof C02PacketUseEntity || packet instanceof C0APacketAnimation || packet instanceof C0BPacketEntityAction || packet instanceof C03PacketPlayer.C06PacketPlayerPosLook || packet instanceof C08PacketPlayerBlockPlacement) {
event.cancelEvent();
packets.add(packet);
stage++;
}
}
}
// NOTE (AI): The HYTFly bypass in full: a timer gates the doAsFly window, motion is driven by direct motionX/motionY/motionZ writes plus timerSpeed, and the packet handler cancels every C03 variant plus C02, C0A, C0B and C08 while the window is open, buffering them for replay at stage 1. The C02 in the cancel list is the corpus hit: an attack during the flight phase is parked with the movement packets and replayed in order when the window closes.Suspend all movement and interaction packets including C02 while blinking, then release them in order on disable or on the pulse timer.
The PacketEvent handler cancels C03, C04, C06, C08, C0A, C0B and C02 and pushes them onto a LinkedBlockingQueue; onDisable or the pulse timer drains the queue through NetworkManager.sendPacket. A fake player (entity id -1337) keeps the client-side world consistent while the real position is frozen. The LiquidBounce Fly module's Zoom mode extends this: when blinkAttack is on and the buffered list is at least blinkAttackPacket long, a C02 in the stream triggers an early flush of the whole list plus a C13 ability declaration.
// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/player/Blink.java =====
/*
* LiquidBounce Hacked Client
* A free open source mixin-based injection hacked client for Minecraft using Minecraft Forge.
* https://github.com/CCBlueX/LiquidBounce/
*/
package net.ccbluex.liquidbounce.features.module.modules.player;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.PacketEvent;
import net.ccbluex.liquidbounce.event.Render3DEvent;
import net.ccbluex.liquidbounce.event.UpdateEvent;
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.render.Breadcrumbs;
import net.ccbluex.liquidbounce.utils.render.ColorUtils;
import net.ccbluex.liquidbounce.utils.render.RenderUtils;
import net.ccbluex.liquidbounce.utils.timer.MSTimer;
import net.ccbluex.liquidbounce.value.BoolValue;
import net.ccbluex.liquidbounce.value.IntegerValue;
import net.minecraft.client.entity.EntityOtherPlayerMP;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.*;
import java.awt.*;
import java.util.LinkedList;
import java.util.concurrent.LinkedBlockingQueue;
import static org.lwjgl.opengl.GL11.*;
@ModuleInfo(name = "Blink", description = "Suspends all movement packets.", category = ModuleCategory.PLAYER)
public class Blink extends Module {
private final LinkedBlockingQueue<Packet> packets = new LinkedBlockingQueue<>();
private EntityOtherPlayerMP fakePlayer = null;
private boolean disableLogger;
private final LinkedList<double[]> positions = new LinkedList<>();
private final BoolValue pulseValue = new BoolValue("Pulse", true);
private final IntegerValue pulseDelayValue = new IntegerValue("PulseDelay", 1000, 500, 5000);
private final MSTimer pulseTimer = new MSTimer();
public IntegerValue getValue() {
return pulseDelayValue;
}
@Override
public void onEnable() {
if(mc.thePlayer == null)
return;
if (!pulseValue.get()) {
fakePlayer = new EntityOtherPlayerMP(mc.theWorld, mc.thePlayer.getGameProfile());
fakePlayer.clonePlayer(mc.thePlayer, true);
fakePlayer.copyLocationAndAnglesFrom(mc.thePlayer);
fakePlayer.rotationYawHead = mc.thePlayer.rotationYawHead;
mc.theWorld.addEntityToWorld(-1337, fakePlayer);
}
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});
}
pulseTimer.reset();
}
@Override
public void onDisable() {
if(mc.thePlayer == null)
return;
blink();
if (fakePlayer != null) {
mc.theWorld.removeEntityFromWorld(fakePlayer.getEntityId());
fakePlayer = null;
}
}
@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(pulseValue.get() && pulseTimer.hasTimePassed(pulseDelayValue.get())) {
blink();
pulseTimer.reset();
}
}
@EventTarget
public void onRender3D(Render3DEvent event) {
final Breadcrumbs breadcrumbs = (Breadcrumbs) LiquidBounce.moduleManager.getModule(Breadcrumbs.class);
final Color color = breadcrumbs.colorRainbow.get() ? ColorUtils.rainbow() : new Color(breadcrumbs.colorRedValue.get(), breadcrumbs.colorGreenValue.get(), breadcrumbs.colorBlueValue.get());
synchronized(positions) {
glPushMatrix();
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_LINE_SMOOTH);
glEnable(GL_BLEND);
glDisable(GL_DEPTH_TEST);
mc.entityRenderer.disableLightmap();
glBegin(GL_LINE_STRIP);
RenderUtils.glColor(color);
final double renderPosX = mc.getRenderManager().viewerPosX;
final double renderPosY = mc.getRenderManager().viewerPosY;
final double renderPosZ = mc.getRenderManager().viewerPosZ;
for(final double[] pos : positions)
glVertex3d(pos[0] - renderPosX, pos[1] - renderPosY, pos[2] - renderPosZ);
glColor4d(1, 1, 1, 1);
glEnd();
glEnable(GL_DEPTH_TEST);
glDisable(GL_LINE_SMOOTH);
glDisable(GL_BLEND);
glEnable(GL_TEXTURE_2D);
glPopMatrix();
}
}
@Override
public String getTag() {
return String.valueOf(packets.size());
}
private void blink() {
try {
disableLogger = true;
while (!packets.isEmpty()) {
mc.getNetHandler().getNetworkManager().sendPacket(packets.take());
}
disableLogger = false;
}catch(final Exception e) {
e.printStackTrace();
disableLogger = false;
}
synchronized(positions) {
positions.clear();
}
}
}
// NOTE (AI): The LiquidBounce Blink module in full: C02 is held with the movement and use packets while blinking, the fake player mirrors the real position, and the pulse mode releases the whole queue on a timer. The Fly Zoom mode companion sends a C13 with allowFlying and isFlying true and flushes the buffered list early when blinkAttack is enabled and the queue is long enough, which turns the release into a delayed attack.anticheat Anti-Cheat Checks
Server-side combat anticheats see the use-entity packet as the attack trigger. The 50-cloned-anticheat corpus splits into two families: modern simulation checks (Grim Reach, Kauri Hitbox, Artemis Reach2) that rebuild the client's view of the world and measure the exact attack vector, and classic statistical checks (Frequency KillAura, NCP fight.reach, AutoEye Reach) that score the attack angle, hitbox distance, and packet rhythm. The use-entity packet carries the entity id and action, so every killaura and reach check in the corpus keys off it.
The reference modern reach check: verifies the attack vector against a simulated copy of the client's world state.
Listens to the ATTACK packet (WrapperPlayClientAttack) and the INTERACT_ENTITY packet, then computes the distance from the player's interpolated eye position to the entity's exact collision box. Attack range is taken from the held item's attack range attribute, and the threshold is 3.0 + reach attribute with buffer. It cancels impossible hits outright and runs a cancel buffer for 4 hits after a flagged reach attack.
// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/combat/Reach.java =====
// This file was designed and is an original check for GrimAC
// Copyright (C) 2021 DefineOutside
//
// 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 ac.grim.grimac.checks.impl.combat;
import ac.grim.grimac.api.config.ConfigManager;
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.type.PacketReceiveListener;
import ac.grim.grimac.player.GrimPlayer;
import ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox;
import ac.grim.grimac.utils.data.packetentity.PacketEntity;
import ac.grim.grimac.utils.data.packetentity.PacketEntitySizeable;
import ac.grim.grimac.utils.data.packetentity.dragon.PacketEntityEnderDragonPart;
import ac.grim.grimac.utils.math.Vector3dm;
import ac.grim.grimac.utils.nmsutil.ReachUtils;
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.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.attribute.Attributes;
import com.github.retrooper.packetevents.protocol.component.ComponentTypes;
import com.github.retrooper.packetevents.protocol.component.builtin.item.ItemAttackRange;
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
import com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;
import com.github.retrooper.packetevents.protocol.item.ItemStack;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.protocol.player.GameMode;
import com.github.retrooper.packetevents.protocol.player.InteractionHand;
import com.github.retrooper.packetevents.util.Vector3d;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientAttack;
import com.github.retrooper.packetevents.wrapper.play.client.WrapperPlayClientInteractEntity;
import com.viaversion.viaversion.api.Via;
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
// You may not copy the check unless you are licensed under GPL
@CheckData(name = "Reach", stableKey = "grim.combat.reach", description = "Attacked an entity from too far away")
public class Reach extends Check implements PacketReceiveListener {
private static final Verbose V = Verbose.of("{f64:%.5f} blocks, type={entity}");
private static final List<EntityType> blacklisted = Arrays.asList(
EntityTypes.BOAT,
EntityTypes.CHEST_BOAT,
EntityTypes.SHULKER);
private static final CheckResult NONE = new CheckResult(ResultType.NONE, 0, 0, false);
// Only one flag per reach attack, per entity, per tick.
// We store position because lastX isn't reliable on teleports.
private final Int2ObjectMap<InteractionData> playerAttackQueue = new Int2ObjectOpenHashMap<>();
private boolean cancelImpossibleHits;
private double threshold;
private double cancelBuffer; // For the next 4 hits after using reach, we aggressively cancel reach
public Reach(GrimPlayer player) {
super(player);
}
@Override
public void onPacketReceive(final PacketReceiveEvent event) {
if (!player.disableGrim && event.getPacketType() == PacketType.Play.Client.ATTACK) {
WrapperPlayClientAttack packet = new WrapperPlayClientAttack(event);
onInteract(event, packet.getEntityId(), InteractionHand.MAIN_HAND);
}
if (!player.disableGrim && event.getPacketType() == PacketType.Play.Client.INTERACT_ENTITY) {
WrapperPlayClientInteractEntity packet = new WrapperPlayClientInteractEntity(event);
onInteract(event, packet.getEntityId(), packet.getAction() == WrapperPlayClientInteractEntity.InteractAction.ATTACK ? InteractionHand.MAIN_HAND : packet.getHand());
}
// If the player set their look, or we know they have a new tick
if (isUpdate(event.getPacketType())) {
tickBetterReachCheckWithAngle();
}
}
private void onInteract(PacketReceiveEvent event, int entityId, InteractionHand hand) {
// Don't let the player teleport to bypass reach
if (player.getSetbackTeleportUtil().shouldBlockMovement()) {
event.setCancelled(true);
player.onPacketCancel();
return;
}
PacketEntity entity = player.compensatedEntities.entityMap.get(entityId);
// Stop people from freezing transactions before an entity spawns to bypass reach
// TODO: implement dragon parts?
if (entity == null || entity instanceof PacketEntityEnderDragonPart) {
// Only cancel if and only if we are tracking this entity
// This is because we don't track paintings.
if (shouldModifyPackets() && player.compensatedEntities.serverPositionsMap.containsKey(entityId)) {
event.setCancelled(true);
player.onPacketCancel();
}
return;
}
// Dead entities cause false flags (https://github.com/GrimAnticheat/Grim/issues/546)
if (entity.isDead) return;
// TODO: Remove when in front of via
if (entity.getType() == EntityTypes.ARMOR_STAND && player.getClientVersion().isOlderThan(ClientVersion.V_1_8))
return;
// Prevents Happy Ghast Reach false on 1.21.6+ servers with ViaBackwards set up
if (entity.getType() == EntityTypes.HAPPY_GHAST && player.getClientVersion().isOlderThan(ClientVersion.V_1_21_6))
return;
if (player.gamemode == GameMode.CREATIVE || player.gamemode == GameMode.SPECTATOR)
return;
if (player.inVehicle()) return;
if (entity.riding != null) return;
ItemStack currentStack = player.inventory.getItemInHand(hand);
ItemStack startStack = player.inventory.getStartOfTickStack();
boolean hasRange = false;
float maxReach = 0f;
float hitboxMargin = 0f;
Vector3dm attackRangeMovement = null;
boolean clientAttackRangeExists = player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_21_11);
boolean clientAndServerAgrees = clientAttackRangeExists && ATTACK_RANGE_COMPONENT_EXISTS;
boolean viaVersionAvailable = false;
if (USE_1_8_HITBOX_MARGIN && ViaVersionUtil.isAvailable) {
viaVersionAvailable = Via.getConfig().getValues().containsKey("use-1_8-hitbox-margin") && Via.getConfig().use1_8HitboxMargin();
}
boolean clientAndViaVersion = clientAttackRangeExists && viaVersionAvailable;
if (clientAndServerAgrees || clientAndViaVersion) {
ItemAttackRange startRange = startStack.getComponentOr(ComponentTypes.ATTACK_RANGE, null);
ItemAttackRange currentRange = currentStack.getComponentOr(ComponentTypes.ATTACK_RANGE, null);
if (clientAndViaVersion) {
if (startStack != ItemStack.EMPTY) {
startRange = new ItemAttackRange(0F, 3F, 0F, 4F, 0.1F, 1F);
}
if (currentStack != ItemStack.EMPTY) {
currentRange = new ItemAttackRange(0F, 3F, 0F, 4F, 0.1F, 1F);
}
}
// If the start stack has no range component, the client defaults to vanilla reach behavior,
// regardless of what the current stack is (No Range -> X = No Range used).
if (startRange != null) {
hasRange = true;
if (currentRange == null) {
// Range (Start) -> No Range (Current)
// Client logic uses Start Range, including the attack_range movement projection.
if (!clientAndViaVersion) {
attackRangeMovement = player.clientVelocity.clone();
}
maxReach = startRange.getMaxRange();
hitboxMargin = startRange.getHitboxMargin();
} else {
// Range (Start) -> Range (Current)
// Client logic requires satisfying BOTH constraints
maxReach = Math.min(startRange.getMaxRange(), currentRange.getMaxRange());
hitboxMargin = Math.min(startRange.getHitboxMargin(), currentRange.getHitboxMargin());
}
}
}
boolean tooManyAttacks = playerAttackQueue.size() > 10;
if (!tooManyAttacks) {
playerAttackQueue.put(entityId, new InteractionData(
player.x, player.y, player.z,
hasRange, maxReach, hitboxMargin, attackRangeMovement
)); // Queue for next tick for very precise check
}
boolean knownInvalid = attackRangeMovement == null && isKnownInvalid(entity, hasRange, maxReach, hitboxMargin);
if ((shouldModifyPackets() && cancelImpossibleHits && knownInvalid) || tooManyAttacks) {
event.setCancelled(true);
player.onPacketCancel();
}
}
// This method finds the most optimal point at which the user should be aiming at
// and then measures the distance between the player's eyes and this target point
//
// It will not cancel every invalid attack but should cancel 3.05+ or so in real-time
// Let the post look check measure the distance, as it will always return equal or higher
// than this method. If this method flags, the other method WILL flag.
//
// Meaning that the other check should be the only one that flags.
private boolean isKnownInvalid(PacketEntity reachEntity, boolean hasAttackRange, float itemMaxReach, float itemHitboxMargin) {
// If the entity doesn't exist, or if it is exempt, or if it is dead
if ((blacklisted.contains(reachEntity.getType()) || !reachEntity.isLivingEntity) && reachEntity.getType() != EntityTypes.END_CRYSTAL)
return false; // exempt
if (player.gamemode == GameMode.CREATIVE || player.gamemode == GameMode.SPECTATOR)
return false;
if (player.inVehicle()) return false;
// Filter out what we assume to be cheats
if (cancelBuffer != 0) {
CheckResult result = checkReach(reachEntity, player.x, player.y, player.z, hasAttackRange, itemMaxReach, itemHitboxMargin, null, true);
return result.isFlag();
} else {
SimpleCollisionBox targetBox = getTargetBox(reachEntity);
double maxReach = applyReachModifiers(targetBox, hasAttackRange, itemMaxReach, itemHitboxMargin, !player.packetStateData.didLastMovementIncludePosition);
return ReachUtils.getMinReachToBox(player, targetBox) > maxReach;
}
}
private void tickBetterReachCheckWithAngle() {
for (Int2ObjectMap.Entry<InteractionData> attack : playerAttackQueue.int2ObjectEntrySet()) {
PacketEntity reachEntity = player.compensatedEntities.entityMap.get(attack.getIntKey());
if (reachEntity == null) continue;
InteractionData interactionData = attack.getValue();
CheckResult result = checkReach(reachEntity, interactionData.x, interactionData.y, interactionData.z, interactionData.hasAttackRange, interactionData.maxReach, interactionData.hitboxMargin, interactionData.attackRangeMovement, false);
switch (result.type()) {
case REACH -> flag(
V.write(verbose()).f64(result.minDistance()).uint(reachEntity.getType().getId(player.getClientVersion())),
() -> {
String added = ", type=" + reachEntity.getType().getName().getKey();
if (reachEntity instanceof PacketEntitySizeable sizeable) {
added += ", size=" + sizeable.size;
}
return result.verbose() + added;
});
case HITBOX -> {
String added = "type=" + reachEntity.getType().getName().getKey();
if (reachEntity instanceof PacketEntitySizeable sizeable) {
added += ", size=" + sizeable.size;
}
player.checkManager.getCheck(Hitboxes.class).flag(result.verbose() + added);
}
}
}
playerAttackQueue.clear();
}
@NotNull
private CheckResult checkReach(PacketEntity reachEntity, double x, double y, double z, boolean hasAttackRange, float itemMaxReach, float itemHitboxMargin, Vector3dm attackRangeMovement, boolean isPrediction) {
SimpleCollisionBox targetBox = getTargetBox(reachEntity);
double movementAllowance = attackRangeMovement == null ? 0 : getAttackRangeMovementAllowance(attackRangeMovement);
double maxReach = applyReachModifiers(targetBox, hasAttackRange, itemMaxReach, itemHitboxMargin, !player.packetStateData.didLastLastMovementIncludePosition) + movementAllowance;
double minDistance = Double.MAX_VALUE;
// https://bugs.mojang.com/browse/MC-67665
List<Vector3dm> possibleLookDirs = new ArrayList<>(Collections.singletonList(ReachUtils.getLook(player, player.yaw, player.pitch)));
// If we are a tick behind, we don't know their next look so don't bother doing this
if (!isPrediction) {
// 1.7 players do not have any of these issues! They are always on the latest look vector
if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_8)) {
possibleLookDirs.add(ReachUtils.getLook(player, player.lastYaw, player.pitch));
// 1.9+ players could be a tick behind because we don't get skipped ticks
if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)) {
possibleLookDirs.add(ReachUtils.getLook(player, player.lastYaw, player.lastPitch));
}
}
}
// +3 would be 3 + 3 = 6, which is the pre-1.20.5 behaviour, preventing "Missed Hitbox"
final double distance = maxReach + 3;
final double[] possibleEyeHeights = player.getPossibleEyeHeights();
for (Vector3dm lookVec : possibleLookDirs) {
lookVec.multiply(distance);
for (double eye : possibleEyeHeights) {
final Vector3d eyePos = new Vector3d(x, y + eye, z);
Vector3d endReachPos = eyePos.add(lookVec.getX(), lookVec.getY(), lookVec.getZ());
Vector3d intercept = ReachUtils.calculateIntercept(targetBox, eyePos, endReachPos).first();
if (ReachUtils.isVecInside(targetBox, eyePos)) {
minDistance = 0;
break;
}
if (intercept != null) {
minDistance = Math.min(eyePos.distance(intercept), minDistance);
}
}
}
// if the entity is not exempt and the entity is alive
if ((!blacklisted.contains(reachEntity.getType()) && reachEntity.isLivingEntity) || reachEntity.getType() == EntityTypes.END_CRYSTAL) {
if (minDistance == Double.MAX_VALUE) {
cancelBuffer = 1;
return new CheckResult(ResultType.HITBOX, 0, 0, false);
} else if (minDistance > maxReach) {
cancelBuffer = 1;
return new CheckResult(ResultType.REACH, minDistance, movementAllowance, attackRangeMovement != null);
} else {
cancelBuffer = Math.max(0, cancelBuffer - 0.25);
}
}
return NONE;
}
private SimpleCollisionBox getTargetBox(PacketEntity reachEntity) {
if (reachEntity.getType() == EntityTypes.END_CRYSTAL) { // Hardcode end crystal box
return new SimpleCollisionBox(reachEntity.trackedServerPosition.getPos().subtract(1, 0, 1), reachEntity.trackedServerPosition.getPos().add(1, 2, 1));
}
return reachEntity.getPossibleCollisionBoxes();
}
private double getAttackRangeMovementAllowance(Vector3dm attackRangeMovement) {
if (attackRangeMovement.lengthSquared() == 0) {
return 0;
}
return getForwardMovement(attackRangeMovement, player.yaw, player.pitch);
}
private double getForwardMovement(Vector3dm movement, float yaw, float pitch) {
return Math.max(0, movement.dot(ReachUtils.getLook(player, yaw, pitch)));
}
private static final boolean ATTACK_RANGE_COMPONENT_EXISTS = PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_21_11);
private static final boolean USE_1_8_HITBOX_MARGIN = PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_8_8);
private double applyReachModifiers(SimpleCollisionBox targetBox, boolean hasAttackRange, float itemMaxReach, float itemHitboxMargin, boolean giveMovementThreshold) {
double maxReach;
double hitboxMargin = threshold;
if (hasAttackRange) {
maxReach = itemMaxReach;
hitboxMargin += itemHitboxMargin;
} else {
maxReach = player.compensatedEntities.self.getAttributeValue(Attributes.ENTITY_INTERACTION_RANGE);
// 1.7 and 1.8 players get a bit of extra hitbox (this is why you should use 1.8 on cross version servers)
// Yes, this is vanilla and not uncertainty. All reach checks have this or they are wrong.
if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9)) {
hitboxMargin += 0.1f;
}
}
// This is better than adding to the reach, as 0.03 can cause a player to miss their target
// Adds some more than 0.03 uncertainty in some cases, but a good trade off for simplicity
//
// Just give the uncertainty on 1.9+ clients as we have no way of knowing whether they had 0.03 movement
// However, on 1.21.2+ we do know if they had 0.03 movement
if (giveMovementThreshold || player.canSkipTicks()) {
hitboxMargin += player.getMovementThreshold();
}
targetBox.expand(hitboxMargin);
return maxReach;
}
@Override
public void onReload(@NotNull ConfigManager config) {
this.cancelImpossibleHits = config.getBooleanElse("Reach.block-impossible-hits", true);
this.threshold = config.getDoubleElse("Reach.threshold", 0.0005);
}
private enum ResultType {
REACH, HITBOX, NONE
}
private record CheckResult(ResultType type, double minDistance, double extraMovement, boolean hasExtraMovement) {
public boolean isFlag() {
return type != ResultType.NONE;
}
public String verbose() {
if (type != ResultType.REACH) {
return "";
}
String verbose = String.format("%.5f", minDistance) + " blocks";
if (hasExtraMovement) {
verbose += String.format(", extraMovement=%.5f", extraMovement);
}
return verbose;
}
}
private record InteractionData(double x, double y, double z, boolean hasAttackRange,
float maxReach, float hitboxMargin, Vector3dm attackRangeMovement) {}
}Classic 1.8 ProtocolLib adapter that forwards the use-entity packet into the fight checks.
Wraps the NMS packet through ProtocolLib (with legacy reflection fallback for the action enum on 1.7 servers), builds a UseEntityData wrapper, and dispatches it to the fight reach, angle, direction, noswing and attackfrequency checks. The reach check measures the distance from the player's eye to the entity at attack time against the 3.0 block baseline plus the entity's hitbox radius.
// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCompatProtocolLib/src/main/java/fr/neatmonster/nocheatplus/checks/net/protocollib/UseEntityAdapter.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.net.protocollib;
import java.lang.reflect.Method;
import java.util.Arrays;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import com.comphenix.protocol.PacketType;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.reflect.StructureModifier;
import com.comphenix.protocol.wrappers.EnumWrappers.EntityUseAction;
import com.comphenix.protocol.wrappers.WrappedEnumEntityUseAction;
import fr.neatmonster.nocheatplus.NCPAPIProvider;
import fr.neatmonster.nocheatplus.checks.CheckType;
import fr.neatmonster.nocheatplus.checks.net.AttackFrequency;
import fr.neatmonster.nocheatplus.checks.net.NetConfig;
import fr.neatmonster.nocheatplus.checks.net.NetData;
import fr.neatmonster.nocheatplus.compat.versions.ServerVersion;
import fr.neatmonster.nocheatplus.logging.StaticLog;
import fr.neatmonster.nocheatplus.players.DataManager;
import fr.neatmonster.nocheatplus.players.IPlayerData;
import fr.neatmonster.nocheatplus.utilities.ReflectionUtil;
/**
* Adapter for the UseEntity NMS packet
*/
public class UseEntityAdapter extends BaseAdapter {
private static final boolean isServerAtLeast1_13 = ServerVersion.isAtLeast("1.13");
private static class LegacyReflectionSet {
/** Hacks. */
final Class<?> packetClass_legacy;
final Class<?> enumClassAction_legacy;
final Method methodGetAction_legacy;
final Method methodName_legacy;
/**
*
* @param versionDetail
* @throws RuntimeException
* if not matching/supported.
*/
private LegacyReflectionSet(String versionDetail) {
Class<?> packetClass = ReflectionUtil.getClass("net.minecraft.server." + versionDetail + ".PacketPlayInUseEntity");
Class<?> actionClass = ReflectionUtil.getClass("net.minecraft.server." + versionDetail + ".EnumEntityUseAction");
Method methodGetAction = (packetClass == null || actionClass == null) ? null : ReflectionUtil.getMethodNoArgs(packetClass, "c", actionClass);
if (packetClass == null || actionClass == null || methodGetAction == null) {
this.packetClass_legacy = null;
this.enumClassAction_legacy = null;
this.methodGetAction_legacy = null;
this.methodName_legacy = null;
}
else {
this.packetClass_legacy = packetClass;
this.enumClassAction_legacy = actionClass;
this.methodGetAction_legacy = methodGetAction;
this.methodName_legacy = ReflectionUtil.getMethodNoArgs(enumClassAction_legacy, "name", String.class);
}
if (this.methodName_legacy == null) {
throw new RuntimeException("Not supported.");
}
}
String getActionFromNMSPacket(Object handle) {
final Class<?> clazz = handle.getClass();
if (clazz != packetClass_legacy) {
return null;
}
final Object action = ReflectionUtil.invokeMethodNoArgs(methodGetAction_legacy, handle);
if (action == null) {
return null;
}
final Object actionName = ReflectionUtil.invokeMethodNoArgs(methodName_legacy, action);
if (actionName instanceof String) {
return (String) actionName;
}
else {
return null;
}
}
}
private static final int INTERPRETED = 0x01;
private static final int ATTACK = 0x02;
private final AttackFrequency attackFrequency;
private final LegacyReflectionSet legacySet;
private volatile boolean protocolLibEntityUseActionBroken = false;
private volatile boolean protocolLibEntityUseActionWarningLogged = false;
public UseEntityAdapter(Plugin plugin) {
super(plugin, PacketType.Play.Client.USE_ENTITY);
this.checkType = CheckType.NET_ATTACKFREQUENCY;
// Add feature tags for checks.
if (NCPAPIProvider.getNoCheatPlusAPI().getWorldDataManager().isActiveAnywhere(CheckType.NET_ATTACKFREQUENCY)) {
NCPAPIProvider.getNoCheatPlusAPI().addFeatureTags("checks", Arrays.asList(AttackFrequency.class.getSimpleName()));
}
attackFrequency = new AttackFrequency();
NCPAPIProvider.getNoCheatPlusAPI().addComponent(attackFrequency);
this.legacySet = getLegacyReflectionSet();
}
private LegacyReflectionSet getLegacyReflectionSet() {
for (String versionDetail : new String[] {"v1_7_R4", "v1_7_R1"}) {
try {
return new LegacyReflectionSet(versionDetail);
}
catch (RuntimeException e) {} // +-
}
return null;
}
@Override
public void onPacketReceiving(final PacketEvent event) {
try {
if (event.isPlayerTemporary()) return;
}
catch(NoSuchMethodError e) {}
final long time = System.currentTimeMillis();
final Player player = event.getPlayer();
if (player == null) {
// TODO: Warn once?
return;
}
final IPlayerData pData = DataManager.getPlayerDataSafe(player);
if (pData == null) {
return;
}
final NetData data = pData.getGenericInstance(NetData.class);
// Always set last received time.
data.lastKeepAliveTime = time;
// Quick return, if no checks are active.
if (!pData.isCheckActive(CheckType.NET_ATTACKFREQUENCY, player)) {
return;
}
final PacketContainer packet = event.getPacket();
// MIGHT: use entity, use block both on packet level?
boolean isAttack = false;
boolean packetInterpreted = false;
if (legacySet != null) {
// Attempt to extract legacy information.
final int flags = getAction_legacy(packet);
if ((flags & INTERPRETED) != 0 ) {
packetInterpreted = true;
if ((flags & ATTACK) != 0) {
isAttack = true;
}
}
}
if (!packetInterpreted) {
// Handle as if latest.
try {
if (!protocolLibEntityUseActionBroken) {
final StructureModifier<EntityUseAction> actions = packet.getEntityUseActions();
if (actions.size() == 1) {
packetInterpreted = true;
isAttack = actions.read(0) == EntityUseAction.ATTACK;
}
// ProtocolLib compatibility: modern snapshots can throw while initializing enum wrappers.
if (!packetInterpreted && isServerAtLeast1_13) {
final StructureModifier<WrappedEnumEntityUseAction> enumActions = packet.getEnumEntityUseActions();
if (enumActions.size() == 1 && enumActions.read(0).equals(WrappedEnumEntityUseAction.attack())) {
packetInterpreted = true;
isAttack = true;
}
}
}
}
catch (NullPointerException e) {
/*
* TODO: Observed somewhere on 1_7_R4, probably a custom build -
* why doesn't the LegacyReflectionSet work here?
*/
}
catch (LinkageError | RuntimeException e) {
protocolLibEntityUseActionBroken = true;
if (!protocolLibEntityUseActionWarningLogged) {
protocolLibEntityUseActionWarningLogged = true;
// Diagnostic logging: name the failing branch so attack/combat packet issues are clear in console.
StaticLog.logWarning("ProtocolLib could not expose USE_ENTITY action data (branch=enumEntityUseActions, packet=" + packet.getType() + "). Skipping AttackFrequency interpretation for USE_ENTITY packets until restart.");
StaticLog.logWarning("ProtocolLib USE_ENTITY action failure: " + e.getClass().getName() + ": " + e.getMessage());
}
return;
}
}
if (!packetInterpreted) {
// StaticLog.logWarning("Attack packet couldn't be interpreted. Skipping AttackFrequency.");
// TODO: Log warning once, if the packet could not be interpreted.
return;
}
// Run checks.
boolean cancel = false;
// AttackFrequency
if (isAttack) {
final NetConfig cc = pData.getGenericInstance(NetConfig.class);
if (attackFrequency.isEnabled(player, pData)
&& attackFrequency.check(player, time, data, cc, pData)) {
cancel = true;
}
}
if (cancel) {
event.setCancelled(true);
}
}
private int getAction_legacy(final PacketContainer packetContainer) {
// (For some reason the object didn't appear work with equality checks, thus compare the short string.)
final String actionName = legacySet.getActionFromNMSPacket(packetContainer.getHandle());
return actionName == null ? 0 : (INTERPRETED | ("ATTACK".equals(actionName) ? ATTACK : 0));
}
}Classic 1.8 statistical killaura check over the use-entity stream.
Reads the wrapped use-entity packet on every attack, tracks target rotations, and flags when the player attacks entities outside their field of view or with impossible turn patterns. Small, event-driven, typical of the 1.8 generation of anticheats.
// ===== FILE: ElevatedDev-Frequency, src/main/java/xyz/elevated/frequency/check/impl/killaura/KillAuraA.java =====
package xyz.elevated.frequency.check.impl.killaura;
import net.minecraft.server.v1_8_R3.PacketPlayInUseEntity;
import xyz.elevated.frequency.check.CheckData;
import xyz.elevated.frequency.check.type.PostCheck;
import xyz.elevated.frequency.data.PlayerData;
import xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInFlying;
import xyz.elevated.frequency.wrapper.impl.client.WrappedPlayInUseEntity;
@CheckData(name = "KillAura (A)")
public final class KillAuraA extends PostCheck {
private boolean sent = false;
private long lastFlying = 0L, lastPacket = 0L;
private double buffer = 0.0d;
public KillAuraA(final PlayerData playerData) {
super(playerData, WrappedPlayInUseEntity.class);
}
@Override
public void process(final Object object) {
if (object instanceof WrappedPlayInFlying) {
final long now = System.currentTimeMillis();
final long delay = now - lastPacket;
if (sent) {
if (delay > 40L && delay < 100L) {
buffer += 0.25;
if (buffer > 0.5) {
fail();
}
} else {
buffer = Math.max(buffer - 0.025, 0);
}
sent = false;
}
this.lastFlying = now;
} else if (object instanceof WrappedPlayInUseEntity) {
final WrappedPlayInUseEntity wrapper = (WrappedPlayInUseEntity) object;
if (wrapper.getAction() != PacketPlayInUseEntity.EnumEntityUseAction.ATTACK) {
return;
}
final long now = System.currentTimeMillis();
final long delay = now - lastFlying;
if (delay < 10L) {
lastPacket = now;
sent = true;
} else {
buffer = Math.max(buffer - 0.025, 0.0);
}
}
}
}Related Packets
Wiki Cross-Reference
Middle-click pick-block in creative mode is resolved client-side and sent as a creative inventory action rather than as an entity interaction.
MCP 1.8.9 C02PacketUseEntity implements Packet
1.8.9 callers: PlayerControllerMP.attackEntity sends new C02PacketUseEntity (line 498): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/multiplayer/PlayerControllerMP.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 C02PacketUseEntity
Full source walkthroughs of the modules and anti-cheats that use this packet.