0x08 C08PacketPlayerBlockPlacement
Player places a block or uses an item. Can also be used for empty-hand interactions (e.g., pressing buttons).
Published 2026-06-18 · Updated 2026-10-14
Fields
| Field | Type | Description |
|---|---|---|
| position | BlockPos | Position where the block/item is used |
| placedBlockDirection | int | Face of the target block (0-5). 255 if no block face targeted. |
| stack | ItemStack | The item stack being used/placed |
| facingX/Y/Z | float | Cursor position on block face (0-1). Present when direction != 255. |
Wire Encoding
| Field | Type | Notes |
|---|---|---|
| Block Pos | Position | Encoded as long |
| Direction | byte | 0-5 for face, 255 for no face |
| Item In Hand | Slot | ItemStack being placed/used |
| Cursor X | byte | Cursor x (0-1 mapped to byte) |
| Cursor Y | byte | Cursor y |
| Cursor Z | byte | Cursor z |
MCP References
NetHandlerPlayServer.processPlayerBlockPlacement()Handler Interface
INetHandlerPlayServerVanilla 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 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
Deobfuscated MCP 1.8.9 source of C08PacketPlayerBlockPlacement, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/client/C08PacketPlayerBlockPlacement.java) at build time and verified present.
Deep Dive
Role in the protocol
C08 is the serverbound use/place packet. With placedBlockDirection == 255 it is a pure item use (eating, blocking, throwing), otherwise it is a block placement against the BlockPos + face with a cursor offset. The stack field lets the server verify the client's inventory state. This dual role makes it the single most-abused packet for movement and combat bypasses: it is how scaffold places blocks, how killaura holds a shield or sword block, how noslow keeps the use-item state alive, and how item-spam modules (AutoPot, AutoSoup) consume consumables at inhuman speed.
Vanilla handling
NetHandlerPlayServer.processPlayerBlockPlacement branches on the direction byte. For 255 it calls theItemInWorldManager.tryUseItem, which starts the item's use-tick state server-side. For a face it checks build limit, distance (hasMoved and 8-block radius), world border, then calls func_180236_a to place. The server compares packetIn.getStack() against the real inventory slot and re-sends S2FPacketSetSlot on mismatch, which is why clients that spoof the stack field get desynced slots.
Why clients touch it
All ten clients construct C08 directly. Scaffold modules (Rise 5.99, Rise 6.x, Sigma 4.11) send placements with computed BlockPos + face; Memeware and Nekoware auras send the autoblock form (new BlockPos(-1, -1, -1), 255) to start blocking mid-aura; NoSlow modules (Rise 5.99 NoSlow, Rise 6.x IntaveNoSlow/LegitNoSlow/NCPNoSlow/NewNCPNoSlow/WatchdogNoSlow, Sigma NoSlowdown, Spicy NoSlow) re-send the item-use C08 to keep the server believing the player is using the item; AutoPot/AutoSoup/AutoGap/AutoHead (Memeware, Rise 5.99, Rise 6.x, Sigma) spam the item-use form to consume faster than vanilla allows. Rise 6.2.4 even wraps placement in PlayBlockPlacementC2SPacket for its script/NetworkAPI layer. November Recode 2.0 drives AutoPot, autoblock and noslow through C08 and clicks the BLOCKS_MC paper with it in AutoPlay; LiquidSense Dev eats heads and equips armor with the C09/C08/C09 packet triple.
Exploit surface
The 255-use form has no cooldown server-side in 1.8.9, so item-use spam is only throttled by client ticks; anti-cheats flag the resulting consumption rate. The invalid-position form (pos -1,-1,-1, face 255) is silently accepted by vanilla (it falls into the item-use branch when direction == 255) but stands out to anti-cheats that track block-place patterns around the player's head. Scaffold places at the feet with yaw-derived face values, which NCP and Vulcan correlate against the player's rotation. C08 is also sent at 20+ per second by Rise 6.2.4 WatchdogDisabler as a fake water-bucket placement to reset watchdog's fall tracking, and by Speed/Fly modules to place blocks under the player mid-air.
Server-Side Handling
processPlayerBlockPlacement: if direction == 255, tryUseItem (no position checks); else enforce build limit, 8-block distance from the last confirmed position, world border and block protection before placing. Stack mismatch with the real inventory triggers an S2FPacketSetSlot resync. The server never validates that the client's held item matches the packet's stack for the 255 path beyond the slot resync.
Protocol Analysis
Fields: BlockPos (long), direction byte (255 = no face), ItemStack, three cursor bytes (0-16 mapped from floats). The item-use form still carries a position (usually BlockPos.ORIGIN or (-1,-1,-1)); vanilla ignores it when direction == 255. ViaVersion clients (Rise 6.2.4 BlockPlacementFixComponent) translate this to newer protocol versions where the packet was split into UseItemOn/UseItem.
Anti-Cheat Landscape
NCP flags scaffold rotations vs placement faces, Verus tracks placement frequency, Watchdog detects fake water-bucket placements when the inventory does not contain a bucket (Rise 6.2.4 WatchdogDisabler guards with BadPacketsComponent checks). AutoPot spam is caught by consumption-rate checks on popular servers; Noslow C08 spam is a classic Intave/Verus detection vector, hence the many per-AC modes in Rise 6.x.
implementation Implementation Cases
The use/place workhorse. Clients split it into three dialects: the item-use form (direction 255) for AutoPot/NoSlow/autoblock, the placement form for Scaffold, and the invalid-position form as a fake-use trick for disablers and speed modules.
Place a block under the player every tick while moving, using silent rotations and silent item switching.
On each pre-motion tick, raycast or brute-force a BlockPos below/around the player, pick the best block slot, send C09 to switch if needed, then send C08 with the target pos, the face, the held ItemStack and cursor offsets. Rise 5.99 additionally cancels incoming C09PacketHeldItemChange so the visible hotbar never moves, sends START/STOP_SNEAKING C0B for eagle mode, and releases the placement via PacketUtil.sendPacket.
// ===== FILE: Rise 5.99, dev/rise/module/impl/player/Scaffold.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.player;
import dev.rise.Rise;
import dev.rise.event.impl.motion.PostMotionEvent;
import dev.rise.event.impl.motion.PreMotionEvent;
import dev.rise.event.impl.other.CanPlaceBlockEvent;
import dev.rise.event.impl.other.MoveButtonEvent;
import dev.rise.event.impl.other.StrafeEvent;
import dev.rise.event.impl.other.WorldChangedEvent;
import dev.rise.event.impl.packet.PacketReceiveEvent;
import dev.rise.event.impl.packet.PacketSendEvent;
import dev.rise.event.impl.render.BlurEvent;
import dev.rise.event.impl.render.Render2DEvent;
import dev.rise.event.impl.render.Render3DEvent;
import dev.rise.font.CustomFont;
import dev.rise.module.Module;
import dev.rise.module.api.ModuleInfo;
import dev.rise.module.enums.Category;
import dev.rise.module.impl.movement.Speed;
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.util.math.MathUtil;
import dev.rise.util.math.TimeUtil;
import dev.rise.util.player.MoveUtil;
import dev.rise.util.player.PacketUtil;
import dev.rise.util.player.PlayerUtil;
import dev.rise.util.player.RotationUtil;
import dev.rise.util.render.RenderUtil;
import dev.rise.util.world.BlockUtil;
import dev.rise.util.world.EnumFacingOffset;
import dev.rise.viamcp.ViaMCP;
import net.minecraft.block.Block;
import net.minecraft.block.BlockAir;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.*;
import net.minecraft.network.play.server.S0BPacketAnimation;
import net.minecraft.network.play.server.S2FPacketSetSlot;
import net.minecraft.potion.Potion;
import net.minecraft.util.*;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import java.awt.*;
import java.security.SecureRandom;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
/**
* This module automatically puts a block under you to easily bridge effortlessly.
*/
@ModuleInfo(name = "Scaffold", description = "Places blocks under you", category = Category.PLAYER)
public final class Scaffold extends Module {
private final NoteSetting modeSettings = new NoteSetting("Mode Settings", this);
private final ModeSetting rotations = new ModeSetting("Rotations", this, "Normal", "None", "Normal", "Simple", "Down", "Snap", "Bruteforce", "Pitch Abuse", "Hypixel");
private final ModeSetting tower = new ModeSetting("Tower", this, "None", "None", "Vanilla", "Slow", "Verus", "Intave", "Hypixel", "NCP");
private final ModeSetting movementFix = new ModeSetting("Movement Fix", this, "None", "None", "Yaw", "Hidden");
private final ModeSetting sprint = new ModeSetting("Sprint", this, "Normal", "Normal", "None", "Bypass", "Legit", "Hypixel");
// private final ModeSetting speed = new ModeSetting("Speed", this, "None", "None", "NCP", "AAC", "Experimental");
private final ModeSetting blockCounter = new ModeSetting("Block Counter", this, "Normal", "Normal", "Minecraft");
private final NoteSetting generalSettings = new NoteSetting("General Settings", this);
private final NumberSetting timer = new NumberSetting("Timer", this, 1, 0.1, 10, 0.1);
private final NumberSetting towerTimer = new NumberSetting("Tower Timer", this, 1, 0.1, 10, 0.1);
private final BooleanSetting towerMove = new BooleanSetting("Tower Move", this, false);
private final BooleanSetting downwards = new BooleanSetting("Downwards", this, true);
private final BooleanSetting safewalk = new BooleanSetting("Safe Walk", this, true);
private final BooleanSetting strafe = new BooleanSetting("Strafe", this, false);
private final BooleanSetting sameY = new BooleanSetting("Same Y", this, false);
private final BooleanSetting swing = new BooleanSetting("Swing", this, true);
private final BooleanSetting disableOnWorldChange = new BooleanSetting("Disable on World Change", this, false);
private final BooleanSetting disableSpeed = new BooleanSetting("Disable Speed", this, false);
private final NoteSetting bypassSettings = new NoteSetting("Bypass Settings", this);
private final NumberSetting range = new NumberSetting("Range", this, 3, 1, 6, 0.5);
private final BooleanSetting randomiseRotationSpeedOnEnable = new BooleanSetting("Randomise Rotation Speed On Enable", this, false);
private final NumberSetting rotationSpeed = new NumberSetting("Rotation Speed", this, 50, 5, 360, 5);
private final NumberSetting randomisation = new NumberSetting("Randomisation", this, 1, 0, 6, 0.1);
private final NumberSetting placeDelay = new NumberSetting("Place Delay", this, 0, 0, 5, 0.1);
private final BooleanSetting randomisePlaceDelay = new BooleanSetting("Randomise Place Delay", this, false);
private final NumberSetting speedMultiplier = new NumberSetting("Speed Multiplier", this, 1, 0, 2, 0.05);
private final NumberSetting eagle = new NumberSetting("Eagle", this, 4, 0, 15, 1, "15-Never", "0-Packet");
private final NumberSetting expand = new NumberSetting("Expand", this, 0, 0, 5, 0.1);
private final BooleanSetting ignoreSpeed = new BooleanSetting("Ignore Speed", this, false);
private final ModeSetting rayCast = new ModeSetting("Ray Cast", this, "Normal", "Normal", "Strict", "Off");
private final ModeSetting placeOn = new ModeSetting("Place on", this, "Legit", "Legit", "Post", "Pre");
private final BooleanSetting dragClick = new BooleanSetting("Drag Click", this, false);
private final BooleanSetting jitter = new BooleanSetting("Jitter", this, false);
private final BooleanSetting telly = new BooleanSetting("Telly", this, false);
private final ModeSetting tellyMode = new ModeSetting("Telly Mode", this, "Legit", "Legit", "Teleport", "Custom");
private final NumberSetting teleportOhMyGod = new NumberSetting("Teleport Height", this, 0.42, 0.01, 5.00, 0.01);
private final NumberSetting tellyVerticalAmount = new NumberSetting("Custom Vertical Amount", this, 0.42, 0.01, 1.00, 0.01);
private final NumberSetting tellyHorizontalAmount = new NumberSetting("Custom Horizontal Amount", this, 0.35, 0.0, 4.0, 0.01);
private final BooleanSetting hideJumps = new BooleanSetting("Hide Jumps", this, false);
private Vec3 targetBlock;
private List<Vec3> placePossibilities = new ArrayList<>();
private EnumFacingOffset enumFacing;
private BlockPos blockFace;
private boolean touchedGround;
private int slowTicks;
private float targetYaw, targetPitch, yaw, lastYaw, lastPitch;
public static float pitch;
private boolean lastGround;
private int blockCount;
private int ticksOnAir;
private double startY;
private int slot;
private int offGroundTicks;
private int blocksPlaced;
private int towerOnGroundTicks;
private boolean sneaking;
private boolean shiftPressed;
private boolean shouldEnableSpeed;
private float offsetYaw, offsetPitch;
TimeUtil timer3 = new TimeUtil();
@Override
public void onUpdateAlwaysInGui() {
rotationSpeed.hidden = rotations.is("None");
tellyMode.hidden = !telly.isEnabled();
tellyVerticalAmount.hidden = tellyHorizontalAmount.hidden = !tellyMode.is("Custom") || !telly.isEnabled();
teleportOhMyGod.hidden = !tellyMode.is("Teleport") || !telly.isEnabled();
}
@Override
protected void onEnable() {
if (this.getModule(Speed.class).isEnabled() && disableSpeed.isEnabled()) {
shouldEnableSpeed = true;
this.getModule(Speed.class).setEnabled(false);
this.registerNotification("Disabled Speed to prevent flags.");
} else {
shouldEnableSpeed = false;
}
slowTicks = 0;
slot = mc.thePlayer.inventory.currentItem;
yaw = lastYaw = mc.thePlayer.rotationYaw;
pitch = lastPitch = mc.thePlayer.rotationPitch;
if (sprint.is("Hypixel") && !mc.thePlayer.onGround) {
MoveUtil.stop();
}
if (rotations.is("Pitch Abuse")) {
targetYaw = mc.thePlayer.rotationYaw;
targetPitch = 94;
} else {
targetYaw = mc.thePlayer.rotationYaw - 180;
targetPitch = 90;
}
startY = mc.thePlayer.posY;
targetBlock = null;
placePossibilities.clear();
if (randomiseRotationSpeedOnEnable.isEnabled()) {
rotationSpeed.setValue(50 + (85 - 50) * Math.random());
}
offsetYaw = (float) ((Math.random() - 0.5) * 2);
offsetPitch = (float) ((Math.random() - 0.5) * 2);
}
@Override
public void onWorldChanged(final WorldChangedEvent event) {
if (disableOnWorldChange.isEnabled()) {
this.toggleModule();
}
}
@Override
public void onPacketReceive(final PacketReceiveEvent event) {
final Packet<?> p = event.getPacket();
if (p instanceof S2FPacketSetSlot) event.setCancelled(true);
}
@Override
protected void onDisable() {
mc.gameSettings.keyBindForward.setKeyPressed(Keyboard.isKeyDown(mc.gameSettings.keyBindForward.getKeyCode()));
blocksPlaced = 0;
if (shouldEnableSpeed) {
if (!this.getModule(Speed.class).isEnabled()) {
this.getModule(Speed.class).setEnabled(true);
this.registerNotification("Enabled Speed since it was previously enabled.");
}
}
if (slot != mc.thePlayer.inventory.currentItem)
PacketUtil.sendPacketWithoutEvent(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));
EntityPlayer.movementYaw = null;
mc.timer.timerSpeed = 1;
mc.gameSettings.keyBindSneak.setKeyPressed(false);
EntityPlayer.enableCameraYOffset = false;
if (sneaking) {
sneaking = false;
PacketUtil.sendPacket(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING));
}
}
@Override
public void onStrafe(final StrafeEvent event) {
if (movementFix.is("Hidden")) {
event.setCancelled(true);
silentRotationStrafe(event, yaw);
}
if (strafe.isEnabled()) MoveUtil.strafe();
}
@Override
public void onRender3DEvent(final Render3DEvent event) {
if (!rotations.is("None")) {
if (enumFacing == null || blockFace == null) return;
this.calculateRotations();
}
}
@Override
public void onPreMotion(final PreMotionEvent event) {
if (disableSpeed.isEnabled() && this.getModule(Speed.class).isEnabled()) {
this.toggleModule();
this.registerNotification("Disabled " + this.getModuleInfo().name() + " to prevent flags.");
}
if (this.placeOn.is("Pre")) {
this.placeBlock();
}
double forward = 0, posX = 0, posZ = 0;
float direction = (float) MoveUtil.getDirection();
posX = -MathHelper.sin(direction) * forward + mc.thePlayer.posX;
posZ = MathHelper.cos(direction) * forward + mc.thePlayer.posZ;
for (forward = 0; forward <= expand.getValue() && !(PlayerUtil.getBlock(posX, mc.thePlayer.posY - 1, posZ) instanceof BlockAir); forward += 0.1) {
if (tower.is("Hypixel") && Keyboard.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode()) && !this.getModule(Speed.class).isEnabled() && mc.currentScreen == null) {
if (blocksPlaced % 3 == 0) {
forward = 1;
}
} else {
forward = expand.getValue();
}
direction = (float) MoveUtil.getDirection();
posX = -MathHelper.sin(direction) * forward + mc.thePlayer.posX;
posZ = MathHelper.cos(direction) * forward + mc.thePlayer.posZ;
}
if (!MoveUtil.isMoving() && !tower.is("Hypixel")) {
forward = 0;
posX = -MathHelper.sin(direction) * forward + mc.thePlayer.posX;
posZ = MathHelper.cos(direction) * forward + mc.thePlayer.posZ;
}
if (PlayerUtil.getBlock(posX, mc.thePlayer.posY - 1, posZ) instanceof BlockAir) ticksOnAir++;
else ticksOnAir = 0;
if (mc.thePlayer.onGround) {
offGroundTicks = 0;
} else offGroundTicks++;
EntityPlayer.enableCameraYOffset = false;
if (mc.thePlayer.posY > startY && hideJumps.isEnabled() && !mc.gameSettings.keyBindJump.isKeyDown()) {
EntityPlayer.enableCameraYOffset = true;
EntityPlayer.cameraYPosition = startY;
}
// Ghost item fix
for (int slot = 0; slot < 9; slot++) {
if (mc.thePlayer.inventory.getStackInSlot(slot) != null && mc.thePlayer.inventory.getStackInSlot(slot).getItem() instanceof ItemBlock) {
ItemStack stack = mc.thePlayer.inventory.getStackInSlot(slot);
if (stack.getStackSize() == 0) mc.thePlayer.inventory.setInventorySlotContents(slot, null);
}
}
int blocks = 0;
for (int i = 36; i < 45; ++i) {
final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();
if (itemStack != null && itemStack.getItem() instanceof ItemBlock && itemStack.stackSize > 0) {
final Block block = ((ItemBlock) itemStack.getItem()).getBlock();
if (block.isFullCube() && !BlockUtil.BLOCK_BLACKLIST.contains(block))
blocks += itemStack.getStackSize();
}
}
blockCount = blocks;
if (mc.thePlayer.onGround || (mc.gameSettings.keyBindJump.isKeyDown() && !sameY.isEnabled()))
startY = mc.thePlayer.posY;
final int blockSlot = BlockUtil.findBlock() - 36;
if (blockSlot < 0 || blockSlot > 9) return;
// Sprinting
switch (sprint.getMode()) {
case "None": {
mc.gameSettings.keyBindSprint.setKeyPressed(false);
mc.thePlayer.setSprinting(false);
break;
}
case "Bypass": {
mc.thePlayer.setSprinting(false);
break;
}
case "Legit": {
if (Math.abs(MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw) - MathHelper.wrapAngleTo180_float(yaw)) > 90) {
mc.gameSettings.keyBindSprint.setKeyPressed(false);
mc.thePlayer.setSprinting(false);
}
break;
}
case "Hypixel": {
if (MoveUtil.isMoving() && slowTicks <= 3 && mc.thePlayer.onGround && slowTicks >= 0) {
mc.gameSettings.keyBindSprint.setKeyPressed(true);
mc.thePlayer.setSprinting(true);
final double[] xz = yawPos((float) ((float) MoveUtil.getDirection()), (MoveUtil.getBaseMoveSpeed() / 2) - Math.random() / 100);
PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX - xz[0], mc.thePlayer.posY, mc.thePlayer.posZ - xz[1], true));
if (mc.thePlayer.ticksExisted % 5 == 0) {
mc.thePlayer.setPosition(mc.thePlayer.posX - getRandomHypixelValues(), mc.thePlayer.posY, mc.thePlayer.posZ - getRandomHypixelValues());
}
slowTicks--;
}
mc.thePlayer.motionX *= .975;
mc.thePlayer.motionZ *= .975;
}
}
// Speed
// switch (speed.getMode()) {
// case "NCP": {
// if (mc.thePlayer.onGround) {
// if (mc.thePlayer.ticksExisted % 15 == 0) {
// mc.thePlayer.motionX *= 1.5 + Math.random() / 100D;
// mc.thePlayer.motionZ *= 1.5 + Math.random() / 100D;
// } else if (mc.thePlayer.ticksExisted - 2 % 15 == 0) {
// mc.thePlayer.motionX *= 0.7;
// mc.thePlayer.motionZ *= 0.7;
// }
// }
// }
// case "AAC": {
// break;
// }
// case "Experimental": {
// break;
// }
// }
placePossibilities = getPlacePossibilities();
if (placePossibilities.isEmpty()) return;
double finalPosX = posX;
double finalPosZ = posZ;
placePossibilities.sort(Comparator.comparingDouble(vec3 -> {
final double d0 = finalPosX - vec3.xCoord;
final double d1 = mc.thePlayer.posY - 1 - vec3.yCoord;
final double d2 = finalPosZ - vec3.zCoord;
return MathHelper.sqrt_double(d0 * d0 + d1 * d1 + d2 * d2);
}));
targetBlock = placePossibilities.get(0);
enumFacing = getEnumFacing(targetBlock);
if (downwards.isEnabled() && mc.gameSettings.keyBindSneak.isKeyDown() && mc.thePlayer.onGround && enumFacing != null && enumFacing.getEnumFacing() != null)
enumFacing.enumFacing = EnumFacing.DOWN;
if (sameY.isEnabled() && mc.thePlayer.posY < startY) startY = mc.thePlayer.posY;
if (enumFacing == null) return;
final BlockPos position = new BlockPos(targetBlock.xCoord, targetBlock.yCoord, targetBlock.zCoord);
blockFace = position.add(enumFacing.getOffset().xCoord, enumFacing.getOffset().yCoord, enumFacing.getOffset().zCoord);
if (blockFace == null) return;
shiftPressed = mc.theWorld.getBlockState(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1.0, mc.thePlayer.posZ)).getBlock() instanceof BlockAir && mc.thePlayer.onGround && blocksPlaced == eagle.getValue() && eagle.getValue() != 15 && eagle.getValue() != 0;
if (mc.theWorld.getBlockState(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY - 1.0, mc.thePlayer.posZ)).getBlock() instanceof BlockAir && eagle.getValue() == 0) {
if (!sneaking) {
sneaking = true;
PacketUtil.sendPacket(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SNEAKING));
}
} else {
if (sneaking) {
sneaking = false;
PacketUtil.sendPacket(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SNEAKING));
}
}
if (blocksPlaced > eagle.getValue()) blocksPlaced = 1;
if (!rotations.is("None")) {
if (PlayerUtil.isOnServer("hypixel")) {
event.setYaw((float) (yaw + offsetYaw + ((Math.random() > 0.7) ? (Math.random() - 0.5) : 0)));
event.setPitch((float) (pitch + offsetPitch + ((Math.random() > 0.7) ? (Math.random() - 0.5) : 0)));
} else {
event.setYaw(yaw);
event.setPitch(pitch);
}
mc.thePlayer.renderYawOffset = yaw;
mc.thePlayer.rotationYawHead = yaw;
// mc.thePlayer.rotationYaw = yaw;
// mc.thePlayer.rotationPitch = pitch;
lastYaw = yaw;
lastPitch = pitch;
} else {
yaw = mc.thePlayer.rotationYaw;
pitch = mc.thePlayer.rotationPitch;
}
if (placePossibilities.isEmpty() || targetBlock == null || enumFacing == null || blockFace == null || slot < 0 || slot > 9)
return;
mc.timer.timerSpeed = (float) timer.getValue();
// Tower
if (Keyboard.isKeyDown(mc.gameSettings.keyBindJump.getKeyCode()) && !this.getModule(Speed.class).isEnabled() && mc.currentScreen == null) {
mc.timer.timerSpeed = (float) towerTimer.getValue();
if (!tower.is("None")) mc.gameSettings.keyBindJump.setKeyPressed(false);
if (!towerMove.isEnabled() && !tower.is("None"))
mc.thePlayer.setPosition(Math.floor(mc.thePlayer.posX) + 0.5, mc.thePlayer.posY, Math.floor(mc.thePlayer.posZ) + 0.5);
switch (tower.getMode()) {
case "Vanilla": {
mc.thePlayer.motionY = 0.42F;
break;
}
case "Hypixel": {
mc.thePlayer.setSprinting(false);
if (mc.thePlayer.posY % 1 <= 0.00153598) {
mc.thePlayer.setPosition(mc.thePlayer.posX, Math.floor(mc.thePlayer.posY), mc.thePlayer.posZ);
// mc.thePlayer.jump();
mc.thePlayer.motionY = 0.42F - Math.random() / 10000f;
} else if (mc.thePlayer.posY % 1 < 0.1 && offGroundTicks != 0) {
mc.thePlayer.motionY = 0;
mc.thePlayer.setPosition(mc.thePlayer.posX, Math.floor(mc.thePlayer.posY), mc.thePlayer.posZ);
}
break;
}
case "Slow": {
if (mc.thePlayer.onGround) mc.thePlayer.motionY = 0.4F;
else if (PlayerUtil.getBlockRelativeToPlayer(0, -1, 0) instanceof BlockAir)
mc.thePlayer.motionY -= 0.4F;
MoveUtil.stop();
break;
}
case "Verus": {
if (mc.thePlayer.ticksExisted % 2 == 0) {
mc.thePlayer.motionY = 0.42F;
}
break;
}
case "Intave": {
if (mc.thePlayer.onGround) {
mc.thePlayer.motionY = 0.40444491418477924;
}
if (offGroundTicks == 5) {
mc.thePlayer.motionY = MoveUtil.getPredictedMotionY(mc.thePlayer.motionY);
}
break;
}
case "NCP": {
if (mc.thePlayer.posY % 1 <= 0.00153598) {
mc.thePlayer.setPosition(mc.thePlayer.posX, Math.floor(mc.thePlayer.posY), mc.thePlayer.posZ);
// mc.thePlayer.jump();
mc.thePlayer.motionY = 0.41998F - getRandomHypixelValues() / 2;
} else if (mc.thePlayer.posY % 1 < 0.1 && offGroundTicks != 0) {
mc.thePlayer.setPosition(mc.thePlayer.posX, Math.floor(mc.thePlayer.posY), mc.thePlayer.posZ);
}
break;
}
}
}
final double baseSpeed = getBaseSpeed();
final double speedMultiplier = this.speedMultiplier.getValue();
if (Math.abs(speedMultiplier - 1.0) > 1E-4 && mc.thePlayer.onGround && !(mc.thePlayer.isPotionActive(Potion.moveSpeed) && mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier() > 2 - 1) && baseSpeed != 0) {
MoveUtil.strafe(baseSpeed * speedMultiplier);
}
}
public double getBaseSpeed() {
if (mc.gameSettings.keyBindSprint.isKeyDown()) {
if (mc.thePlayer.isPotionActive(Potion.moveSpeed) && !ignoreSpeed.isEnabled()) {
if (mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier() + 1 == 1) {
return 0.18386012061481244;
} else {
return 0.21450346015841276;
}
} else {
return 0.15321676228437875;
}
} else {
if (mc.thePlayer.isPotionActive(Potion.moveSpeed) && !ignoreSpeed.isEnabled()) {
if (mc.thePlayer.getActivePotionEffect(Potion.moveSpeed).getAmplifier() + 1 == 1) {
return 0.14143085686761;
} else {
return 0.16500264553372018;
}
} else {
return 0.11785905094607611;
}
}
}
public float[] calculateRotations() {
if (((ticksOnAir > placeDelay.getValue()) || rotations.is("Snap")) || movementFix.is("Yaw")) {
final float[] rotations = BlockUtil.getDirectionToBlock(blockFace.getX(), blockFace.getY(), blockFace.getZ(), enumFacing.getEnumFacing());
if (movementFix.is("Yaw")) {
targetYaw = (float) (MoveUtil.getDirectionWrappedTo90() * (180 / Math.PI) - 180);
targetPitch = rotations[1];
switch (this.rotations.getMode()) {
case "Snap": {
if (ticksOnAir > placeDelay.getValue()) {
targetYaw = (float) (MoveUtil.getDirectionWrappedTo90() * (180 / Math.PI) - 180);
targetPitch = rotations[1];
} else {
targetYaw = (float) (mc.thePlayer.rotationYaw + Math.random());
targetPitch = mc.thePlayer.rotationPitch;
}
break;
}
}
} else {
switch (this.rotations.getMode()) {
case "Normal": {
targetYaw = rotations[0];
targetPitch = rotations[1];
break;
}
case "Simple": {
float yaw = 0;
switch (enumFacing.getEnumFacing()) {
case SOUTH: {
yaw = 180;
break;
}
case EAST: {
yaw = 90;
break;
}
case WEST: {
yaw = -90;
break;
}
}
targetYaw = yaw;
targetPitch = 90;
break;
}
case "Down": {
targetPitch = (float) (89 + Math.random() / 200f);
targetYaw = (float) (mc.thePlayer.rotationYaw - 180 - Math.random() * 15);
break;
}
case "Hypixel": {
targetPitch = (float) (89 + Math.random() / 100f);
targetYaw = (float) (mc.thePlayer.rotationYaw + 180 - Math.random() * 10);
break;
}
case "Snap": {
targetYaw = rotations[0];
targetPitch = rotations[1];
if (ticksOnAir <= placeDelay.getValue()) {
targetYaw = (float) (mc.thePlayer.rotationYaw + Math.random());
targetPitch = mc.thePlayer.rotationPitch;
}
break;
}
case "Bruteforce": {
boolean found = false;
for (float yaw = mc.thePlayer.rotationYaw - 180; yaw <= mc.thePlayer.rotationYaw + 360 - 180 && !found; yaw += 45) {
for (float pitch = 90; pitch > 30 && !found; pitch -= 1) {
if (BlockUtil.lookingAtBlock(blockFace, yaw, pitch, enumFacing.getEnumFacing(), rayCast.is("Strict"))) {
targetYaw = yaw;
targetPitch = pitch;
found = true;
}
}
}
if (!found) {
targetYaw = (float) (rotations[0] + (Math.random() - 0.5) * 4);
targetPitch = (float) (rotations[1] + (Math.random() - 0.5) * 4);
}
break;
}
case "Pitch Abuse":
boolean found = false;
boolean strict = rayCast.is("Strict");
for (float yaw = mc.thePlayer.rotationYaw; yaw <= mc.thePlayer.rotationYaw + 360 && !found; yaw += 5) {
for (float pitch = 120; pitch < 180 && !found; pitch += 1) {
if (BlockUtil.lookingAtBlock(blockFace, yaw, pitch, enumFacing.getEnumFacing(), strict)) {
targetYaw = yaw;
targetPitch = pitch;
found = true;
}
}
}
if (!found) {
targetYaw = mc.thePlayer.rotationYaw;
targetPitch = 94;
}
break;
}
}
}
final int fps = (int) (Minecraft.getDebugFPS() / 20.0F);
final float rotationSpeed = (float) (this.rotationSpeed.getValue() + Math.random() * 20) * 6 / fps;
final float deltaYaw = (((targetYaw - lastYaw) + 540) % 360) - 180;
final float deltaPitch = targetPitch - lastPitch;
final float distanceYaw = MathHelper.clamp_float(deltaYaw, -rotationSpeed, rotationSpeed);
final float distancePitch = MathHelper.clamp_float(deltaPitch, -rotationSpeed, rotationSpeed);
yaw = lastYaw + distanceYaw;
pitch = lastPitch + distancePitch;
targetPitch += (float) (this.randomisation.getValue() * (Math.random() - 0.5) * 3);
targetYaw += (float) (this.randomisation.getValue() * (Math.random() - 0.5) * 3);
if (rotationSpeed >= 355) {
yaw = targetYaw;
pitch = targetPitch;
}
final float[] currentRotations = new float[]{yaw, pitch};
final float[] lastRotations = new float[]{lastYaw, lastPitch};
final float[] fixedRotations = RotationUtil.getFixedRotation(currentRotations, lastRotations);
yaw = fixedRotations[0];
pitch = fixedRotations[1];
if (!rotations.is("Pitch Abuse")) pitch = MathHelper.clamp_float(pitch, -90, 90);
return new float[]{yaw, pitch};
}
@Override
public void onRender2DEvent(final Render2DEvent event) {
if (blockCount == 0) return;
final ScaledResolution sr = event.getScaledResolution();
final ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(slot);
Color color;
if (blockCount <= 63) {
color = Color.RED;
} else color = Color.GREEN;
if (blockCounter.is("MC")) {
final int height = sr.getScaledHeight() / 2;
mc.fontRendererObj.drawStringWithShadow(String.valueOf(blockCount), sr.getScaledWidth() / 2F + 1F, height + 9, color.getRGB());
if (itemStack != null) {
GlStateManager.pushMatrix();
GlStateManager.enableRescaleNormal();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
RenderHelper.enableGUIStandardItemLighting();
mc.getRenderItem().renderItemAndEffectIntoGUI(itemStack, sr.getScaledWidth() / 2F - 17F, height + 4);
GlStateManager.disableRescaleNormal();
GlStateManager.disableBlend();
RenderHelper.disableStandardItemLighting();
GlStateManager.popMatrix();
} else CustomFont.drawCenteredString("?", sr.getScaledWidth() / 2F + 0.5F, height + 6, -1);
}
if (blockCounter.is("Normal")) {
final int height = sr.getScaledHeight() - 90;
RenderUtil.roundedRect((sr.getScaledWidth() / 2F) - 15, height, 30, 30, 6, new Color(0, 0, 0, 80));
CustomFont.drawCenteredString(String.valueOf(blockCount), sr.getScaledWidth() / 2F, height + 19, -1);
if (itemStack != null) {
GlStateManager.pushMatrix();
GlStateManager.enableRescaleNormal();
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
RenderHelper.enableGUIStandardItemLighting();
mc.getRenderItem().renderItemAndEffectIntoGUI(itemStack, sr.getScaledWidth() / 2F - 8F, height + 2);
GlStateManager.disableRescaleNormal();
GlStateManager.disableBlend();
RenderHelper.disableStandardItemLighting();
GlStateManager.popMatrix();
} else CustomFont.drawCenteredString("?", sr.getScaledWidth() / 2F + 0.5F, height + 6, -1);
}
}
@Override
public void onBlur(final BlurEvent event) {
if (blockCounter.is("Normal")) {
final ScaledResolution sr = new ScaledResolution(mc);
final int height = sr.getScaledHeight() - 90;
RenderUtil.roundedRect((sr.getScaledWidth() / 2F) - 15, height, 30, 30, 6, new Color(0, 0, 0, 80));
}
}
@Override
public void onMoveButton(final MoveButtonEvent event) {
if (jitter.isEnabled()) {
if (mc.gameSettings.keyBindForward.isKeyDown() || mc.gameSettings.keyBindBack.isKeyDown()) {
if (mc.thePlayer.ticksExisted % 2 == 0) event.setLeft(true);
else event.setRight(true);
}
if (mc.gameSettings.keyBindLeft.isKeyDown() || mc.gameSettings.keyBindRight.isKeyDown()) {
if (mc.thePlayer.ticksExisted % 2 == 0) event.setForward(true);
else event.setBackward(true);
}
}
if (telly.isEnabled() && MoveUtil.isMoving() && mc.thePlayer.onGround) {
switch (tellyMode.getMode()) {
case "Legit":
event.setJump(true);
break;
case "Custom":
mc.thePlayer.motionY = tellyVerticalAmount.getValue();
MoveUtil.strafe(tellyHorizontalAmount.getValue());
case "Teleport":
mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + teleportOhMyGod.getValue(), mc.thePlayer.posZ);
break;
}
}
event.setSneak(shiftPressed);
}
@Override
public void onPacketSend(final PacketSendEvent event) {
final Packet<?> p = event.getPacket();
if (p instanceof C09PacketHeldItemChange) event.setCancelled(true);
}
@Override
public void onCanPlaceBlockEvent(final CanPlaceBlockEvent event) {
if (placeOn.is("Legit")) {
this.placeBlock();
}
}
@Override
public void onPostMotion(final PostMotionEvent event) {
if (placeOn.is("Post")) {
this.placeBlock();
}
// mc.gameSettings.keyBindJump.setKeyPressed(false);
//
// if (mc.thePlayer.onGround && towerOnGroundTicks >= 3) {
// float[] jumpPos = new float[]{0.42f, 0.7532f, 1.00134f};
//
// for (float pos : jumpPos) {
// PacketUtil.sendPacket(new C03PacketPlayer.C04PacketPlayerPosition(mc.thePlayer.posX, mc.thePlayer.posY + pos, mc.thePlayer.posZ, false));
// }
//
// mc.thePlayer.setPosition(mc.thePlayer.posX, mc.thePlayer.posY + 1.1661, mc.thePlayer.posZ);
// }
}
public static double getRandomHypixelValues() {
SecureRandom secureRandom = new SecureRandom();
double value = secureRandom.nextDouble() * (1.0 / System.currentTimeMillis());
for (int i = 0; i < MathUtil.getRandom(MathUtil.getRandom(4, 6), MathUtil.getRandom(8, 20)); i++)
value *= (1.0 / System.currentTimeMillis());
return value;
}
public static double[] yawPos(float yaw, double value) {
return new double[]{-MathHelper.sin(yaw) * value, MathHelper.cos(yaw) * value};
}
public void placeBlock() {
final int blockSlot = BlockUtil.findBlock() - 36;
if (blockSlot < 0 || blockSlot > 9) return;
boolean switchedSlot = false;
if (slot != blockSlot) {
slot = blockSlot;
PacketUtil.sendPacketWithoutEvent(new C09PacketHeldItemChange(slot));
switchedSlot = true;
}
if (placePossibilities.isEmpty() || targetBlock == null || enumFacing == null || blockFace == null || slot < 0 || slot > 9)
return;
final MovingObjectPosition movingObjectPosition = mc.thePlayer.rayTraceCustom(mc.playerController.getBlockReachDistance(), mc.timer.renderPartialTicks, yaw, pitch);
if (movingObjectPosition == null) return;
final boolean sameY = (this.sameY.isEnabled() || (this.getModule(Speed.class).isEnabled() && !mc.gameSettings.keyBindJump.isKeyDown())) && MoveUtil.isMoving();
if (((int) startY - 1 != (int) targetBlock.yCoord && sameY)) return;
final Vec3 hitVec = movingObjectPosition.hitVec;
final ItemStack item = mc.thePlayer.inventoryContainer.getSlot(slot + 36).getStack();
if (!switchedSlot && ticksOnAir > placeDelay.getValue() + (randomisePlaceDelay.isEnabled() && !mc.gameSettings.keyBindJump.isKeyDown() ? Math.random() * 3 : 0) && ((BlockUtil.lookingAtBlock(blockFace, yaw, pitch, enumFacing.getEnumFacing(), rayCast.is("Strict"))) || this.rayCast.is("Off"))) {
if (!BlockUtil.lookingAtBlock(blockFace, yaw, pitch, enumFacing.getEnumFacing(), rayCast.is("Strict"))) {
hitVec.yCoord = Math.random() + blockFace.getY();
hitVec.zCoord = Math.random() + blockFace.getZ();
hitVec.xCoord = Math.random() + blockFace.getX();
}
if (ViaMCP.getInstance().getVersion() > 47) {
if (swing.isEnabled()) mc.thePlayer.swingItem();
else PacketUtil.sendPacket(new C0APacketAnimation());
}
mc.playerController.onPlayerRightClick(mc.thePlayer, mc.theWorld, item, blockFace, enumFacing.getEnumFacing(), hitVec);
if (ViaMCP.getInstance().getVersion() <= 47) {
if (swing.isEnabled()) mc.thePlayer.swingItem();
else PacketUtil.sendPacket(new C0APacketAnimation());
}
slowTicks = 3;
blocksPlaced++;
} else if (dragClick.isEnabled() && Math.random() > 0.5)
PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(item));
}
public static void silentRotationStrafe(final StrafeEvent event, final float yaw) {
final int dif = (int) ((MathHelper.wrapAngleTo180_float(mc.thePlayer.rotationYaw - yaw - 23.5F - 135.0F) + 180.0F) / 45.0F);
final float strafe = event.getStrafe();
final float forward = event.getForward();
final float friction = event.getFriction();
float calcForward = 0.0F;
float calcStrafe = 0.0F;
switch (dif) {
case 0: {
calcForward = forward;
calcStrafe = strafe;
break;
}
case 1: {
calcForward += forward;
calcStrafe -= forward;
calcForward += strafe;
calcStrafe += strafe;
break;
}
case 2: {
calcForward = strafe;
calcStrafe = -forward;
break;
}
case 3: {
calcForward -= forward;
calcStrafe -= forward;
calcForward += strafe;
calcStrafe -= strafe;
break;
}
case 4: {
calcForward = -forward;
calcStrafe = -strafe;
break;
}
case 5: {
calcForward -= forward;
calcStrafe += forward;
calcForward -= strafe;
calcStrafe -= strafe;
break;
}
case 6: {
calcForward = -strafe;
calcStrafe = forward;
break;
}
case 7: {
calcForward += forward;
calcStrafe += forward;
calcForward -= strafe;
calcStrafe += strafe;
break;
}
}
if (calcForward > 1.0F || (calcForward < 0.9F && calcForward > 0.3F) || calcForward < -1.0F || (calcForward > -0.9F && calcForward < -0.3F))
calcForward *= 0.5F;
if (calcStrafe > 1.0F || (calcStrafe < 0.9F && calcStrafe > 0.3F) || calcStrafe < -1.0F || (calcStrafe > -0.9F && calcStrafe < -0.3F))
calcStrafe *= 0.5F;
float d;
if ((d = calcStrafe * calcStrafe + calcForward * calcForward) >= 1.0E-4F) {
if ((d = MathHelper.sqrt_float(d)) < 1.0F) {
d = 1.0F;
}
d = friction / d;
final float yawSin = MathHelper.sin((float) (yaw * Math.PI / 180.0));
final float yawCos = MathHelper.cos((float) (yaw * Math.PI / 180.0));
mc.thePlayer.motionX += (calcStrafe *= d) * yawCos - (calcForward *= d) * yawSin;
mc.thePlayer.motionZ += calcForward * yawCos + calcStrafe * yawSin;
}
}
private EnumFacingOffset getEnumFacing(final Vec3 position) {
for (int x2 = -1; x2 <= 1; x2 += 2) {
if (!(PlayerUtil.getBlock(position.xCoord + x2, position.yCoord, position.zCoord) instanceof BlockAir)) {
if (x2 > 0) {
return new EnumFacingOffset(EnumFacing.WEST, new Vec3(x2, 0, 0));
} else {
return new EnumFacingOffset(EnumFacing.EAST, new Vec3(x2, 0, 0));
}
}
}
for (int y2 = -1; y2 <= 1; y2 += 2) {
if (!(PlayerUtil.getBlock(position.xCoord, position.yCoord + y2, position.zCoord) instanceof BlockAir)) {
if (y2 < 0) {
return new EnumFacingOffset(EnumFacing.UP, new Vec3(0, y2, 0));
}
}
}
for (int z2 = -1; z2 <= 1; z2 += 2) {
if (!(PlayerUtil.getBlock(position.xCoord, position.yCoord, position.zCoord + z2) instanceof BlockAir)) {
if (z2 < 0) {
return new EnumFacingOffset(EnumFacing.SOUTH, new Vec3(0, 0, z2));
} else {
return new EnumFacingOffset(EnumFacing.NORTH, new Vec3(0, 0, z2));
}
}
}
return null;
}
//This methods purpose is to get block placement possibilities, blocks are 1 unit thick so please don't change it to 0.5 it causes bugs
private List<Vec3> getPlacePossibilities() {
final List<Vec3> possibilities = new ArrayList<>();
final int range = (int) Math.ceil(this.range.getValue() + this.expand.getValue() + 1);
for (int x = -range; x <= range; ++x) {
for (int y = -range; y <= range; ++y) {
for (int z = -range; z <= range; ++z) {
final Block block = PlayerUtil.getBlockRelativeToPlayer(x, y, z);
if (!(block instanceof BlockAir)) {
for (int x2 = -1; x2 <= 1; x2 += 2)
possibilities.add(new Vec3(mc.thePlayer.posX + x + x2, mc.thePlayer.posY + y, mc.thePlayer.posZ + z));
for (int y2 = -1; y2 <= 1; y2 += 2)
possibilities.add(new Vec3(mc.thePlayer.posX + x, mc.thePlayer.posY + y + y2, mc.thePlayer.posZ + z));
for (int z2 = -1; z2 <= 1; z2 += 2)
possibilities.add(new Vec3(mc.thePlayer.posX + x, mc.thePlayer.posY + y, mc.thePlayer.posZ + z + z2));
}
}
}
}
possibilities.removeIf(vec3 -> !(PlayerUtil.getBlock(vec3.xCoord, vec3.yCoord, vec3.zCoord) instanceof BlockAir) || (mc.thePlayer.posX == vec3.xCoord && mc.thePlayer.posY + 1 == vec3.yCoord && mc.thePlayer.posZ == vec3.zCoord));
return possibilities;
}
}
// NOTE (AI): Rise 5.99's flagship scaffold: silent C09 switch (line ~856), cancelled C09 echoes (line ~804), C0B sneaking for eagle (lines ~414-421), placement send at line ~894. The full file shows the complete state machine: tower, eagle, sprint, rotations.
Send the invalid-position C08 (pos -1,-1,-1, face 255) so the server starts the item-use (blocking) state while the aura attacks.
Inside the aura's attack tick, before or after the C02 attack packet, send new C08PacketPlayerBlockPlacement(new BlockPos(-1, -1, -1), 255, heldItem, 0, 0, 0). The server's direction==255 branch runs tryUseItem, which sets isBlocking/isUsingItem on the player entity, giving damage reduction. Memeware's SingleAura sends it via PacketUtil.sendPacket with the current held item.
// ===== 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 SingleAura: line ~41 sends the invalid-position C08 with face 255 to enter the blocking state. The file is the complete single-target aura with target validation and the autoblock send.
Keep the server-side item-use state alive so eating/blocking does not slow the player, or cancel the slowdown server-side by re-sending C08.
While mc.thePlayer.isUsingItem(), repeatedly send new C08PacketPlayerBlockPlacement(currentEquippedItem) (the 255 item-use form) so the server keeps the use state and the client's movement speed is not reduced. Rise 5.99 NoSlow sends it from the motion event and cancels the vanilla slowdown; Rise 6.x splits into per-AC modes (NCP, Intave, Watchdog, Grim, Legit) that vary the packet rate and whether the item-use C08 or a click-window trick is used.
// ===== FILE: Rise 5.99, dev/rise/module/impl/movement/NoSlow.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.movement;
import dev.rise.Rise;
import dev.rise.event.impl.motion.PostMotionEvent;
import dev.rise.event.impl.motion.PreMotionEvent;
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.combat.Aura;
import dev.rise.setting.impl.ModeSetting;
import dev.rise.setting.impl.NumberSetting;
import dev.rise.util.math.TimeUtil;
import dev.rise.util.player.PacketUtil;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import org.lwjgl.input.Mouse;
/**
* Makes you automatically sprint without pressing the sprint key.
* <p>
* Wtf is this description
*/
@ModuleInfo(name = "NoSlow", description = "Prevents you from slowing down when using items", category = Category.MOVEMENT)
public final class NoSlow extends Module {
private final ModeSetting mode = new ModeSetting("Mode", this, "Vanilla", "Vanilla", "NCP", "Reverse NCP", "Hypixel", "Delay", "Intave");
public final NumberSetting slowdown = new NumberSetting("Slowdown", this, 0, 0, 80, 1);
//EntityPlayerSP 783
private boolean aBoolean, blocking, intaveFunnyBoolean;
private final TimeUtil timer = new TimeUtil();
private long delay;
private int ticks;
@Override
protected void onEnable() {
ticks = 0;
blocking = false;
}
@Override
public void onPacketReceive(final PacketReceiveEvent event) {
final Packet<?> p = event.getPacket();
}
@Override
public void onPreMotion(final PreMotionEvent event) {
switch (mode.getMode()) {
case "NCP": {
if (mc.thePlayer.isBlocking()) {
mc.playerController.syncCurrentPlayItem();
PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
}
break;
}
case "Hypixel": {
if (mc.thePlayer.isBlocking()) {
mc.gameSettings.keyBindUseItem.setKeyPressed(true);
}
break;
}
case "Delay": {
if (!mc.thePlayer.isBlocking()) aBoolean = false;
if (mc.thePlayer.isBlocking() && mc.thePlayer.ticksExisted % 5 == 0 && aBoolean) {
mc.playerController.syncCurrentPlayItem();
PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
aBoolean = false;
}
if (mc.thePlayer.isBlocking() && mc.thePlayer.ticksExisted % 5 == 1 && !aBoolean) {
mc.playerController.syncCurrentPlayItem();
PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(mc.thePlayer.getCurrentEquippedItem()));
aBoolean = true;
}
break;
}
case "Reverse NCP": {
if (mc.thePlayer.isBlocking()) {
mc.playerController.syncCurrentPlayItem();
PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(mc.thePlayer.getCurrentEquippedItem()));
}
break;
}
case "Intave":
if (mc.thePlayer.isBlocking() && timer.hasReached(delay)) {
mc.playerController.syncCurrentPlayItem();
PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
}
break;
}
}
@Override
public void onPostMotion(final PostMotionEvent event) {
switch (mode.getMode()) {
case "NCP": {
if (mc.thePlayer.isBlocking()) {
mc.playerController.syncCurrentPlayItem();
PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(mc.thePlayer.getCurrentEquippedItem()));
}
break;
}
// case "Hypixel": {
// if (mc.thePlayer.isBlocking()) {
// mc.playerController.syncCurrentPlayItem();
// PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(mc.thePlayer.getCurrentEquippedItem()));
// PacketUtil.sendPacket(new C03PacketPlayer(mc.thePlayer.onGround));
// PacketUtil.sendPacket(new C03PacketPlayer(mc.thePlayer.onGround));
// PacketUtil.sendPacket(new C03PacketPlayer(mc.thePlayer.onGround));
// }
// break;
// }
case "Reverse NCP": {
if (mc.thePlayer.isBlocking()) {
mc.playerController.syncCurrentPlayItem();
PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
}
break;
}
case "Intave":
if (mc.thePlayer.isBlocking() && timer.hasReached(delay)) {
mc.playerController.syncCurrentPlayItem();
PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
delay = 200;
if (intaveFunnyBoolean) {
delay = 100;
intaveFunnyBoolean = false;
} else
intaveFunnyBoolean = true;
timer.reset();
}
break;
}
}
}
// NOTE (AI): Rise 5.99 NoSlow: sends the item-use C08 (single-arg constructor, line ~87/97/120) from the movement handler while using an item. Complete file with mode toggles.
Consume potions, soup, gaps or heads faster than vanilla allows by spamming the item-use C08.
Scan the hotbar/inventory for the consumable, switch to its slot with C09, then send the C08 item-use form every tick (or on a cooldown) so the server processes the consumption without waiting for the client's use-tick timer. Rise 5.99 AutoPot switches to the potion slot with C09 and sends new C08PacketPlayerBlockPlacement(itemStack); Memeware AutoPotion does the same with the raw stack from the slot.
// ===== FILE: Rise 5.99, dev/rise/module/impl/combat/AutoPot.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.Rise;
import dev.rise.event.impl.motion.PreMotionEvent;
import dev.rise.module.Module;
import dev.rise.module.api.ModuleInfo;
import dev.rise.module.enums.Category;
import dev.rise.setting.impl.BooleanSetting;
import dev.rise.setting.impl.NumberSetting;
import dev.rise.util.player.PacketUtil;
import dev.rise.util.player.PlayerUtil;
import net.minecraft.block.BlockAir;
import net.minecraft.block.BlockLadder;
import net.minecraft.item.Item;
import net.minecraft.item.ItemPotion;
import net.minecraft.item.ItemStack;
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.C09PacketHeldItemChange;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import org.apache.commons.lang3.RandomUtils;
import java.util.ArrayList;
import java.util.Objects;
@ModuleInfo(name = "AutoPot", description = "Throws potions for you", category = Category.COMBAT)
public final class AutoPot extends Module {
private final NumberSetting minHealth = new NumberSetting("Health", this, 15, 1, 20, 1);
private final BooleanSetting randomiseRots = new BooleanSetting("Randomise Rotations", this, true);
private final BooleanSetting packet = new BooleanSetting("Extra Packet", this, false);
private final BooleanSetting jump = new BooleanSetting("Jump", this, false);
private int ticksSinceLastSplash, ticksSinceCanSplash, oldSlot;
private boolean needSplash, switchBack;
private final ArrayList<Integer> acceptedPotions = new ArrayList() {{
add(6);
add(1);
add(5);
add(8);
add(14);
add(12);
add(10);
add(16);
}};
@Override
public void onDisable() {
needSplash = switchBack = false;
}
@Override
public void onPreMotion(final PreMotionEvent event) {
ticksSinceLastSplash++;
if (Objects.requireNonNull(Rise.INSTANCE.getModuleManager().getModule("Scaffold")).isEnabled() || mc.thePlayer.isInLiquid() || (PlayerUtil.getBlockRelativeToPlayer(0, -1, 0) instanceof BlockAir || PlayerUtil.getBlockRelativeToPlayer(0, -1, 0) instanceof BlockLadder))
ticksSinceCanSplash = 0;
else
ticksSinceCanSplash++;
if (switchBack) {
PacketUtil.sendPacket(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
PacketUtil.sendPacket(new C09PacketHeldItemChange(oldSlot));
switchBack = false;
return;
}
if (ticksSinceCanSplash <= 1 || !mc.thePlayer.onGround)
return;
oldSlot = mc.thePlayer.inventory.currentItem;
for (int i = 36; i < 45; ++i) {
final ItemStack itemStack = mc.thePlayer.inventoryContainer.getSlot(i).getStack();
if (itemStack != null && mc.currentScreen == null) {
final Item item = itemStack.getItem();
if (item instanceof ItemPotion) {
final ItemPotion p = (ItemPotion) item;
if (ItemPotion.isSplash(itemStack.getMetadata())) {
if (p.getEffects(itemStack.getMetadata()) != null) {
final int potionID = p.getEffects(itemStack.getMetadata()).get(0).getPotionID();
boolean hasPotionIDActive = false;
for (final PotionEffect potion : mc.thePlayer.getActivePotionEffects()) {
if (potion.getPotionID() == potionID && potion.getDuration() > 0) {
hasPotionIDActive = true;
break;
}
}
if (acceptedPotions.contains(potionID) && !hasPotionIDActive && ticksSinceLastSplash > 20) {
final String effectName = p.getEffects(itemStack.getMetadata()).get(0).getEffectName();
if ((effectName.contains("regeneration") || effectName.contains("heal")) && mc.thePlayer.getHealth() > minHealth.getValue())
continue;
if (jump.isEnabled()) {
event.setPitch(randomiseRots.isEnabled() ? -RandomUtils.nextFloat(89, 90) : -90);
if (!needSplash) {
mc.thePlayer.jump();
needSplash = true;
new Thread(() -> {
try {
Thread.sleep(300L); // TODO: fix
} catch (final InterruptedException e) {
e.printStackTrace();
}
if (packet.isEnabled())
PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, randomiseRots.isEnabled() ? -RandomUtils.nextFloat(89, 90) : -90, mc.thePlayer.onGround));
needSplash = false;
}).start();
} else {
event.setPitch(randomiseRots.isEnabled() ? RandomUtils.nextFloat(89, 90) : 90);
if(event.getPitch() > 88) {
PacketUtil.sendPacket(new C09PacketHeldItemChange(i - 36));
PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(itemStack));
switchBack = true;
ticksSinceLastSplash = 0;
needSplash = false;
}
}
} else {
event.setPitch(randomiseRots.isEnabled() ? RandomUtils.nextFloat(89, 90) : 90);
if (!needSplash) {
if (packet.isEnabled())
PacketUtil.sendPacketWithoutEvent(new C03PacketPlayer.C06PacketPlayerPosLook(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ, mc.thePlayer.rotationYaw, randomiseRots.isEnabled() ? RandomUtils.nextFloat(89, 90) : 90, mc.thePlayer.onGround));
needSplash = true;
} else {
event.setPitch(randomiseRots.isEnabled() ? RandomUtils.nextFloat(89, 90) : 90);
if(event.getPitch() > 88) {
PacketUtil.sendPacket(new C09PacketHeldItemChange(i - 36));
PacketUtil.sendPacket(new C08PacketPlayerBlockPlacement(itemStack));
switchBack = true;
ticksSinceLastSplash = 0;
needSplash = false;
}
}
}
return;
}
}
}
}
}
}
}
}
// NOTE (AI): Rise 5.99 AutoPot: full file. Lines ~126-144 send the item-use C08 for the potion while C09 (line ~72/126/143) switches slots, letting the module drink multiple pots in the time vanilla would drink one.
Eat golden heads faster than vanilla allows using the C09 + C08 + C09 packet triple, with a key-binding path for golden apples.
Below the health threshold with no mouse held, find a head (id 397) or apple (id 322) in the hotbar. For heads, send C09(slot), C08(use, current item), C09(back) with a delay gate. For apples, set inventory.currentItem and press the real use-item key, restoring the slot on release.
// ===== FILE: LiquidSense Dev, me/AquaVit/liquidSense/modules/combat/AutoHead.java =====
package me.AquaVit.liquidSense.modules.combat;
import net.ccbluex.liquidbounce.event.EventTarget;
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.value.BoolValue;
import net.ccbluex.liquidbounce.value.IntegerValue;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
import net.minecraft.network.play.client.C09PacketHeldItemChange;
import net.minecraft.potion.Potion;
import net.ccbluex.liquidbounce.event.MotionEvent;
import net.ccbluex.liquidbounce.utils.timer.TimeUtils;
import net.ccbluex.liquidbounce.value.FloatValue;
import org.lwjgl.input.Mouse;
import java.util.Random;
@ModuleInfo(name = "AutoHead", description = "AutoHead", category = ModuleCategory.COMBAT)
public class AutoHead extends Module {
private boolean eatingApple;
private int switched = -1;
public static boolean doingStuff = false;
private final TimeUtils timer = new TimeUtils();
private final BoolValue eatHeads = new BoolValue("EatHead", true);
private final BoolValue eatApples = new BoolValue("EatApples", true);
private final FloatValue health = new FloatValue("Health", 10.0F, 1.0F, 20.0F);
private final IntegerValue delay = new IntegerValue("Delay", 750, 100, 2000);
@Override
public void onEnable() {
this.eatingApple = doingStuff = false;
switched = -1;
timer.reset();
super.onEnable();
}
@Override
public void onDisable() {
doingStuff = false;
if (eatingApple) {
repairItemPress();
repairItemSwitch();
}
super.onDisable();
}
private void repairItemPress() {
if (mc.gameSettings != null) {
final KeyBinding keyBindUseItem = mc.gameSettings.keyBindUseItem;
if (keyBindUseItem != null) keyBindUseItem.pressed = false;
}
}
@EventTarget
public void onUpdate(MotionEvent event) {
if (mc.thePlayer == null) return;
final InventoryPlayer inventory = mc.thePlayer.inventory;
if (inventory == null) return;
doingStuff = false;
if (!Mouse.isButtonDown(0) && !Mouse.isButtonDown(1)) {
final KeyBinding useItem = mc.gameSettings.keyBindUseItem;
if (!this.timer.hasReached(delay.get())) {
eatingApple = false;
repairItemPress();
repairItemSwitch();
return;
}
if (mc.thePlayer.capabilities.isCreativeMode || mc.thePlayer.isPotionActive(Potion.regeneration) ||mc.thePlayer.getHealth() >= health.get()) {
this.timer.reset();
if (eatingApple) {
eatingApple = false;
repairItemPress();
repairItemSwitch();
}
return;
}
for (int i = 0; i < 2; i++) {
final boolean doEatHeads = i != 0;
if (doEatHeads) {
if (!this.eatHeads.get()) continue;
} else {
if (!this.eatApples.get()) {
eatingApple = false;
repairItemPress();
repairItemSwitch();
continue;
}
}
int slot;
if (doEatHeads) {
slot = this.getItemFromHotbar(397);
} else {
slot = this.getItemFromHotbar(322);
}
if (slot == -1) continue;
final int tempSlot = inventory.currentItem;
doingStuff = true;
if (doEatHeads) {
mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange(slot));
mc.thePlayer.sendQueue.addToSendQueue(new C08PacketPlayerBlockPlacement(inventory.getCurrentItem()));
mc.thePlayer.sendQueue.addToSendQueue(new C09PacketHeldItemChange(tempSlot));
timer.reset();
} else {
inventory.currentItem = slot;
useItem.pressed = true;
if (eatingApple) continue; // no message spam
eatingApple = true;
this.switched = tempSlot;
}
}
}
}
private void repairItemSwitch() {
final EntityPlayerSP p = mc.thePlayer;
if (p == null) return;
final InventoryPlayer inventory = p.inventory;
if (inventory == null) return;
int switched = this.switched;
if (switched == -1) return;
inventory.currentItem = switched;
switched = -1;
this.switched = switched;
}
private int getItemFromHotbar(final int id) {
for (int i = 0; i < 9; i++) {
if (mc.thePlayer.inventory.mainInventory[i] != null) {
final ItemStack is = mc.thePlayer.inventory.mainInventory[i];
final Item item = is.getItem();
if (Item.getIdFromItem(item) == id) {
return i;
}
}
}
return -1;
}
}
// NOTE (AI): The head path is the C09 + C08 + C09 triple: switch to the head slot, send the item-use C08 with the now-held stack, switch back. The apple path instead presses the real use-item key and restores the slot on release, so the two consumables use different desync strategies.
Equip the best armor automatically; the hotbar path equips through the C08 placement form with a C09 switch pair around it.
On Render3D, compute the best piece per armor type with ArmorComparator. move() for hotbar items sends C09(item), C08(placement with the slot's stack), C09(current); other items go through C16 open-inventory, windowClick and C0D close, all gated by InventoryUtils.CLICK_TIMER and a random delay.
// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/combat/AutoArmor.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.combat;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.Render3DEvent;
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.injection.implementations.IItemStack;
import net.ccbluex.liquidbounce.utils.InventoryUtils;
import net.ccbluex.liquidbounce.utils.MovementUtils;
import net.ccbluex.liquidbounce.utils.item.ArmorComparator;
import net.ccbluex.liquidbounce.utils.item.ArmorPiece;
import net.ccbluex.liquidbounce.utils.timer.TimeUtils;
import net.ccbluex.liquidbounce.value.BoolValue;
import net.ccbluex.liquidbounce.value.IntegerValue;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
import net.minecraft.network.play.client.C09PacketHeldItemChange;
import net.minecraft.network.play.client.C0DPacketCloseWindow;
import net.minecraft.network.play.client.C16PacketClientStatus;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
@ModuleInfo(name = "AutoArmor", description = "Automatically equips the best armor in your inventory.", category = ModuleCategory.COMBAT)
public class AutoArmor extends Module {
public static final ArmorComparator ARMOR_COMPARATOR = new ArmorComparator();
private final IntegerValue maxDelayValue = new IntegerValue("MaxDelay", 200, 0, 400) {
@Override
protected void onChanged(final Integer oldValue, final Integer newValue) {
final int minDelay = minDelayValue.get();
if (minDelay > newValue) set(minDelay);
}
};
private final IntegerValue minDelayValue = new IntegerValue("MinDelay", 100, 0, 400) {
@Override
protected void onChanged(final Integer oldValue, final Integer newValue) {
final int maxDelay = maxDelayValue.get();
if (maxDelay < newValue) set(maxDelay);
}
};
private final BoolValue invOpenValue = new BoolValue("InvOpen", false);
private final BoolValue simulateInventory = new BoolValue("SimulateInventory", true);
private final BoolValue noMoveValue = new BoolValue("NoMove", false);
private final IntegerValue itemDelayValue = new IntegerValue("ItemDelay", 0, 0, 5000);
private final BoolValue hotbarValue = new BoolValue("Hotbar", true);
private long delay;
@EventTarget
public void onRender3D(final Render3DEvent event) {
if ((mc.thePlayer.capabilities.allowFlying && mc.thePlayer.capabilities.isFlying) || !InventoryUtils.CLICK_TIMER.hasTimePassed(delay) ||
(mc.thePlayer.openContainer != null && mc.thePlayer.openContainer.windowId != 0))
return;
// Find best armor
final Map<Integer, List<ArmorPiece>> armorPieces = IntStream.range(0, 36).filter(i -> {
final ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);
return itemStack != null && itemStack.getItem() instanceof ItemArmor && (i < 9 || System.currentTimeMillis() - ((IItemStack) (Object) itemStack).getItemDelay() >= itemDelayValue.get());
})
.mapToObj(i -> new ArmorPiece(mc.thePlayer.inventory.getStackInSlot(i), i))
.collect(Collectors.groupingBy(ArmorPiece::getArmorType));
final ArmorPiece[] bestArmor = new ArmorPiece[4];
for (final Map.Entry<Integer, List<ArmorPiece>> armorEntry : armorPieces.entrySet()) {
bestArmor[armorEntry.getKey()] = armorEntry.getValue().stream()
.max(ARMOR_COMPARATOR).orElse(null);
}
// Swap armor
for (int i = 0; i < 4; i++) {
final ArmorPiece armorPiece = bestArmor[i];
if (armorPiece == null)
continue;
int armorSlot = 3 - i;
final ArmorPiece oldArmor = new ArmorPiece(mc.thePlayer.inventory.armorItemInSlot(armorSlot), -1);
if (oldArmor.getItemStack() == null || !(oldArmor.getItemStack().getItem() instanceof ItemArmor) ||
ARMOR_COMPARATOR.compare(oldArmor, armorPiece) < 0) {
if (oldArmor.getItemStack() != null && move(8 - armorSlot, true))
return;
if (move(armorPiece.getSlot(), false))
return;
}
}
}
/**
* Shift+Left clicks the specified item
*
* @param item Slot of the item to click
* @param isArmorSlot
* @return True if it is unable to move the item
*/
private boolean move(int item, boolean isArmorSlot) {
if (!isArmorSlot && item < 9 && hotbarValue.get()) {
mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(item));
mc.getNetHandler().addToSendQueue(new C08PacketPlayerBlockPlacement(mc.thePlayer.inventoryContainer.getSlot(item).getStack()));
mc.getNetHandler().addToSendQueue(new C09PacketHeldItemChange(mc.thePlayer.inventory.currentItem));
delay = TimeUtils.randomDelay(minDelayValue.get(), maxDelayValue.get());
return true;
} else if (!(noMoveValue.get() && MovementUtils.isMoving()) && (!invOpenValue.get() || mc.currentScreen instanceof GuiInventory) && item != -1) {
final boolean openInventory = simulateInventory.get() && !(mc.currentScreen instanceof GuiInventory);
if (openInventory)
mc.getNetHandler().addToSendQueue(new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));
mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, isArmorSlot ? item : (item < 9 ? item + 36 : item), 0, 1, mc.thePlayer);
delay = TimeUtils.randomDelay(minDelayValue.get(), maxDelayValue.get());
if (openInventory)
mc.getNetHandler().addToSendQueue(new C0DPacketCloseWindow());
return true;
}
return false;
}
}
// NOTE (AI): The move() method is the C08 and C09 hit: for hotbar armor it sends C09 to the item slot, the C08 placement with the slot's stack (which equips the armor server-side), then C09 back to the current slot. Non-hotbar items go through C16 open inventory, windowClick and C0D close, all gated by InventoryUtils.CLICK_TIMER so clicks never overlap.
Hold C08 (and the whole movement and action set) while blinking, replaying the queue on pulse or disable.
PacketEvent cancels C03 plus the C04/C06/C08/C0A/C0B/C02 set and parks them in a LinkedBlockingQueue; pulse mode flushes on a 500-5000 ms timer, disable flushes everything through the network manager with a disableLogger guard so the flush does not re-trigger the listener.
// ===== 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 onPacket handler cancels C03 and the C04/C06/C08/C0A/C0B/C02 set and parks them in a LinkedBlockingQueue; the blink() flush sends them via the network manager directly, guarded by disableLogger so the flush does not re-trigger the listener. Pulse mode flushes on a 500-5000 ms timer.
Auto-join the next game: BLOCKS_MC mode finds the paper item in the hotbar, clicks it with the C09/C08 pair, and restores the slot.
Scan the hotbar for Items.paper, send C09(paperSlot) and the item-use C08 silently, then InventoryManager.sync(). The HYPIXEL and MUSH_MC modes instead re-send the play command extracted from the win/lose chat click event, and never touch C08.
// ===== FILE: November Recode 2.0, feature/module/impl/player/AutoPlayModule.java =====
/* November.lol © 2023 */
package lol.november.feature.module.impl.player;
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.net.EventPacket;
import lol.november.listener.event.player.EventUpdate;
import lol.november.utility.math.timer.Timer;
import net.minecraft.event.ClickEvent;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.network.play.client.C01PacketChatMessage;
import net.minecraft.network.play.client.C08PacketPlayerBlockPlacement;
import net.minecraft.network.play.client.C09PacketHeldItemChange;
import net.minecraft.network.play.server.S02PacketChat;
import net.minecraft.network.play.server.S45PacketTitle;
import net.minecraft.util.IChatComponent;
/**
* @author Gavin
* @since 2.0.0
*/
@Register(
name = "AutoPlay",
description = "Automatically plays the next game for you",
category = Category.PLAYER
)
public class AutoPlayModule extends Module {
private final Setting<Mode> mode = new Setting<>("Mode", Mode.HYPIXEL);
private final Setting<Double> delay = new Setting<>(
"Delay",
1.5,
0.01,
0.0,
5.0
);
private final Timer timer = new Timer();
private String playCommand;
private int paperSlot;
@Override
public void disable() {
super.disable();
playCommand = null;
if (mode.getValue() == Mode.BLOCKS_MC && paperSlot != -1) {
November.instance().inventory().sync();
}
paperSlot = -1;
}
@Subscribe
private final Listener<EventUpdate> update = event -> {
if (mc.thePlayer.ticksExisted < 10) {
paperSlot = -1;
playCommand = null;
return;
}
if (mode.getValue() == Mode.HYPIXEL || mode.getValue() == Mode.MUSH_MC) {
if (
playCommand == null ||
!timer.passed(delay.getValue().longValue() * 1000L)
) return;
timer.reset();
mc.thePlayer.sendQueue.addToSendQueueSilent(
new C01PacketChatMessage(playCommand)
);
} else if (mode.getValue() == Mode.BLOCKS_MC) {
if (paperSlot == -1) {
for (int i = 0; i < 9; ++i) {
ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);
if (itemStack != null && itemStack.getItem() == Items.paper) {
paperSlot = i;
timer.reset();
break;
}
}
return;
}
if (!timer.passed(delay.getValue().longValue() * 1000L)) return;
timer.reset();
mc.thePlayer.sendQueue.addToSendQueueSilent(
new C09PacketHeldItemChange(paperSlot)
);
mc.thePlayer.sendQueue.addToSendQueueSilent(
new C08PacketPlayerBlockPlacement(
November.instance().inventory().itemStack()
)
);
November.instance().inventory().sync();
}
};
@Subscribe
private final Listener<EventPacket.In> packetIn = event -> {
if (mode.getValue() == Mode.HYPIXEL) {
if (event.get() instanceof S02PacketChat packet) {
if (packet.getChatComponent() == null) return;
String raw = packet.getChatComponent().getUnformattedText();
if (
raw.contains("You won! Want to play again? Click here! ") ||
raw.contains("You died! Want to play again? Click here! ")
) {
timer.reset();
for (IChatComponent component : packet
.getChatComponent()
.getSiblings()) {
if (
component.getUnformattedText().contains("Click here!") &&
component.getChatStyle().getChatClickEvent() != null
) {
ClickEvent clickEvent = component
.getChatStyle()
.getChatClickEvent();
if (clickEvent.getAction() == ClickEvent.Action.RUN_COMMAND) {
playCommand = clickEvent.getValue();
timer.reset();
return;
}
}
}
}
} else if (event.get() instanceof S45PacketTitle packet) {
if (packet.getMessage() == null) return;
}
}
};
private enum Mode {
HYPIXEL,
BLOCKS_MC,
MUSH_MC,
}
}
// NOTE (AI): The BLOCKS_MC branch is the C08 and C09 hit: it scans the hotbar for paper, sends C09 to the paper slot and the item-use C08, then calls InventoryManager.sync() to restore the visible slot. The HYPIXEL branch never sends C08; it re-sends the play command from the chat click event.
anticheat Anti-Cheat Checks
The block placement packet reports a position, face, cursor vector and held item, and it doubles as the use-item packet. Anticheats use it to validate placement reach and rotation (Grim FarPlace), the hit vector of scaffold clicks (FlopAC ScaffoldA), placement speed and direction (NCP blockplace suite), and the item actually held (Negativity Scaffold). Because scaffolding cheats click the top face center of the block below at full speed, placement checks are the server-side counter to scaffold modules.
Reach check for block placement: verifies that the placed block is within the player's block interaction range.
A BlockPlaceCheck listening on the BlockPlace update produced from the packet. It iterates every possible eye height, cuts a collision box for the placed block to the player position vector, and takes the minimum squared distance. The threshold is the BLOCK_INTERACTION_RANGE attribute plus the movement threshold hypot component, with scaffolding blocks exempt. On a flag it resyncs the player when packet modification is allowed.
// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/checks/impl/scaffolding/FarPlace.java =====
package ac.grim.grimac.checks.impl.scaffolding;
import ac.grim.grimac.checks.CheckData;
import ac.grim.grimac.checks.type.BlockPlaceCheck;
import ac.grim.grimac.checks.type.BlockPlaceListener;
import ac.grim.grimac.player.GrimPlayer;
import ac.grim.grimac.utils.anticheat.update.BlockPlace;
import ac.grim.grimac.utils.collisions.datatypes.SimpleCollisionBox;
import ac.grim.grimac.utils.math.Vector3dm;
import ac.grim.grimac.utils.math.VectorUtils;
import com.github.retrooper.packetevents.protocol.attribute.Attributes;
import com.github.retrooper.packetevents.protocol.world.states.type.StateTypes;
import com.github.retrooper.packetevents.util.Vector3i;
@CheckData(name = "FarPlace", stableKey = "grim.scaffolding.far_place", description = "Placing blocks from too far away")
public class FarPlace extends BlockPlaceCheck implements BlockPlaceListener {
public FarPlace(GrimPlayer player) {
super(player);
}
@Override
public void onBlockPlace(final BlockPlace place) {
if (!player.cameraEntity.isSelf() || player.inVehicle()) return;
Vector3i blockPos = place.position;
if (place.material == StateTypes.SCAFFOLDING) return;
double min = Double.MAX_VALUE;
final double[] possibleEyeHeights = player.getPossibleEyeHeights();
for (double d : possibleEyeHeights) {
SimpleCollisionBox box = new SimpleCollisionBox(blockPos);
Vector3dm best = VectorUtils.cutBoxToVector(player.x, player.y + d, player.z, box);
min = Math.min(min, best.distanceSquared(player.x, player.y + d, player.z));
}
// getPickRange() determines this?
// With 1.20.5+ the new attribute determines creative mode reach using a modifier
double maxReach = player.compensatedEntities.self.getAttributeValue(Attributes.BLOCK_INTERACTION_RANGE);
double threshold = player.getMovementThreshold();
maxReach += Math.hypot(threshold, threshold);
if (min > maxReach * maxReach) { // fail
if (flag() && shouldModifyPackets() && shouldCancel()) {
place.resync();
}
}
}
}
// NOTE (AI): FarPlace measures the distance from every possible eye height to the placed block against the block interaction range attribute; the scaffolding package adds rotation, position, invalid face and multi-place checks over the same BlockPlace pipeline.
Silent-scaffold detection through item mismatch: the placed block must match the block held at click time.
On BlockPlaceEvent it schedules a deferred task one tick later and compares the placed block type against the item in hand. If the hotbar slot changed or the held item is not a block matching the placement, it alerts with a confidence score derived from the player ping and, when a setback is configured, removes the placed block and refunds the item.
// ===== FILE: Elikill58-Negativity, src/com/elikill58/negativity/spigot/protocols/ScaffoldProtocol.java =====
package com.elikill58.negativity.spigot.protocols;
import java.util.Locale;
import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.inventory.ItemStack;
import com.elikill58.negativity.spigot.SpigotNegativity;
import com.elikill58.negativity.spigot.SpigotNegativityPlayer;
import com.elikill58.negativity.spigot.utils.ItemUtils;
import com.elikill58.negativity.universal.Cheat;
import com.elikill58.negativity.universal.CheatKeys;
import com.elikill58.negativity.universal.ReportType;
import com.elikill58.negativity.universal.utils.UniversalUtils;
public class ScaffoldProtocol extends Cheat implements Listener {
private ScaffoldProtocol instance;
public ScaffoldProtocol() {
super(CheatKeys.SCAFFOLD, false, ItemUtils.GRASS, CheatCategory.WORLD, true);
instance = this;
}
@SuppressWarnings("deprecation")
@EventHandler (ignoreCancelled = true)
public void onBlockBreak(BlockPlaceEvent e) {
Player p = e.getPlayer();
SpigotNegativityPlayer np = SpigotNegativityPlayer.getNegativityPlayer(p);
if (!np.hasDetectionActive(this))
return;
int slot = p.getInventory().getHeldItemSlot();
if(np.ping > 120)
return;
Bukkit.getScheduler().runTaskLater(SpigotNegativity.getInstance(), new Runnable() {
@Override
public void run() {
Material m = p.getItemInHand().getType(), placed = e.getBlockPlaced().getType();
if ((m == null || (!m.isBlock() && !m.equals(placed))) && slot != p.getInventory().getHeldItemSlot() && !placed.equals(Material.AIR)) {
int localPing = np.ping;
if(localPing == 0)
localPing = 1;
boolean mayCancel = SpigotNegativity.alertMod(ReportType.WARNING, p, instance, UniversalUtils.parseInPorcent(120 / localPing),
"Item in hand: " + m.name() + " Block placed: " + placed.name(),
hoverMsg("main", "%item%", m.name().toLowerCase(Locale.ROOT), "%block%", placed.name().toLowerCase(Locale.ROOT)));
if(isSetBack() && mayCancel) {
p.getInventory().addItem(new ItemStack(placed));
e.getBlockPlaced().setType(Material.AIR);
}
}
}
}, 0);
}
}
// NOTE (AI): Negativity's ScaffoldProtocol is a Bukkit-event listener keyed to PlayerInteractEvent/PlayerMoveEvent rather than raw packets; it tracks the number of blocks placed per second while moving and flags scaffold-style placement rates.
The classic dispatcher for NCP's placement checks: direction, fast place, reach, no swing and against-world.
Registers Direction, FastPlace, Reach, NoSwing and AgainstWorld checks with per-player config and data classes, listening to Bukkit placement events plus the PacketPlayInBlockPlace stream via the ProtocolLib UseItemAdapter. FastPlace tracks placement timing per block, Reach measures the distance to the placed position, and Direction validates the face against the player's look vector.
// ===== FILE: Updated-NoCheatPlus-NoCheatPlus, NCPCore/src/main/java/fr/neatmonster/nocheatplus/checks/blockplace/BlockPlaceListener.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.blockplace;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.Material;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.entity.Projectile;
import org.bukkit.event.Event.Result;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.block.Action;
import org.bukkit.event.block.BlockPlaceEvent;
import org.bukkit.event.block.SignChangeEvent;
import org.bukkit.event.entity.ProjectileLaunchEvent;
import org.bukkit.event.player.PlayerAnimationEvent;
import org.bukkit.event.player.PlayerInteractEvent;
import org.bukkit.event.player.PlayerMoveEvent;
import org.bukkit.event.player.PlayerSignOpenEvent;
import org.bukkit.event.player.PlayerSignOpenEvent.Cause;
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.combined.Combined;
import fr.neatmonster.nocheatplus.checks.combined.CombinedConfig;
import fr.neatmonster.nocheatplus.checks.combined.Improbable;
import fr.neatmonster.nocheatplus.checks.moving.MovingConfig;
import fr.neatmonster.nocheatplus.checks.moving.MovingData;
import fr.neatmonster.nocheatplus.checks.moving.model.PlayerMoveData;
import fr.neatmonster.nocheatplus.checks.net.FlyingQueueHandle;
import fr.neatmonster.nocheatplus.checks.net.model.DataPacketFlying;
import fr.neatmonster.nocheatplus.compat.bukkit.BridgeEntityType;
import fr.neatmonster.nocheatplus.compat.Bridge1_9;
import fr.neatmonster.nocheatplus.compat.BridgeMisc;
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.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.ReflectionUtil;
import fr.neatmonster.nocheatplus.utilities.TickTask;
import fr.neatmonster.nocheatplus.utilities.map.BlockFlags;
import fr.neatmonster.nocheatplus.utilities.map.BlockProperties;
import fr.neatmonster.nocheatplus.utilities.map.MaterialUtil;
import fr.neatmonster.nocheatplus.utilities.math.TrigUtil;
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 place checks.
*
* @see BlockPlaceEvent
*/
public class BlockPlaceListener extends CheckListener {
/** Surrounding material check. */
private final Against against = addCheck(new Against());
/** AutoSign hack check. */
private final AutoSign autoSign = addCheck(new AutoSign());
/** The direction check. */
private final Direction direction = addCheck(new Direction());
/** The fast place check. */
private final FastPlace fastPlace = addCheck(new FastPlace());
/** The no swing check. */
private final NoSwing noSwing = addCheck(new NoSwing());
/** The reach check. */
private final Reach reach = addCheck(new Reach());
/** The scaffold check. */
private final Scaffold scaffold = addCheck(new Scaffold());
/** The speed check. */
private final Speed speed = addCheck(new Speed());
/** For temporary use: LocUtil.clone before passing deeply, call setWorld(null) after use. */
private final Location useLoc = new Location(null, 0, 0, 0);
private final Location useLoc2 = new Location(null, 0, 0, 0);
// Counter/debug stuff
private final Counters counters = NCPAPIProvider.getNoCheatPlusAPI().getGenericInstance(Counters.class);
private final int idBoatsOnWaterOnly = counters.registerKey("boatsonwateronly");
private final int idEnderPearl = counters.registerKey("throwenderpearl");
// Reflection stuff
private final Class<?> blockMultiPlaceEvent = ReflectionUtil.getClass("org.bukkit.event.block.BlockMultiPlaceEvent");
private final boolean hasPlayerSignOpenEvent = ReflectionUtil.getClass("org.bukkit.event.player.PlayerSignOpenEvent") != null;
private final boolean hasGetReplacedState = ReflectionUtil.getMethodNoArgs(BlockPlaceEvent.class, "getReplacedState", BlockState.class) != null;
public final List<BlockFace> faces = Arrays.asList(new BlockFace[] {BlockFace.SOUTH, BlockFace.WEST, BlockFace.EAST, BlockFace.NORTH});
@SuppressWarnings("unchecked")
public BlockPlaceListener() {
super(CheckType.BLOCKPLACE);
final NoCheatPlusAPI api = NCPAPIProvider.getNoCheatPlusAPI();
if (hasPlayerSignOpenEvent) {
queuedComponents.add(new Listener() {
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onOpeningSign1_20(final PlayerSignOpenEvent event) {
handleSignOpenEvent(event.getPlayer(), event.getCause());
}
});
}
api.register(api.newRegistrationContext()
// BlockPlaceConfig
.registerConfigWorld(BlockPlaceConfig.class)
.factory(new IFactoryOne<WorldFactoryArgument, BlockPlaceConfig>() {
@Override
public BlockPlaceConfig getNewInstance(WorldFactoryArgument arg) {
return new BlockPlaceConfig(arg.worldData);
}
})
.registerConfigTypesPlayer()
.context() //
// BlockPlaceData
.registerDataPlayer(BlockPlaceData.class)
.factory(new IFactoryOne<PlayerFactoryArgument, BlockPlaceData>() {
@Override
public BlockPlaceData getNewInstance(
PlayerFactoryArgument arg) {
return new BlockPlaceData();
}
})
.addToGroups(CheckType.BLOCKPLACE, true, IData.class, ICheckData.class)
.context() //
);
}
public static int getBlockPlaceHash(final Block block, final Material mat) {
int hash = fr.neatmonster.nocheatplus.utilities.ds.map.CoordHash.hashCode3DPrimes(block.getX(), block.getY(), block.getZ());
if (mat != null) {
hash |= mat.name().hashCode();
}
hash |= block.getWorld().getName().hashCode();
return hash;
}
/** Mechanic introduced with 1.20. The event itself was introduced around 1.20.1 */
private void handleSignOpenEvent(final Player player, Cause cause) {
if (cause != Cause.INTERACT) {
return;
}
// Always set this to 0 on opening a sign. We don't need to check for hashing here, only time.
final IPlayerData pData = DataManager.getPlayerData(player);
final BlockPlaceData data = pData.getGenericInstance(BlockPlaceData.class);
data.autoSignPlacedHash = 0;
data.signOpenTime = System.currentTimeMillis();
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onBlockPlace(final BlockPlaceEvent event) {
if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKPLACE, event.getPlayer())) {
return;
}
final Block block = event.getBlockPlaced();
final Block blockAgainst = event.getBlockAgainst();
// Skip any null blocks.
if (block == null || blockAgainst == null) {
return;
}
final Player player = event.getPlayer();
final Material placedMat;
if (hasGetReplacedState) {
placedMat = event.getBlockPlaced().getType();
}
else if (Bridge1_9.hasGetItemInOffHand()) {
placedMat = BlockProperties.isAir(event.getItemInHand()) ? Material.AIR : event.getItemInHand().getType();
}
else placedMat = Bridge1_9.getItemInMainHand(player).getType(); // Safety first.
boolean cancelled = false;
int skippedRedundantChecks = 0;
final IPlayerData pData = DataManager.getPlayerData(player);
final BlockPlaceData data = pData.getGenericInstance(BlockPlaceData.class);
final BlockPlaceConfig cc = pData.getGenericInstance(BlockPlaceConfig.class);
final BlockInteractData biData = pData.getGenericInstance(BlockInteractData.class);
// isInteractBlock - the block placed against is the block last interacted with.
final boolean isInteractBlock = !biData.getLastIsCancelled() && biData.matchesLastBlock(TickTask.getTick(), blockAgainst);
final BlockFace placedFace = event.getBlock().getFace(blockAgainst);
final Block blockPlaced = event.getBlockPlaced();
final boolean shouldSkipSome;
if (blockMultiPlaceEvent != null && event.getClass() == blockMultiPlaceEvent) {
if (placedMat == Material.BEDROCK || Bridge1_9.hasEndCrystalItem() && placedMat == Bridge1_9.END_CRYSTAL_ITEM) {
shouldSkipSome = true;
}
else {
if (pData.isDebugActive(CheckType.BLOCKPLACE)) {
debug(player, "Block place " + event.getClass().getName() + " " + placedMat);
}
shouldSkipSome = false;
}
}
else shouldSkipSome = BlockProperties.isScaffolding(placedMat);
if (MaterialUtil.isAnySign(placedMat)) {
// To be checkde on SignChangeEvents
data.signOpenTime = System.currentTimeMillis();
data.autoSignPlacedHash = getBlockPlaceHash(block, placedMat);
if (pData.isDebugActive(CheckType.BLOCKPLACE_AUTOSIGN)) {
debug(player, "Register time and hash for this placed sign: h= " + data.autoSignPlacedHash + " / t= " + data.signOpenTime);
}
}
// Don't run checks, if a set back is scheduled.
if (pData.isPlayerSetBackScheduled()) {
cancelled = true;
if (pData.isDebugActive(CheckType.BLOCKPLACE)) {
debug(player, "Prevent block place due to a scheduled set back.");
}
}
// Surrounding material first.
if (!cancelled && against.isEnabled(player, pData) && !BlockProperties.isScaffolding(placedMat)
&& against.check(player, block, placedMat, blockAgainst, isInteractBlock, data, cc, pData)) {
cancelled = true;
}
// No swing check (player doesn't swing their arm when placing a lily pad).
if (!cancelled && !cc.noSwingExceptions.contains(placedMat)
&& noSwing.isEnabled(player, pData) && noSwing.check(player, data, cc)) {
cancelled = true;
}
// Fast place check.
if (!cancelled && fastPlace.isEnabled(player, pData)) {
if (fastPlace.check(player, block, TickTask.getTick(), data, cc, pData)) {
cancelled = true;
}
// Check for Improbable, whatever FastPlace says, provided the feature is enabled at all.
if (cc.fastPlaceImprobableWeight > 0.0f) {
if (cc.fastPlaceImprobableFeedOnly) {
Improbable.feed(player, cc.fastPlaceImprobableWeight, System.currentTimeMillis());
}
else if (data.fastPlaceVL > 25 && Improbable.check(player, cc.fastPlaceImprobableWeight, System.currentTimeMillis(), "blockplace.fastplace", pData)) {
// Only check on decently high frequencies
cancelled = true;
}
// Feed for lower frequencies.
else Improbable.feed(player, cc.fastPlaceImprobableWeight, System.currentTimeMillis());
}
}
// Scaffold Check
if (scaffold.isEnabled(player, pData) && placedFace != null) {
final PlayerMoveData thisMove = pData.getGenericInstance(MovingData.class).playerMoves.getCurrentMove();
if (faces.contains(placedFace)
&& thisMove.from.getY() - blockPlaced.getY() < 2.0
&& thisMove.from.getY() - blockPlaced.getY() >= 1.0
&& blockPlaced.getType().isSolid()
&& TrigUtil.distance(player.getLocation(), blockPlaced.getLocation()) < 2.0) {
// Monitor yawrate before feeding Improbable or checking for Scaffold
if (Combined.checkYawRate(player, thisMove.from.getYaw(), System.currentTimeMillis(), thisMove.from.getWorldName(), pData)) {
cancelled = true;
}
// Always check for Scaffold whatever yawrate says.
if (data.cancelNextPlace && (Math.abs(data.currentTick - TickTask.getTick()) < 10)
|| scaffold.check(player, placedFace, pData, data, cc, event.isCancelled(), thisMove.yDistance, pData.getGenericInstance(MovingData.class).sfJumpPhase)) {
cancelled = true;
}
// If not cancelled, do feed the Improbable.
else if (cc.scaffoldImprobableWeight > 0.0f) {
if (cc.scaffoldImprobableFeedOnly) {
Improbable.feed(player, cc.scaffoldImprobableWeight, System.currentTimeMillis());
}
else if (Improbable.check(player, cc.scaffoldImprobableWeight, System.currentTimeMillis(), "blockplace.scaffold", pData)) {
cancelled = true;
}
}
if (!cancelled) data.scaffoldVL *= 0.98;
}
// Cleanup
data.cancelNextPlace = false;
}
final FlyingQueueHandle flyingHandle = new FlyingQueueHandle(pData);
final boolean reachCheck = pData.isCheckActive(CheckType.BLOCKPLACE_REACH, player);
final boolean directionCheck = pData.isCheckActive(CheckType.BLOCKPLACE_DIRECTION, player);
if (reachCheck || directionCheck) {
final Location loc = player.getLocation(useLoc);
final double eyeHeight = MovingUtil.getEyeHeight(player);
// Reach check (distance).
if (!cancelled && !shouldSkipSome) {
if (isInteractBlock && biData.isPassedCheck(CheckType.BLOCKINTERACT_REACH)) {
skippedRedundantChecks++;
}
else if (reachCheck && reach.check(player, eyeHeight, block, data, cc)) {
cancelled = true;
}
}
// Direction check.
if (!cancelled && !shouldSkipSome) {
if (isInteractBlock && biData.isPassedCheck(CheckType.BLOCKINTERACT_DIRECTION)) {
skippedRedundantChecks++;
}
else if (directionCheck) {
if (blockAgainst.getType() == Material.LADDER || BlockProperties.isCarpet(blockAgainst.getType())) {
// TODO: Actually fix this, don't just ignore it.
// ISSUE: https://github.com/NoCheatPlus/Issues/issues/524
}
else if (direction.check(player, loc, eyeHeight, block, null, flyingHandle, data, cc, pData)) {
cancelled = true;
}
}
}
useLoc.setWorld(null);
}
// If one of the checks requested to cancel the event, do so.
if (cancelled) {
event.setCancelled(true);
// We need to do this because block-place cancelling can easily desync the player.
pData.requestUpdateInventory();
}
if (pData.isDebugActive(CheckType.BLOCKPLACE)) {
debugBlockPlace(player, placedMat, block, blockAgainst, skippedRedundantChecks, flyingHandle, pData);
}
// Cleanup
// Reminder(currently unused): useLoc.setWorld(null);
}
/** We listen to sign change events for the autosign check */
@EventHandler(priority = EventPriority.LOWEST, ignoreCancelled = true)
public void onSignChange(final SignChangeEvent event) {
if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKPLACE, event.getPlayer())) {
return;
}
if (event.getClass() != SignChangeEvent.class) {
// Built in plugin compatibility.
// (Don't understand why two consecutive events editing the same block are a problem)
return;
}
final Player player = event.getPlayer();
final Block block = event.getBlock();
final String[] lines = event.getLines();
if (block == null || lines == null || player == null) {
return;
}
final IPlayerData pData = DataManager.getPlayerData(player);
final BlockPlaceData data = pData.getGenericInstance(BlockPlaceData.class);
if (autoSign.isEnabled(player, pData) && autoSign.check(player, block, lines, pData)) {
event.setCancelled(true);
}
}
/** We listen to this event for the swining animation */
@EventHandler(priority = EventPriority.MONITOR)
public void onPlayerAnimation(final PlayerAnimationEvent event) {
final BlockPlaceData data = DataManager.getGenericInstance(event.getPlayer(), BlockPlaceData.class);
data.noSwingCount = Math.max(data.noSwingCount - 1, 0);
}
/** We listen to interact events for some misc checks */
@EventHandler(priority = EventPriority.LOWEST)
public void onPlayerInteract(final PlayerInteractEvent event) {
if (!DataManager.getPlayerData(event.getPlayer()).isCheckActive(CheckType.BLOCKPLACE, event.getPlayer())) {
return;
}
if (event.getAction() != Action.RIGHT_CLICK_BLOCK) {
return;
}
final Player player = event.getPlayer();
final ItemStack stack = Bridge1_9.getUsedItem(player, event);
if (stack == null) {
return;
}
final IPlayerData pData = DataManager.getPlayerData(player);
final BlockPlaceConfig cc = pData.getGenericInstance(BlockPlaceConfig.class);
final Material type = stack.getType();
if (MaterialUtil.isBoat(type)) {
if (cc.boatsOnWaterOnly) {
denyOrAllowBoatPlacement(player, event, pData);
}
}
else if (MaterialUtil.isSpawnEgg(type)) {
if (speed.isEnabled(player, pData) && speed.check(player, cc, pData)) {
event.setCancelled(true);
}
}
}
/**
* Check if the boat can be placed on ground, provided CachedConfig.boatsOnWaterOnly returned true.
*
* @param player
* @param event
* @param pData
*/
private void denyOrAllowBoatPlacement(final Player player, final PlayerInteractEvent event, final IPlayerData pData) {
final Block block = event.getClickedBlock();
final Material mat = block.getType();
if (BlockProperties.isWater(mat)) {
// Allow placement
return;
}
// TODO: Shouldn't this be the opposite face?
final BlockFace blockFace = event.getBlockFace();
final Block relBlock = block.getRelative(blockFace);
final Material relMat = relBlock.getType();
// TODO: Placing inside of water, but not "against" ?
if (BlockProperties.isWater(relMat)) {
// Allow placement
return;
}
// Interacted with a non-water block, deny.
if (!pData.hasPermission(Permissions.BLOCKPLACE_BOATSONWATERONLY, player)) {
final Result previousUseBlock = event.useInteractedBlock();
event.setCancelled(true);
event.setUseItemInHand(Result.DENY);
event.setUseInteractedBlock(previousUseBlock == Result.DEFAULT ? Result.ALLOW : previousUseBlock);
counters.addPrimaryThread(idBoatsOnWaterOnly, 1);
// Attempt to refresh the inventory in order to workaround possible ghost items.
pData.requestUpdateInventory();
}
}
@EventHandler(ignoreCancelled = true, priority = EventPriority.LOWEST)
public void onProjectileLaunch(final ProjectileLaunchEvent event) {
// The shooter needs to be a player.
final Projectile projectile = event.getEntity();
final Player player = BridgeMisc.getShooterPlayer(projectile);
if (player == null) {
return;
}
if (!DataManager.getPlayerData(player).isCheckActive(CheckType.BLOCKPLACE, player)) {
return;
}
if (MovingUtil.hasScheduledPlayerSetBack(player)) {
event.setCancelled(true);
return;
}
// And the projectile must be one the following:
EntityType type = event.getEntityType();
if (!BridgeEntityType.PROJECTILE_CHECK_LIST.contains(type)) return;
// Do the actual check...
final IPlayerData pData = DataManager.getPlayerData(player);
final BlockPlaceConfig cc = pData.getGenericInstance(BlockPlaceConfig.class);
boolean cancel = false;
if (speed.isEnabled(player, pData)) {
final long now = System.currentTimeMillis();
final Location loc = player.getLocation(useLoc2);
if (Combined.checkYawRate(player, loc.getYaw(), now, loc.getWorld().getName(), pData)) {
// Yawrate (checked extra).
cancel = true;
}
if (speed.check(player, cc, pData)) {
// If the check was positive, cancel the event.
cancel = true;
}
else if (cc.speedImprobableWeight > 0.0f) {
if (cc.speedImprobableFeedOnly) {
Improbable.feed(player, cc.speedImprobableWeight, now);
}
else if (Improbable.check(player, cc.speedImprobableWeight, now, "blockplace.speed", pData)) {
cancel = true;
}
}
}
// Ender pearl glitch (ab-) use.
if (!cancel && type == EntityType.ENDER_PEARL && pData.getGenericInstance(CombinedConfig.class).enderPearlCheck) {
if (!BlockProperties.isPassable(projectile.getLocation(useLoc2))) {
// Launch into a block.
cancel = true;
}
else {
if (!BlockProperties.isPassable(player.getEyeLocation(), projectile.getLocation(useLoc2))) {
// (Spare a useLoc2, for this is seldom rather.)
// Something between player
cancel = true;
}
else {
final Material mat = player.getLocation(useLoc2).getBlock().getType();
final long flags = BlockFlags.F_CLIMBABLE | BlockFlags.F_LIQUID | BlockFlags.F_IGN_PASSABLE_CHECK;
if (!BlockProperties.isAir(mat) && (BlockFlags.getBlockFlags(mat) & flags) == 0 && !mcAccess.getHandle().hasGravity(mat)) {
// Still fails on piston traps etc.
if (!BlockProperties.isPassable(player.getLocation(), projectile.getLocation())
&& !BlockProperties.isOnGroundOrResetCond(player, player.getLocation(), pData.getGenericInstance(MovingConfig.class).yOnGround)) {
cancel = true;
}
}
}
}
if (cancel) {
counters.addPrimaryThread(idEnderPearl, 1);
}
}
if (cancel) {
event.setCancelled(true);
}
// Cleanup.
useLoc2.setWorld(null);
}
// TODO: remove this
@EventHandler(priority = EventPriority.MONITOR)
public void onMove(PlayerMoveEvent event) {
Player player = event.getPlayer();
final IPlayerData pData = DataManager.getPlayerData(player);
final BlockPlaceData data = pData.getGenericInstance(BlockPlaceData.class);
if (!pData.isCheckActive(CheckType.BLOCKPLACE, player)) return;
if (player.isSprinting()) {
data.sprintTime = TickTask.getTick();
} else if (player.isSneaking()) {
data.sneakTime = TickTask.getTick();
}
}
private void debugBlockPlace(final Player player, final Material placedMat, final Block block, final Block blockAgainst,
final int skippedRedundantChecks, final FlyingQueueHandle flyingHandle, final IPlayerData pData) {
debug(player, "Block place(" + placedMat + "): " + block.getX() + ", " + block.getY() + ", " + block.getZ());
BlockInteractListener.debugBlockVSBlockInteract(player, checkType, blockAgainst, "onBlockPlace(blockAgainst)", Action.RIGHT_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;
}
}
}
}
// NOTE (AI): NCP's blockplace listener dispatches Bukkit block-place events into the Direction, FastPlace, Reach, NoSwing and AgainstWorld checks; the ProtocolLib UseItemAdapter feeds it from PacketPlayInBlockPlace.
Hit-vector scaffold check: a real scaffold click sequence must vary the face and cursor vector as the player moves.
On BLOCK_PLACE it reads the cursor vector (vecX, vecY, vecZ) and the face ordinal from the wrapped packet. When the yaw is changing and the block below the target position is air, it expects a non-constant click pattern: a face between 0 and 3 with a perpetual 0.5/0.5 vector is the scaffold signature, accumulating a violation level that flags at 4 consecutive hits, otherwise the level decays.
// ===== FILE: JTXOfficial-FlopAC, src/main/java/me/jtx/flopac/checks/misc/scaffold/ScaffoldA.java =====
package me.jtx.flopac.checks.misc.scaffold;
import me.jtx.flopac.base.check.api.Check;
import me.jtx.flopac.base.check.api.CheckInformation;
import me.jtx.flopac.base.event.PacketEvent;
import me.jtx.flopac.base.user.User;
import me.jtx.flopac.tinyprotocol.api.Packet;
import me.jtx.flopac.tinyprotocol.packet.in.WrappedInBlockPlacePacket;
import org.bukkit.Material;
@CheckInformation(checkName = "Scaffold", lagBack = false, punishmentVL = 10)
public class ScaffoldA extends Check {
private double vl;
@Override
public void onPacket(PacketEvent event) {
switch (event.getType()) {
case Packet.Client.BLOCK_PLACE: {
User user = event.getUser();
WrappedInBlockPlacePacket blockPlace =
new WrappedInBlockPlacePacket(event.getPacket(), user.getPlayer());
if (user.shouldCancel() || user.getTick() < 60) {
vl = 0;
return;
}
float vecX = blockPlace.getVecX();
float vecY = blockPlace.getVecY();
float vecZ = blockPlace.getVecZ();
int faceInt = blockPlace.getFace().b();
double yaw = Math.abs(user.getCurrentLocation().getYaw() - user.getLastLocation().getYaw());
if (yaw > 0) {
if (user.getBlockPlaced().getLocation().add(0, -1, 0).getBlock().getType() == Material.AIR) {
if (faceInt >= 0 && faceInt <= 3) {
if (vecX == 0.5 && vecY == 0.5 || vecZ == 0.5 && vecY == 0.5) {
if (++vl > 4) {
flag(user, "Constant HitVec");
}
} else {
vl -= Math.min(vl, 0.5f);
}
} else {
vl -= Math.min(vl, 0.72f);
}
}
}
break;
}
}
}
}
// NOTE (AI): FlopAC ScaffoldA is a 1.8 hit-vector check: with a moving yaw and an air block below the target position, it expects the place face and vector to change; a constant 0.5/0.5 hit vector on horizontal faces is the scaffold signature.
Related Packets
Wiki Cross-Reference
The cursor position fields range from 0 to 1 across the block face, increasing west to east on X, bottom to top on Y and north to south on Z, so for example the Y value decides whether a slab against a face becomes a bottom slab or a top slab. The inside-block flag is true when the player eyes are inside a block collision box.
MCP 1.8.9 C08PacketPlayerBlockPlacement implements Packet
1.8.9 callers: PlayerControllerMP.onPlayerRightClick sends new C08PacketPlayerBlockPlacement (line 424): 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 C08PacketPlayerBlockPlacement
Full source walkthroughs of the modules and anti-cheats that use this packet.