0x0D C0DPacketCloseWindow
Player closes an inventory window (chest, crafting table, furnace, etc).
Published 2026-06-18 · Updated 2026-10-14
Fields
| Field | Type | Description |
|---|---|---|
| windowId | byte | Window ID of the container being closed |
Wire Encoding
| Field | Type | Notes |
|---|---|---|
| Window ID | unsigned byte | Server-assigned window ID from S2DPacketOpenWindow |
MCP References
NetHandlerPlayServer.processCloseWindow()Handler Interface
INetHandlerPlayServerNotes
Vanilla Source
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
Deobfuscated MCP 1.8.9 source of C0DPacketCloseWindow, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/client/C0DPacketCloseWindow.java) at build time and verified present.
Deep Dive
Role in the protocol
Closes an inventory window. One unsigned byte windowId, where 0 is the player inventory. The vanilla client sends it from EntityPlayerSP.closeScreen() with the currently open container's id; the server calls closeContainer(), which drops or returns the carried item and switches the player back to the inventory container. It is the bookend to S2DPacketOpenWindow and pairs with the C0EPacketClickWindow clicks that mutate the container.
Vanilla handling
processCloseWindow calls this.playerEntity.closeContainer() unconditionally: the server does not verify the windowId against the player's open container. That makes C0D(0) and C0D(inventoryContainer.windowId) interchangeable in module code, and a C0D with a stale id still closes whatever container is open. The client side is EntityPlayerSP.closeScreen(), which also fires when the GUI closes for any other reason.
Why clients touch it
Inventory-movement modules cancel C0D so the server-side window stays open while the player walks (Rise 5.99 InvMove, Rise 6.x CancelInventoryMove, Sigma InventoryWalk). Sort and steal managers send C0D(0) to force the server-side close after a batch of clicks (Rise 5.99 InvManager, Rise 6.x Manager, Spicy InventoryManager). Tenacity NoSlowModule sends C0D(0) plus a shift-click C0E to ghost-swap the held item while eating. Rise 6.x WatchdogDisabler emits C0D through sendUnregisteredPacket during its blink window.
Exploit surface
Cancelling C0D while moving leaves the server convinced the inventory is open; servers and anti-cheats that tie container state to movement flag this. Sending C0D(0) at the wrong moment desyncs the container: clicks after the close are answered with S2FPacketSetSlot updates for a closed window. The NoSlow trick exploits the fact that a close plus a click on window 0 re-syncs the server's view of the held slot without cancelling the item use.
Server-Side Handling
processCloseWindow unconditionally runs closeContainer(): the carried item is dropped or returned, the open container is detached, and the player inventory container becomes active. No windowId validation, no cooldown. A C0D with no open container is ignored. Ordering against C0EPacketClickWindow matters: a C0D mid-batch ends the transaction window, and later C0E packets get S2FPacketSetSlot failure responses.
Protocol Analysis
One unsigned byte (writeByte(windowId)). Window 0 is the player inventory; S2DPacketOpenWindow assigns ids from 1 upward. Because the server ignores the id, module code freely alternates between C0D(0) and C0D(inventoryContainer.windowId). The packet is sent on the main thread from closeScreen(), so module-injected copies use raw send paths to avoid GUI state.
Anti-Cheat Landscape
NCP and similar treat container state as server truth: closing a window while C03 movement continues is normal, so cancelling C0D is itself the flag surface, not the movement. Anti-cheats also correlate the NoSlow ghost pattern (C0D(0) plus C0E(0, 36+slot, 6)) with item-use state. Blink-based disablers (Rise 6.x) buffer C0D inside the blink queue so its arrival timing is controlled rather than cancelled.
implementation Implementation Cases
The window-close packet. Inventory move modules cancel it to keep the server-side window open while walking, managers and stealers send C0D(0) to force-close after click batches, NoSlowModule pairs it with a click to ghost-swap items, and WatchdogDisabler fires it through the unregistered send path during blink.
Keep the server-side inventory open while walking by cancelling the open and close packets, then force-pressing movement keys so the client moves with the GUI up.
CancelInventoryMove cancels C16PacketClientStatus OPEN_INVENTORY_ACHIEVEMENT, C0BPacketEntityAction OPEN_INVENTORY and every C0DPacketCloseWindow on PacketSendEvent, and re-presses the movement keybindings on PreUpdateEvent. Rise 5.99 InvMove Packet mode additionally cancels C0E and re-sends it wrapped as C16 open + C0E + C0D(inventoryContainer.windowId) through PacketUtil.sendPacketWithoutEvent. Sigma InventoryWalk cancels C0D only when the CARRY setting is enabled.
// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/movement/inventorymove/CancelInventoryMove.java =====
package com.alan.clients.module.impl.movement.inventorymove;
import com.alan.clients.event.Listener;
import com.alan.clients.event.annotations.EventLink;
import com.alan.clients.event.impl.motion.PreUpdateEvent;
import com.alan.clients.event.impl.packet.PacketSendEvent;
import com.alan.clients.module.impl.movement.InventoryMove;
import com.alan.clients.value.Mode;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C0BPacketEntityAction;
import net.minecraft.network.play.client.C0DPacketCloseWindow;
import net.minecraft.network.play.client.C16PacketClientStatus;
public class CancelInventoryMove extends Mode<InventoryMove> {
public CancelInventoryMove(String name, InventoryMove parent) {
super(name, parent);
}
@EventLink
public final Listener<PacketSendEvent> onPacketSend = event -> {
final Packet<?> p = event.getPacket();
if (p instanceof C16PacketClientStatus) {
final C16PacketClientStatus wrapper = (C16PacketClientStatus) p;
if (wrapper.getStatus() == C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT) {
event.setCancelled();
}
}
if (p instanceof C0BPacketEntityAction) {
final C0BPacketEntityAction wrapper = (C0BPacketEntityAction) p;
if (wrapper.getAction() == C0BPacketEntityAction.Action.OPEN_INVENTORY) {
event.setCancelled();
}
}
if (p instanceof C0DPacketCloseWindow) {
event.setCancelled();
}
};
private final KeyBinding[] AFFECTED_BINDINGS = new KeyBinding[]{
mc.gameSettings.keyBindForward,
mc.gameSettings.keyBindBack,
mc.gameSettings.keyBindRight,
mc.gameSettings.keyBindLeft,
mc.gameSettings.keyBindJump
};
@EventLink
public final Listener<PreUpdateEvent> onPreUpdate = event -> {
if (mc.currentScreen instanceof GuiChat || mc.currentScreen == this.getClickGUI()) {
return;
}
for (final KeyBinding bind : AFFECTED_BINDINGS) {
bind.setPressed(GameSettings.isKeyDown(bind));
}
};
}
// NOTE (AI): The C0D cancel is one of three; without it the server would close the window the moment the client walks, defeating the module. The keybinding re-press in PreUpdate is what lets the client move at all while a GUI is up.Drive a server-side inventory session for auto-sort and steal: open with C0B OPEN_INVENTORY, click via C0E, close with C0D(0), all without a visible GUI.
Rise 5.99 InvManager tracks invOpen: openInvServerSide sends C0BPacketEntityAction OPEN_INVENTORY, closeInvServerSide sends C0DPacketCloseWindow(0). Spicy InventoryManager tracks isInventoryOpen from the packet stream (C0D sets closed, C16 OPEN_INVENTORY sets open) and closeInv() sends C0D(inventoryContainer.windowId).
// ===== FILE: Rise 5.99, dev/rise/module/impl/player/InvManager.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.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.math.TimeUtil;
import net.minecraft.block.BlockCarpet;
import net.minecraft.block.BlockDoor;
import net.minecraft.block.BlockFlower;
import net.minecraft.client.gui.inventory.GuiChest;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.init.Blocks;
import net.minecraft.item.*;
import net.minecraft.network.play.client.C0BPacketEntityAction;
import net.minecraft.network.play.client.C0DPacketCloseWindow;
import net.minecraft.util.DamageSource;
import java.util.*;
// This is an old version of InvManager, Manager is the new InvManager.
@ModuleInfo(name = "InvManager", description = "Manages your inventory for you", category = Category.PLAYER)
public final class InvManager extends Module {
private static int bestSwordSlot, bestPickaxeSlot, bestBowSlot, bestBlockSlot, bestGapSlot;
private static int[] bestArmorDamageReducment, bestArmorSlot;
//Lists
private final List<Integer> allSwords = new ArrayList<>();
private final List<Integer> allBows = new ArrayList<>();
private final List<Integer> allPickaxes = new ArrayList<>();
private final List<Integer>[] allArmors = new List[4];
private final List<Integer> allBlocks = new ArrayList<>();
private final List<Integer> trash = new ArrayList<>();
//Timers
private final TimeUtil delayTimer = new TimeUtil();
private final TimeUtil startDelayTimer = new TimeUtil();
//Settings
public NumberSetting minDelay = new NumberSetting("Min Delay", this, 10, 0, 100, 5);
public NumberSetting maxDelay = new NumberSetting("Max Delay", this, 20, 0, 100, 5);
public NumberSetting startDelay = new NumberSetting("Start Delay", this, 20, 0, 100, 1);
public NumberSetting maxBlocks = new NumberSetting("Maximum Block Stacks", this, 2, 0, 8, 1);
public BooleanSetting sort = new BooleanSetting("Sort", this, true);
public BooleanSetting autoArmor = new BooleanSetting("Auto Armor", this, true);
public BooleanSetting random = new BooleanSetting("Random", this, true);
public BooleanSetting openInv = new BooleanSetting("Open Inv", this, true);
public BooleanSetting keepArmor = new BooleanSetting("Keep Armor", this, false);
public BooleanSetting onlyStill = new BooleanSetting("Only When Standing Still", this, false);
private boolean invOpen;
@Override
public void onPreMotion(final PreMotionEvent event) {
closeInvServerSide();
if (Objects.requireNonNull(Rise.INSTANCE.getModuleManager().getModule("Scaffold")).isEnabled() || mc.currentScreen instanceof GuiChest)
return;
if (onlyStill.isEnabled() && (mc.gameSettings.keyBindJump.isKeyDown() || mc.gameSettings.keyBindForward.isKeyDown() || mc.gameSettings.keyBindLeft.isKeyDown() || mc.gameSettings.keyBindBack.isKeyDown() || mc.gameSettings.keyBindRight.isKeyDown()))
return;
searchForItems();
searchForBestArmor();
searchForTrash();
//Drop Trash
if (!keepArmor.isEnabled()) {
for (final int slot : trash) {
if (hasNoDelay())
return;
try {
openInvServerSide();
mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot < 9 ? slot + 36 : slot, 1, 4, mc.thePlayer); //windowID - slot to Drop - Mouse Button 4 for Item Drop - Player
} catch (final IndexOutOfBoundsException p) {
}
delayTimer.reset();
}
}
//AutoArmor
if (autoArmor.isEnabled()) {
for (int i = 0; i < 4; i++) {
if (bestArmorSlot[i] != -1) {
final int bestSlot = bestArmorSlot[i];
final ItemStack oldArmor = mc.thePlayer.inventory.armorItemInSlot(i);
if (hasNoDelay()) return;
//Drop old Armor
if (oldArmor != null && oldArmor.getItem() != null && !keepArmor.isEnabled()) {
openInvServerSide();
mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, 8 - i, 0, 4, mc.thePlayer);
delayTimer.reset();
}
final int slot = bestSlot < 9 ? bestSlot + 36 : bestSlot;
if (hasNoDelay()) return;
//Equip new armor
openInvServerSide();
mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, 0, 1, mc.thePlayer);
delayTimer.reset();
}
}
}
//Sort Inventory
if (sort.isEnabled()) {
final int switchSlotSword = 0;
final int switchSlotBow = 1;
final int switchSlotPickaxe = 2;
final int switchSlotBlock = 8;
final int switchGap = 7;
//Sword Switch
if (bestSwordSlot != -1 && bestSwordSlot != switchSlotSword) {
final int slot = bestSwordSlot < 9 ? bestSwordSlot + 36 : bestSwordSlot;
if (hasNoDelay() && slot != switchSlotSword)
return;
openInvServerSide();
try {
mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, switchSlotSword, 2, mc.thePlayer); //windowID - current Slot - destination Slot - Player
} catch (final Exception ignored) {
}
delayTimer.reset();
}
//Bow Switch
if (bestBowSlot != -1 && bestBowSlot != switchSlotBow) {
final int slot = bestBowSlot < 9 ? bestBowSlot + 36 : bestBowSlot;
if (hasNoDelay() && slot != switchSlotBow)
return;
openInvServerSide();
try {
mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, switchSlotBow, 2, mc.thePlayer); //windowID - current Slot - destination Slot - Player
} catch (final Exception ignored) {
}
delayTimer.reset();
}
//Pickaxe Switch
if (bestPickaxeSlot != -1 && bestPickaxeSlot != switchSlotPickaxe) {
final int slot = bestPickaxeSlot < 9 ? bestPickaxeSlot + 36 : bestPickaxeSlot;
if (hasNoDelay() && slot != switchSlotPickaxe)
return;
openInvServerSide();
try {
mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, switchSlotPickaxe, 2, mc.thePlayer); //windowID - current Slot - destination Slot - Player
} catch (final Exception ignored) {
}
delayTimer.reset();
}
//Block Switch
if (bestBlockSlot != -1 && bestBlockSlot != switchSlotBlock) {
final int slot = bestBlockSlot < 9 ? bestBlockSlot + 36 : bestBlockSlot;
if (mc.thePlayer.inventory.getStackInSlot(switchSlotBlock) != null && mc.thePlayer.inventory.getStackInSlot(switchSlotBlock).getItem() instanceof ItemBlock)
return;
if (hasNoDelay() && slot != switchSlotBlock)
return;
openInvServerSide();
try {
mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, switchSlotBlock, 2, mc.thePlayer); //windowID - current Slot - destination Slot - Player
} catch (final Exception ignored) {
}
delayTimer.reset();
}
//Gap Switch
if (bestGapSlot != -1 && bestGapSlot != switchGap) {
final int slot = bestGapSlot < 9 ? bestGapSlot + 36 : bestGapSlot;
if (hasNoDelay() && slot != switchGap)
return;
openInvServerSide();
try {
mc.playerController.windowClick(mc.thePlayer.inventoryContainer.windowId, slot, switchGap, 2, mc.thePlayer); //windowID - current Slot - destination Slot - Player
} catch (final Exception ignored) {
}
delayTimer.reset();
}
}
}
private void openInvServerSide() {
if (!invOpen && !openInv.isEnabled()) {
mc.thePlayer.sendQueue.addToSendQueue(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.OPEN_INVENTORY));
invOpen = true;
}
}
private void closeInvServerSide() {
if (invOpen && !openInv.isEnabled()) {
mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(0));
invOpen = false;
}
}
private boolean hasNoDelay() {
return !startDelayTimer.hasReached((long) ((long) startDelay.getValue() * 10 + Math.random() * 2)) || !delayTimer.hasReached((long) (Math.random() * (maxDelay.getValue() * 10 - minDelay.getValue() * 10 + 1) + minDelay.getValue() * 10)) || (!(mc.currentScreen instanceof GuiInventory)) && openInv.isEnabled();
}
private void searchForTrash() {
//Clear the Trash List
trash.clear();
//Filter the best Armor
for (int i = 0; i < allArmors.length; i++) {
final List<Integer> armorItem = allArmors[i];
if (armorItem != null) {
final int finalI = i;
armorItem.stream().filter(slot -> slot != bestArmorSlot[finalI]).forEach(trash::add);
}
}
//Filter the best Items
allBows.stream().filter(slot -> slot != bestBowSlot).forEach(trash::add);
allSwords.stream().filter(slot -> slot != bestSwordSlot).forEach(trash::add);
allPickaxes.stream().filter(slot -> slot != bestPickaxeSlot).forEach(trash::add);
// Throw blocks after the limit is reached.
int blockStacks = allBlocks.size();
for (final int slot : allBlocks) {
if (blockStacks <= Math.round(maxBlocks.getValue() + 1)) break;
trash.add(slot);
blockStacks -= 1;
}
//Random Option
if (random.isEnabled()) Collections.shuffle(trash);
else Collections.sort(trash);
}
private void searchForBestArmor() {
//Reset all Stats and Slots
bestArmorDamageReducment = new int[4];
bestArmorSlot = new int[4];
//Fill Arrays
Arrays.fill(bestArmorDamageReducment, -1);
Arrays.fill(bestArmorSlot, -1);
//Fill Array with current Armor
for (int i = 0; i < bestArmorSlot.length; i++) {
final ItemStack itemStack = mc.thePlayer.inventory.armorItemInSlot(i);
allArmors[i] = new ArrayList<>();
if (itemStack != null && itemStack.getItem() != null) {
if (itemStack.getItem() instanceof ItemArmor) {
final ItemArmor armor = (ItemArmor) itemStack.getItem();
final int currentProtection = armor.damageReduceAmount + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{itemStack}, DamageSource.generic); //Get the Reduce amount of the ArmorType and Protection Level
bestArmorDamageReducment[i] = currentProtection;
}
}
}
//Search for better Armor in Inventory
for (int i = 0; i < 9 * 4; i++) {
final ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);
if (itemStack == null || itemStack.getItem() == null) continue;
if (itemStack.getItem() instanceof ItemArmor) {
final ItemArmor armor = (ItemArmor) itemStack.getItem();
final int armorType = 3 - armor.armorType; //Slots reversed for some reason
allArmors[armorType].add(i);
final int slotProtectionLevel = armor.damageReduceAmount + EnchantmentHelper.getEnchantmentModifierDamage(new ItemStack[]{itemStack}, DamageSource.generic); //Get the Reduce amount of the ArmorType and Protection Level
if (bestArmorDamageReducment[armorType] < slotProtectionLevel) {
bestArmorDamageReducment[armorType] = slotProtectionLevel;
bestArmorSlot[armorType] = i;
}
}
}
}
private void searchForItems() {
//Reset all Slots
bestSwordSlot = -1;
bestBowSlot = -1;
bestPickaxeSlot = -1;
bestBlockSlot = -1;
bestGapSlot = -1;
allSwords.clear();
allBows.clear();
allPickaxes.clear();
allBlocks.clear();
//Other Stats
float bestSwordDamage = -1, bestSwordDurability = -1, bestPickaxeEfficiency = -1, bestPickaxeDurability = -1, bestBowDurability = -1;
int bestBowDamage = -1, bestBlockSize = -1;
int gapStackSize = -1;
for (int i = 0; i < 9 * 4; i++) {
final ItemStack itemStack = mc.thePlayer.inventory.getStackInSlot(i);
if (itemStack == null || itemStack.getItem() == null) continue;
//Search for best Sword
if (itemStack.getItem() instanceof ItemSword) {
final ItemSword sword = (ItemSword) itemStack.getItem();
final int level = EnchantmentHelper.getEnchantmentLevel(Enchantment.sharpness.effectId, itemStack);
final float damageLevel = (float) (sword.getDamageVsEntity() + level * 1.25); //Enchantment Multiplier
allSwords.add(i);
if (bestSwordDamage < damageLevel) {
bestSwordDamage = damageLevel;
bestSwordDurability = sword.getDamageVsEntity();
bestSwordSlot = i;
}
if ((damageLevel == bestSwordDamage) && (sword.getDamageVsEntity() < bestSwordDurability)) {
bestSwordDurability = sword.getDamageVsEntity();
bestSwordSlot = i;
}
}
//Search for best Pickaxe
if (itemStack.getItem() instanceof ItemPickaxe) {
final ItemPickaxe pickaxe = (ItemPickaxe) itemStack.getItem();
allPickaxes.add(i);
final float efficiencyLevel = getPickaxeEfficiency(pickaxe);
if (bestPickaxeEfficiency < efficiencyLevel) {
bestPickaxeEfficiency = efficiencyLevel;
bestPickaxeDurability = pickaxe.getMaxDamage();
bestPickaxeSlot = i;
}
if ((efficiencyLevel == bestPickaxeEfficiency) && (pickaxe.getMaxDamage() < bestPickaxeDurability)) {
bestPickaxeDurability = pickaxe.getMaxDamage();
bestPickaxeSlot = i;
}
}
//Search for best Bow
if (itemStack.getItem() instanceof ItemBow) {
final ItemBow bow = (ItemBow) itemStack.getItem();
final int level = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, itemStack);
allBows.add(i);
if (bestBowDamage < level || (bestBowDamage == -1 && level == 0)) {
bestBowDamage = level;
bestBowDurability = bow.getMaxDamage();
bestBowSlot = i;
}
if ((level == bestBowDamage) && bow.getMaxDamage() < bestBowDurability) {
bestBowDurability = bow.getMaxDamage();
bestBowSlot = i;
}
}
//Search for Blocks
if (itemStack.getItem() instanceof ItemBlock) {
final ItemBlock block = (ItemBlock) itemStack.getItem();
if (block.getBlock() == Blocks.web || block.getBlock() == Blocks.bed || block.getBlock() == Blocks.noteblock || block.getBlock() == Blocks.cactus || block.getBlock() == Blocks.cake || block.getBlock() == Blocks.anvil || block.getBlock() == Blocks.skull || block.getBlock() instanceof BlockDoor || block.getBlock() instanceof BlockFlower || block.getBlock() instanceof BlockCarpet)
continue;
allBlocks.add(i);
if (bestBlockSize < itemStack.stackSize) {
bestBlockSize = itemStack.stackSize;
bestBlockSlot = i;
}
}
// Search for Gaps.
if (itemStack.getItem() instanceof ItemAppleGold) {
if (gapStackSize < itemStack.stackSize) {
gapStackSize = itemStack.stackSize;
bestGapSlot = i;
}
}
}
}
private float getPickaxeEfficiency(final ItemPickaxe pickaxe) {
int level = EnchantmentHelper.getEnchantmentLevel(Enchantment.efficiency.effectId, new ItemStack(pickaxe));
//Percentage of Efficiency per Level
switch (level) {
case 1:
level = 30;
break;
case 2:
level = 69;
break;
case 3:
level = 120;
break;
case 4:
level = 186;
break;
case 5:
level = 271;
break;
default:
level = 0;
break;
}
return pickaxe.getToolMaterial().getEfficiencyOnProperMaterial() + level;
}
}
// NOTE (AI): closeInvServerSide sends C0D(0) after the click batch; window 0 works because the server ignores the id. Spicy's InventoryManager instead derives its open state from incoming C0D packets and replies with the inventory container id.Emit C0D outside the event stream so the inventory close participates in a blink sequence without being cancellable or reorderable by other modules.
With the Inventory toggle on, clicks on the player inventory are cancelled on PacketSendEvent and re-sent unregistered as C16 OPEN_INVENTORY plus the C0E; on the next PreUpdate a tick counter fires BlinkComponent.dispatch and sends C0D(inventoryContainer.windowId) via sendUnregisteredPacket on the raw NetworkManager.
// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/disabler/WatchdogDisabler.java =====
package com.alan.clients.module.impl.exploit.disabler;
import com.alan.clients.component.impl.player.*;
import com.alan.clients.component.impl.player.rotationcomponent.MovementFix;
import com.alan.clients.component.impl.render.NotificationComponent;
import com.alan.clients.component.impl.render.espcomponent.api.ESP;
import com.alan.clients.event.Listener;
import com.alan.clients.event.Priorities;
import com.alan.clients.event.annotations.EventLink;
import com.alan.clients.event.impl.input.MoveInputEvent;
import com.alan.clients.event.impl.input.KeyboardInputEvent;
import com.alan.clients.event.impl.input.MoveInputEvent;
import com.alan.clients.event.impl.motion.PostStrafeEvent;
import com.alan.clients.event.impl.motion.PreMotionEvent;
import com.alan.clients.event.impl.motion.PreUpdateEvent;
import com.alan.clients.event.impl.motion.StrafeEvent;
import com.alan.clients.event.impl.other.MoveEvent;
import com.alan.clients.event.impl.other.TeleportEvent;
import com.alan.clients.event.impl.other.WorldChangeEvent;
import com.alan.clients.event.impl.packet.PacketReceiveEvent;
import com.alan.clients.event.impl.packet.PacketSendEvent;
import com.alan.clients.event.impl.render.ViewBobbingEvent;
import com.alan.clients.module.impl.exploit.Disabler;
import com.alan.clients.module.impl.movement.Flight;
import com.alan.clients.module.impl.movement.LongJump;
import com.alan.clients.module.impl.movement.Speed;
import com.alan.clients.module.impl.player.Scaffold;
import com.alan.clients.util.chat.ChatUtil;
import com.alan.clients.util.player.MoveUtil;
import com.alan.clients.util.packet.PacketUtil;
import com.alan.clients.util.player.PlayerUtil;
import com.alan.clients.util.rotation.RotationUtil;
import com.alan.clients.util.vector.Vector2f;
import com.alan.clients.value.Mode;
import com.alan.clients.value.impl.BooleanValue;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.*;
import net.minecraft.network.play.server.S07PacketRespawn;
import net.minecraft.network.play.server.S08PacketPlayerPosLook;
import net.minecraft.network.play.server.S32PacketConfirmTransaction;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.Vec3;
import rip.vantage.commons.util.time.StopWatch;
import java.util.*;
import java.util.concurrent.ThreadLocalRandom;
public class WatchdogDisabler extends Mode<Disabler> {
private float forward, strafe;
private boolean disabled;
private List<Short> actionNumbers;
private StopWatch transactionStopwatch;
private Queue<Vec3> positionQueue;
private Queue<Packet<?>> transactionQueue;
private Queue<Packet<?>> blinkQueue;
private StopWatch pingStopwatch;
private Integer tick;
private Integer ticks;
private boolean isSneaking;
private boolean set;
private boolean jump;
private double initialY = 0;
int time;
private int worldChange = 0;
private boolean checkedAfterTicks = false;
public WatchdogDisabler(String name, Disabler parent) {
super(name, parent);
this.positionQueue = new ArrayDeque<>();
this.transactionQueue = new ArrayDeque<>();
this.pingStopwatch = new StopWatch();
this.blinkQueue = new ArrayDeque<>();
this.actionNumbers = new ArrayList<>();
this.transactionStopwatch = new StopWatch();
}
public final BooleanValue scaffold = new BooleanValue("Strafe", this, true);
public final BooleanValue ban = new BooleanValue("Jump", this, true);
public final BooleanValue inventory = new BooleanValue("Inventory", this, false);
@EventLink
private final Listener<TeleportEvent> onTeleport = event -> {
};
@EventLink(value = Priorities.HIGH)
Listener<MoveInputEvent> moveInput = event -> {
forward = event.getForward();
strafe = event.getStrafe();
};
@EventLink
private final Listener<PreMotionEvent> PreMotionEvent = event -> {
mc.gameSettings.ofDynamicFov = false;
time++;
if ((getModule(Flight.class).isEnabled() || getModule(LongJump.class).isEnabled()) && mc.thePlayer.offGroundTicks<5){
time = -4;
if(!mc.thePlayer.isSprinting()){
event.setSprinting(true);
}
}
switch (time) {
case 1:
event.setSprinting(true);
// ChatUtil.display("start");
// Send the START_SPRINTING packet
// PacketUtil.send(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.START_SPRINTING));
// Set time to 2 to send STOP_SPRINTING in the next call
break;
case 2:
event.setSprinting(false);
// ChatUtil.display("stop");
//ChatUtil.display("stop");
// mc.thePlayer.setSprinting(false);
// PacketUtil.send(new C0BPacketEntityAction(mc.thePlayer, C0BPacketEntityAction.Action.STOP_SPRINTING));
// Reset time to 1 for the next cycle
time = (int) Math.round(-(Math.random()+1));
// ChatUtil.display(time);
break;
}
/*
if (ban.getValue()) {
if (!this.actionNumbers.isEmpty() && this.transactionStopwatch.finished(1000L)) {
Collections.shuffle(this.actionNumbers);
this.actionNumbers.forEach(action -> mc.getNetHandler().getNetworkManager().sendPacket(new C0FPacketConfirmTransaction(0, action, true)));
this.actionNumbers.clear();
this.disabled = true;
}
}
*/
worldChange++;
if (ban.getValue() && (mc.thePlayer.inventory.getStackInSlot(0) == null || mc.thePlayer.inventory.getStackInSlot(0).getItem() != Items.compass)) {
if (jump && mc.thePlayer.onGround) {
mc.thePlayer.jump();
jump = false;
set = true;
} else if (mc.thePlayer.offGroundTicks >= 10 && set) {
if (!BadPacketsComponent.bad(true, true, true, true, true) && !(getModule(Scaffold.class).isEnabled())) {
Random random = new Random();
float hitX = random.nextFloat();
float hitZ = random.nextFloat();
PacketUtil.send(new C08PacketPlayerBlockPlacement(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ), EnumFacing.UP.getIndex(), new ItemStack(Items.water_bucket), hitX, 1.0F, hitZ));
}
if (mc.thePlayer.offGroundTicks % 2 == 0) {
RotationComponent.setRotations(new Vector2f((float) (mc.thePlayer.rotationYaw - (10) + (Math.random() - 0.5) * 3), (float) (mc.thePlayer.rotationPitch)), 4, MovementFix.OFF);// Store the BlockPos in a variabl
event.setPosX(event.getPosX() + 0.095+Math.random()/100);
}
}
}
if (scaffold.getValue()) {
if (Math.random()<0.2 && !getModule(Scaffold.class).isEnabled() && !getModule(Flight.class).isEnabled() && !getModule(LongJump.class).isEnabled()) {
if (!BadPacketsComponent.bad(true, true, false, true, true) && !(getModule(Scaffold.class).isEnabled())) {
// ChatUtil.display("send");s
Random random = new Random();
float hitX = random.nextFloat();
float hitZ = random.nextFloat();
PacketUtil.send(new C08PacketPlayerBlockPlacement(new BlockPos(mc.thePlayer.posX, mc.thePlayer.posY, mc.thePlayer.posZ), EnumFacing.UP.getIndex(), new ItemStack(Items.water_bucket), hitX, 1.0F, hitZ));
}
}
}
};
@EventLink
private final Listener<MoveEvent> moveEventListener = event -> {
if (ban.getValue() && mc.thePlayer.offGroundTicks >= 10 && set) {
event.setPosX(0); event.setPosY(0); event.setPosZ(0);
}
};
@EventLink
private final Listener<PacketReceiveEvent> packetReceiveEventListener = event -> {
if (event.getPacket() instanceof S08PacketPlayerPosLook) {
if (ticks != null) {
ticks++;
if (ticks == 25) {
set = false;
ticks = 0;
NotificationComponent.post("Watchdog Jump Disabler", "Automatically disabled Watchdog Jump check", 1000);
}
}
}
};
@EventLink(value = Priorities.LOW)
public final Listener<PreUpdateEvent> onPreUpdate = event -> {
if (inventory.getValue() && !(getModule(Scaffold.class).isEnabled())) {
if ( tick > 0) {
BlinkComponent.dispatch();
mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(new C0DPacketCloseWindow(mc.thePlayer.inventoryContainer.windowId));
tick = 0;
} else {
BlinkComponent.dispatch();
}
}
else{
BlinkComponent.dispatch();
}
if((MoveUtil.enoughMovementForSprinting() || getModule(Speed.class).isEnabled()) && mc.gameSettings.keyBindBack.isKeyDown()){
RotationComponent.setRotations(new Vector2f((float) Math.toDegrees(MoveUtil.direction(forward, strafe) -(float) (Math.random() * 0.1f)), mc.thePlayer.rotationPitch),
Math.random()*50, MovementFix.OFF);
}
};
@EventLink
private final Listener<PacketSendEvent> packetSendEventListener = event -> {
if (inventory.getValue() && !(getModule(Scaffold.class).isEnabled())) {
if (inventory.getValue()) {
if (event.getPacket() instanceof C0EPacketClickWindow && ((C0EPacketClickWindow) event.getPacket()).getWindowId() == mc.thePlayer.inventoryContainer.windowId && !(mc.currentScreen instanceof GuiInventory)) {
BlinkComponent.blinking = true;
tick++;
event.setCancelled();
mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));
mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(event.getPacket());
}
}
}
};
@Override
public void onDisable() {
NotificationComponent.post("Watchdog Disabler","DO NOT DISABLE IN GAME OR YOU WILL BAN");
if(time == 1){
} else if(time == 2){
}
}
@EventLink
public final Listener<WorldChangeEvent> onWorldChange = event -> {
worldChange = 0;
if (ban.getValue() ) {
NotificationComponent.post("Watchdog Jump Disabler", "Disabling Jump check for Watchdog", 5000);
jump = true;
set = false;
ticks = 0;
}
};
}
// NOTE (AI): sendUnregisteredPacket bypasses the client's own event bus, so the C0D cannot be cancelled by another module and its position in the stream is exactly controlled. The mode is the Watchdog Jump disabler with an inventory sub-feature.Cancel the server-side slowdown while eating or using items by ghost-swapping the held item: close window 0 and shift-click the current slot back.
While using an item with no GUI open, sendBypass() pushes C0DPacketCloseWindow(0) then C0EPacketClickWindow(0, 36 + currentItem, 0, 6, null, nextTransactionID) into the send queue, setting isItemGhost. The S2FPacketSetSlot cancels on receive keep the ghost state invisible.
// ===== FILE: Tenacity 6.0, dev/tenacity/module/impl/movement/NoSlowModule.java =====
package dev.tenacity.module.impl.movement;
import dev.tenacity.event.Event;
import dev.tenacity.event.IEventListener;
import dev.tenacity.event.impl.packet.PacketReceiveEvent;
import dev.tenacity.event.impl.player.MotionEvent;
import dev.tenacity.event.impl.player.SlowDownEvent;
import dev.tenacity.module.Module;
import dev.tenacity.module.ModuleCategory;
import java.util.ArrayList;
import java.util.Arrays;
import dev.tenacity.setting.impl.ModeSetting;
import net.minecraft.item.ItemSword;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C0DPacketCloseWindow;
import net.minecraft.network.play.client.C0EPacketClickWindow;
import net.minecraft.network.play.server.S2FPacketSetSlot;
import net.minecraft.world.gen.layer.GenLayerEdge;
public final class NoSlowModule extends Module {
private boolean isItemGhost;
private final ModeSetting mode = new ModeSetting("Mode", "Vanilla", "Watchdog");
public NoSlowModule() {
super("NoSlow", "Makes you not take slow down", ModuleCategory.MOVEMENT);
initializeSettings(mode);
}
private final IEventListener<SlowDownEvent> onSlowDownEvent = Event::cancel;
private final IEventListener<MotionEvent> onMotionEvent = event -> {
switch (mode.getCurrentMode()) {
case "Vanilla": {
if (event.isPre() && mc.thePlayer != null) {
if (!isItemGhost)
sendBypass();
if (!mc.thePlayer.isUsingItem())
isItemGhost = false;
}
}
case "Watchdog": {
if (mc.thePlayer.isUsingItem()) {
if (mc.currentScreen == null && mc.thePlayer.getHeldItem() != null) {
}
}
break;
}
}
};
private final IEventListener<PacketReceiveEvent> onPacketReceiveEvent = event -> {
if (event.getPacket() instanceof S2FPacketSetSlot && mc.thePlayer != null) {
final S2FPacketSetSlot s2f = (S2FPacketSetSlot) event.getPacket();
if (s2f.func_149175_c() == 0 && mc.thePlayer.isUsingItem() && mc.currentScreen == null && mc.thePlayer.getHeldItem() != null && !(mc.thePlayer.getHeldItem().getItem() instanceof ItemSword)) {
event.cancel();
//isItemGhost = false;
}
}
};
private void sendBypass() {
if (mc.thePlayer.isUsingItem() && mc.currentScreen == null && mc.thePlayer.getHeldItem() != null && !(mc.thePlayer.getHeldItem().getItem() instanceof ItemSword)) {
mc.getNetHandler().addToSendQueue(new C0DPacketCloseWindow(0));
mc.getNetHandler().addToSendQueue(new C0EPacketClickWindow(0, 36 + mc.thePlayer.inventory.currentItem, 0, 6, null, mc.thePlayer.inventoryContainer.getNextTransactionID(mc.thePlayer.inventory)));
isItemGhost = true;
}
}
}
// NOTE (AI): The C0D(0) plus C0E shift-click (mode 6) re-syncs the server's held-slot view while the use continues, which is what cancels the slowdown. The mode switch also shows a Watchdog variant that does nothing in this file.Close the server-side inventory after simulated shift-click armor swaps, so the open/close cycle completes without a visible GUI.
With SimulateInventory on and no GuiInventory open, move() sends C16 OPEN_INVENTORY_ACHIEVEMENT, runs playerController.windowClick, then sends an empty C0DPacketCloseWindow (default window 0) to close the window the server thinks opened. Hotbar slots are fake-equipped through C09/C08 instead of clicks.
// ===== 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 C0D close at line 135 is paired with the C16 open at line 128; the ArmorComparator/stream logic above it is standard armor scoring.Reopen a previously closed container anywhere by cancelling the client's own C0D and keeping the cached GuiContainer around for an INSERT-key reopen.
ScreenEvent caches any GuiContainer (excluding GuiInventory); PacketEvent cancels every outgoing C0DPacketCloseWindow so the container object stays alive, and tracks S2EPacketCloseWindow to drop the cache when the server closes the window. onDisable sends a real C0D with the cached windowId as cleanup. Pressing INSERT re-displays the cached GUI.
// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/features/module/modules/exploit/KeepContainer.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.exploit;
import net.ccbluex.liquidbounce.event.EventTarget;
import net.ccbluex.liquidbounce.event.KeyEvent;
import net.ccbluex.liquidbounce.event.PacketEvent;
import net.ccbluex.liquidbounce.event.ScreenEvent;
import net.ccbluex.liquidbounce.features.module.Module;
import net.ccbluex.liquidbounce.features.module.ModuleCategory;
import net.ccbluex.liquidbounce.features.module.ModuleInfo;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.network.play.client.C0DPacketCloseWindow;
import net.minecraft.network.play.server.S2EPacketCloseWindow;
import org.lwjgl.input.Keyboard;
@ModuleInfo(name = "KeepContainer", description = "Allows you to open a formerly closed inventory container everywhere. (Press INSERT Key to open)", category = ModuleCategory.EXPLOIT)
public class KeepContainer extends Module {
private GuiContainer container;
@Override
public void onDisable() {
if(container != null)
mc.getNetHandler().addToSendQueue(new C0DPacketCloseWindow(container.inventorySlots.windowId));
container = null;
}
@EventTarget
public void onGui(final ScreenEvent event) {
if(event.getGuiScreen() instanceof GuiContainer && !(event.getGuiScreen() instanceof GuiInventory))
container = (GuiContainer) event.getGuiScreen();
}
@EventTarget
public void onKey(final KeyEvent event) {
if(event.getKey() == Keyboard.KEY_INSERT) {
if(container == null)
return;
mc.displayGuiScreen(container);
}
}
@EventTarget
public void onPacket(final PacketEvent event) {
if(event.getPacket() instanceof C0DPacketCloseWindow)
event.cancelEvent();
if(event.getPacket() instanceof S2EPacketCloseWindow) {
final S2EPacketCloseWindow packetCloseWindow = (S2EPacketCloseWindow) event.getPacket();
if(container != null && container.inventorySlots != null && packetCloseWindow.windowId == container.inventorySlots.windowId)
container = null;
}
}
}
// NOTE (AI): The cancel-all-C0D approach is what makes the reopen trick possible; the S2E listener is the server-side close signal.Utility closeCurrentInventory() that sends C0D with the live windowId, used by November's inventory manager and modules to close the server-side window after silent interactions.
closeCurrentInventory() pushes new C0DPacketCloseWindow(windowId()) into mc.thePlayer.sendQueue; windowId() reads the player's openContainer and returns 0 when null. A companion openInventory() sends C0B OPEN_INVENTORY for the paired open.
// ===== FILE: November Recode 2.0, utility/player/InventoryUtils.java =====
/* November.lol © 2023 */
package lol.november.utility.player;
import com.google.common.collect.Lists;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.inventory.Container;
import net.minecraft.item.*;
import net.minecraft.network.play.client.C0BPacketEntityAction;
import net.minecraft.network.play.client.C0BPacketEntityAction.Action;
import net.minecraft.network.play.client.C0DPacketCloseWindow;
import net.minecraft.potion.Potion;
/**
* @author Gavin
* @since 2.0.0
*/
public class InventoryUtils {
/**
* A list of good items
*/
private static final List<Item> goodItems = Lists.newArrayList(
Items.golden_apple,
Items.apple,
Items.cooked_beef,
Items.cooked_chicken,
Items.cooked_fish,
Items.cooked_mutton,
Items.cooked_porkchop,
Items.cooked_rabbit,
Items.cookie,
Items.snowball,
Items.egg,
Items.rabbit_stew,
Items.mushroom_stew,
Items.ender_pearl,
Items.arrow,
Items.bow,
Items.water_bucket,
Items.lava_bucket
);
/**
* A list of useless blocks
* i want to kms
*/
private static final List<Block> uselessBlocks = Lists.newArrayList(
Blocks.stone_button,
Blocks.wooden_button,
Blocks.stone_pressure_plate,
Blocks.wooden_pressure_plate,
Blocks.light_weighted_pressure_plate,
Blocks.heavy_weighted_pressure_plate,
Blocks.dragon_egg,
Blocks.brewing_stand,
Blocks.chest,
Blocks.ender_chest,
Blocks.enchanting_table,
Blocks.cake,
Blocks.flower_pot,
Blocks.yellow_flower,
Blocks.red_flower,
Blocks.tallgrass,
Blocks.anvil,
Blocks.double_plant,
Blocks.sand,
Blocks.gravel,
Blocks.tripwire,
Blocks.tripwire_hook,
Blocks.carpet,
Blocks.unpowered_repeater,
Blocks.powered_repeater,
Blocks.redstone_wire,
Blocks.torch,
Blocks.redstone_torch,
Blocks.red_mushroom,
Blocks.brown_mushroom,
Blocks.lever,
Blocks.unlit_redstone_torch,
Blocks.bed,
Blocks.snow_layer,
Blocks.skull,
Blocks.stone_slab,
Blocks.stone_slab2,
Blocks.wooden_slab,
Blocks.trapdoor,
Blocks.iron_trapdoor,
Blocks.spruce_door,
Blocks.iron_trapdoor,
Blocks.oak_door,
Blocks.dark_oak_door,
Blocks.jungle_door,
Blocks.birch_door,
Blocks.acacia_door,
Blocks.golden_rail,
Blocks.detector_rail,
Blocks.rail,
Blocks.activator_rail,
Blocks.hopper,
Blocks.unpowered_comparator,
Blocks.powered_comparator
);
/**
* Enchantments used on pieces of armor
*/
private static final List<Enchantment> protectionEnchantments =
Lists.newArrayList(
Enchantment.protection,
Enchantment.projectileProtection,
Enchantment.blastProtection,
Enchantment.fireProtection
);
/**
* A list of good potions
*/
public static final List<Potion> validPotions = Lists.newArrayList(
Potion.fireResistance,
Potion.heal,
Potion.healthBoost,
Potion.moveSpeed,
Potion.digSpeed,
Potion.invisibility,
Potion.damageBoost,
Potion.regeneration,
Potion.resistance,
Potion.waterBreathing,
Potion.nightVision,
Potion.jump
);
/**
* Enchantments commonly on tools
*/
private static final List<Enchantment> toolEnchantments = Lists.newArrayList(
Enchantment.unbreaking,
Enchantment.silkTouch,
Enchantment.fortune,
Enchantment.efficiency
);
private static final Minecraft mc = Minecraft.getMinecraft();
/**
* Spoofs open your inventory
*/
public static void openInventory() {
mc.thePlayer.sendQueue.addToSendQueue(
new C0BPacketEntityAction(mc.thePlayer, Action.OPEN_INVENTORY)
);
}
/**
* Closes the current inventory
*/
public static void closeCurrentInventory() {
mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(windowId()));
}
/**
* Gets the window ID of the container you're in
*
* @return the window id of the container you're in
*/
public static int windowId() {
Container container = mc.thePlayer.openContainer;
return container == null ? 0 : container.windowId;
}
/**
* "Fixes" a slot to be used in a window click packet
*
* @param slot the slot index
* @return the packet slot
*/
public static int fix(int slot) {
return slot < 9 ? slot + 36 : slot;
}
/**
* Checks if the block is useless
*
* @param block the block
* @return if it is useless (lol)
*/
public static boolean blockUseless(Block block) {
return uselessBlocks.contains(block);
}
/**
* Checks if an item is useful
*
* @param item the item
* @return if the item is useful
*/
public static boolean useful(Item item) {
if (item instanceof ItemBlock) {
Block block = ((ItemBlock) item).getBlock();
return !uselessBlocks.contains(block);
}
return goodItems.contains(item);
}
/**
* "Scores" an {@link ItemStack}
*
* @param itemStack the item stack
* @return a score as a float
*/
public static float score(ItemStack itemStack) {
if (itemStack == null || itemStack.getItem() == null) return 0.0f;
if (itemStack.getItem() instanceof ItemArmor itemArmor) {
float score = itemArmor.damageReduceAmount;
for (Enchantment enchantment : protectionEnchantments) {
score +=
EnchantmentHelper.getEnchantmentLevel(
enchantment.effectId,
itemStack
) *
0.75f;
}
score +=
EnchantmentHelper.getEnchantmentLevel(
Enchantment.unbreaking.effectId,
itemStack
) *
0.5f;
return score;
} else if (itemStack.getItem() instanceof ItemSword sword) {
float score = 4.0f + sword.getDamageVsEntity();
score +=
EnchantmentHelper.getEnchantmentLevel(
Enchantment.unbreaking.effectId,
itemStack
) *
0.5f;
score +=
EnchantmentHelper.getEnchantmentLevel(
Enchantment.fireAspect.effectId,
itemStack
) *
0.5f;
score +=
EnchantmentHelper.getEnchantmentLevel(
Enchantment.sharpness.effectId,
itemStack
) *
0.5f;
return score;
} else if (itemStack.getItem() instanceof ItemTool tool) {
Block block = null;
if (tool instanceof ItemPickaxe) {
block = Blocks.stone;
} else if (tool instanceof ItemAxe) {
block = Blocks.log;
} else if (tool instanceof ItemSpade) {
block = Blocks.grass;
}
float score = block == null
? tool.getDamageVsEntity()
: tool.getStrVsBlock(itemStack, Blocks.stone);
for (Enchantment enchantment : toolEnchantments) {
score +=
EnchantmentHelper.getEnchantmentLevel(
enchantment.effectId,
itemStack
) *
0.75f;
}
return score;
} else if (itemStack.getItem() instanceof ItemHoe) {
float score = itemStack
.getItem()
.getStrVsBlock(itemStack, Blocks.hay_block);
for (Enchantment enchantment : toolEnchantments) {
score +=
EnchantmentHelper.getEnchantmentLevel(
enchantment.effectId,
itemStack
) *
0.75f;
}
return score;
} else if (itemStack.getItem() instanceof ItemBow) {
float score = 1.0f;
score +=
EnchantmentHelper.getEnchantmentLevel(
Enchantment.knockback.effectId,
itemStack
) *
0.75f;
score +=
EnchantmentHelper.getEnchantmentLevel(
Enchantment.flame.effectId,
itemStack
) *
0.75f;
score +=
EnchantmentHelper.getEnchantmentLevel(
Enchantment.punch.effectId,
itemStack
) *
0.75f;
return score;
}
return 1.0f;
}
}
// NOTE (AI): The C0D send is the closeCurrentInventory method; windowId() resolves the real container id instead of hardcoding 0.Expose C0D to November's Lua scripting API as id 0x0D with a direction, letting scripts intercept window closes.
The static packetIds table maps C0DPacketCloseWindow.class to 0x0D; the wrapper constructor copies id and direction ('out' for serverbound) from the EventPacket so Lua scripts can match on the numeric id.
// ===== FILE: November Recode 2.0, scripting/wrapper/event/LuaEventPacket.java =====
/* November.lol © 2023 */
package lol.november.scripting.wrapper.event;
import java.util.HashMap;
import java.util.Map;
import lol.november.listener.event.net.EventPacket;
import lol.november.protect.DontObfuscate;
import lombok.Getter;
import lombok.Setter;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.*;
/**
* @author Gavin
* @since 2.0.0
*/
@Getter
@Setter
@DontObfuscate
public class LuaEventPacket {
/**
* A map of each {@link Packet} to their id
*/
private static final Map<Class<? extends Packet<?>>, Integer> packetIds =
new HashMap<>();
static {
// you may ask: why not use reflection and just.. do a funny?
// obfuscation eventually happens so this aids has to happen
packetIds.put(C0APacketAnimation.class, 0x0A);
packetIds.put(C0BPacketEntityAction.class, 0x0B);
packetIds.put(C0CPacketInput.class, 0x0C);
packetIds.put(C0DPacketCloseWindow.class, 0x0D);
packetIds.put(C0EPacketClickWindow.class, 0x0E);
packetIds.put(C0FPacketConfirmTransaction.class, 0x0F);
packetIds.put(C00PacketKeepAlive.class, 0x00);
packetIds.put(C01PacketChatMessage.class, 0x01);
packetIds.put(C02PacketUseEntity.class, 0x02);
packetIds.put(C03PacketPlayer.class, 0x03);
packetIds.put(C03PacketPlayer.C04PacketPlayerPosition.class, 0x04);
packetIds.put(C03PacketPlayer.C05PacketPlayerLook.class, 0x05);
packetIds.put(C03PacketPlayer.C06PacketPlayerPosLook.class, 0x06);
packetIds.put(C07PacketPlayerDigging.class, 0x07);
packetIds.put(C08PacketPlayerBlockPlacement.class, 0x08);
packetIds.put(C09PacketHeldItemChange.class, 0x09);
packetIds.put(C10PacketCreativeInventoryAction.class, 0x10);
packetIds.put(C11PacketEnchantItem.class, 0x11);
packetIds.put(C12PacketUpdateSign.class, 0x12);
packetIds.put(C13PacketPlayerAbilities.class, 0x13);
packetIds.put(C14PacketTabComplete.class, 0x14);
packetIds.put(C15PacketClientSettings.class, 0x15);
packetIds.put(C16PacketClientStatus.class, 0x16);
packetIds.put(C17PacketCustomPayload.class, 0x17);
packetIds.put(C18PacketSpectate.class, 0x18);
packetIds.put(C19PacketResourcePackStatus.class, 0x19);
}
private final int packet;
private final String direction;
public LuaEventPacket(EventPacket event) {
packet = packetIds.getOrDefault(event.get().getClass(), -1);
direction = event.get() instanceof EventPacket.Out ? "out" : "in";
}
}
// NOTE (AI): C0D is registered as 0x0D alongside the other serverbound play packets.anticheat Anti-Cheat Checks
C0D is the one serverbound packet in this batch, and it is a state signal: closing a window flips the server-side inventory-open state, which is what inventory-move and chest-stealer detection keys on. Real consumers are Azure InvTweaksA (close while sprinting), Daedalus ActionProcessor (close clears openInventory), Intave InventoryTracker (close state plus the beacon special case) and Kauri's PacketHandler (both directions). The rest is wrappers (Artemis GPacketPlayClientWindowClose, FlopAC WrappedInCloseWindowPacket, BendEye-Perus isCloseWindow) and one keyword hit that never reads the packet: FlopAC InventoryC is a click-delay chest-stealer check driven by WINDOW_CLICK events.
Classic inventory-tweaks detection: closing a window while sprinting is the walking-with-inventory-open tell.
InvTweaksA hooks the inbound packet stream and checks the type: when PacketPlayInCloseWindow arrives while the Bukkit player is sprinting, it calls onViolation with a 60000 ms cooldown. Azure's PlayerStats also records the close-window type in its per-packet stats.
// ===== FILE: AimbotPvP-azure-anticheat, src/main/java/us/skidrevenant/azure/check/checks/misc/invtweaks/InvTweaksA.java =====
package us.skidrevenant.azure.check.checks.misc.invtweaks;
import net.minecraft.server.v1_8_R3.Packet;
import net.minecraft.server.v1_8_R3.PacketPlayInCloseWindow;
import us.skidrevenant.azure.check.Check;
import us.skidrevenant.azure.stats.PlayerStats;
/**
* @author SkidRevenant
* at 03/06/2018
*/
public class InvTweaksA extends Check {
public InvTweaksA(PlayerStats player) {
super(player);
}
@Override
public void onPacketReceiving(Class<? extends Packet> type, Packet packet) {
if (type == PacketPlayInCloseWindow.class && player.getBukkitPlayer().isSprinting()) {
onViolation("InvTweaks Type A", 60000L, 0);
}
}
}
// NOTE (AI): The PacketPlayInCloseWindow branch is line 19; Azure PlayerStats.java line 68 also counts the close-window type in its packet stats.State sync: a close-window packet clears the openInventory flag that Daedalus's inventory and movement checks read.
ActionProcessor is fed by PacketListeners, which wraps the inbound close-window packet (line 103) and calls the update overload. The close-window overload sets openInventory = false, paired with the C0B OPEN_INVENTORY branch of the entity-action overload that sets it true. Checks that must know whether the player has a GUI open read the flag.
// ===== FILE: funkemunky-Daedalus, Daedalus/src/cc/funkemunky/anticheat/api/data/processors/ActionProcessor.java =====
package cc.funkemunky.anticheat.api.data.processors;
import cc.funkemunky.anticheat.api.data.PlayerData;
import cc.funkemunky.api.Atlas;
import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInCloseWindowPacket;
import cc.funkemunky.api.tinyprotocol.packet.in.WrappedInEntityActionPacket;
import cc.funkemunky.api.utils.TickTimer;
import lombok.Getter;
@Getter
public class ActionProcessor {
private boolean sprinting, openInventory, sneaking, flyFall, horseJump, isUsingItem;
private TickTimer lastUseItem = new TickTimer(10);
public void update(WrappedInEntityActionPacket packet) {
switch(packet.getAction()) {
case START_SPRINTING:
sprinting = true;
break;
case STOP_SPRINTING:
sprinting = false;
break;
case OPEN_INVENTORY:
openInventory = true;
break;
case START_SNEAKING:
sneaking = true;
break;
case STOP_SNEAKING:
sneaking = false;
break;
case START_FALL_FLYING:
flyFall = true;
break;
case START_RIDING_JUMP:
horseJump = true;
break;
case STOP_RIDING_JUMP:
horseJump = false;
break;
}
}
public void update(WrappedInCloseWindowPacket packet) {
openInventory = false;
}
public void update(PlayerData data) {
if ((isUsingItem = Atlas.getInstance().getBlockBoxManager().getBlockBox().isUsingItem(data.getPlayer()))) {
lastUseItem.reset();
}
}
}
// NOTE (AI): The close-window overload is lines 44-46; the OPEN_INVENTORY counterpart is the entity-action overload at lines 15-42. PacketListeners.java line 103 constructs the WrappedInCloseWindowPacket that feeds this processor.Track the player's inventory-open state from the close-window packet, with a workaround for the beacon window that never sends one.
InventoryTracker subscribes to the CLOSE_WINDOW inbound packet at LOW priority and closes the inventory: receiveCloseWindow calls closeInventory, which flips InventoryMetadata's open state to false. On the open side it special-cases the beacon container: since the client never sends a close packet for a beacon window, opening one skips the open-state update entirely, so the tracking never gets stuck with a stale open inventory.
// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/module/tracker/player/InventoryTracker.java =====
package de.jpx3.intave.module.tracker.player;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.wrappers.EnumWrappers;
import com.comphenix.protocol.wrappers.WrappedChatComponent;
import de.jpx3.intave.block.collision.Collision;
import de.jpx3.intave.block.type.BlockTypeAccess;
import de.jpx3.intave.module.Module;
import de.jpx3.intave.module.Modules;
import de.jpx3.intave.module.linker.packet.ListenerPriority;
import de.jpx3.intave.module.linker.packet.PacketId;
import de.jpx3.intave.module.linker.packet.PacketSubscription;
import de.jpx3.intave.packet.reader.WindowItemReader;
import de.jpx3.intave.user.User;
import de.jpx3.intave.user.UserRepository;
import de.jpx3.intave.user.meta.InventoryMetadata;
import de.jpx3.intave.user.meta.MovementMetadata;
import org.bukkit.entity.Player;
import java.util.List;
import java.util.stream.Collectors;
import static de.jpx3.intave.module.linker.packet.PacketId.Client.CLIENT_COMMAND;
import static de.jpx3.intave.module.linker.packet.PacketId.Server.*;
public final class InventoryTracker extends Module {
//////////////////////////////////////////////////////////////////////////////
// Open Inventory
//////////////////////////////////////////////////////////////////////////////
/**
* Tracks if the server forces a player to open an inventory by listening to
* the {@link de.jpx3.intave.module.linker.packet.PacketId.Server#OPEN_WINDOW}
* packet.
*/
@PacketSubscription(
priority = ListenerPriority.HIGH,
packetsOut = {
OPEN_WINDOW
},
ignoreCancelled = false
)
public void sentOpenInventory(PacketEvent event) {
Player player = event.getPlayer();
User user = UserRepository.userOf(player);
InventoryMetadata inventoryData = user.meta().inventory();
PacketContainer packet = event.getPacket();
// For some reason the client doesn't send a close window packet after closing
// the beacon window. Therefore, we pretend the player does not have an open
// inventory if he opens the beacon window to avoid further issues.
WrappedChatComponent chatComponent = packet.getChatComponents().read(0);
String json = chatComponent.getJson();
boolean clientDoesNotSendCloseWindow = json.contains("container.beacon");
if (!clientDoesNotSendCloseWindow) {
Modules.feedback()
.synchronize(player, null, (p, x) -> openInventory(p));
inventoryData.forceInventoryOnClickOpen = true;
} else {
inventoryData.forceInventoryOnClickOpen = false;
}
}
/**
* Tracks if the client opens the inventory by listening to the
* {@link de.jpx3.intave.module.linker.packet.PacketId.Client#CLIENT_COMMAND}
* packet.
* However, this functionality was removed in Minecraft 1.9.
*/
@PacketSubscription(
priority = ListenerPriority.LOW,
packetsIn = {
CLIENT_COMMAND
}
)
public void receiveClientCommand(PacketEvent event) {
Player player = event.getPlayer();
EnumWrappers.ClientCommand clientCommand = event.getPacket().getClientCommands().read(0);
if (clientCommand == EnumWrappers.ClientCommand.OPEN_INVENTORY_ACHIEVEMENT) {
openInventory(player);
}
}
/**
* Updates the inventory's state of the specified player internally.
*
* @param player The player
*/
private void openInventory(Player player) {
User user = UserRepository.userOf(player);
InventoryMetadata inventoryData = user.meta().inventory();
if (!inNetherPortal(user)) {
inventoryData.updateInventoryOpenState(true);
}
}
/**
* Checks whether the specified user is inside a nether portal.
*
* @param user The user
* @return whether the user is inside a nether portal
*/
private boolean inNetherPortal(User user) {
MovementMetadata movementData = user.meta().movement();
return Collision.rasterizedTypeSearch(user, movementData.boundingBox(), BlockTypeAccess.NETHER_PORTAL);
}
//////////////////////////////////////////////////////////////////////////////
// Close Inventory
//////////////////////////////////////////////////////////////////////////////
/**
* Tracks if the server forces a player to close the inventory by listening to
* the {@link de.jpx3.intave.module.linker.packet.PacketId.Server#CLOSE_WINDOW}
* packet.
*/
@PacketSubscription(
priority = ListenerPriority.HIGH,
packetsOut = {
PacketId.Server.CLOSE_WINDOW
},
ignoreCancelled = false
)
public void sentCloseInventory(PacketEvent event) {
Player player = event.getPlayer();
Modules.feedback()
.synchronize(player, null, (p, x) -> closeInventory(p));
}
/**
* Tracks if the player closes the inventory by listening to the
* {@link de.jpx3.intave.module.linker.packet.PacketId.Client#CLOSE_WINDOW}
* packet.
*/
@PacketSubscription(
priority = ListenerPriority.LOW,
packetsIn = {
PacketId.Client.CLOSE_WINDOW
}
)
public void receiveCloseWindow(PacketEvent event) {
closeInventory(event.getPlayer());
}
/**
* Updates the inventory's state of the specified internally.
*
* @param player The player
*/
private void closeInventory(Player player) {
User user = UserRepository.userOf(player);
InventoryMetadata inventoryData = user.meta().inventory();
inventoryData.updateInventoryOpenState(false);
}
/**
* Closes a player's inventory if the player dies internally by listening to
* Bukkit's {@link org.bukkit.event.player.PlayerRespawnEvent}.
*/
@PacketSubscription(
priority = ListenerPriority.HIGH,
packetsOut = {
RESPAWN
},
ignoreCancelled = false
)
public void sentRespawn(PacketEvent event) {
Player player = event.getPlayer();
User user = UserRepository.userOf(player);
InventoryMetadata inventoryData = user.meta().inventory();
inventoryData.updateInventoryOpenState(false);
}
@PacketSubscription(
packetsOut = {WINDOW_ITEMS}
)
public void on(
User user, WindowItemReader reader
) {
if (reader.windowId() == 0) {
List<String> collect = reader.itemMap().values().stream().map(itemStack -> itemStack.getType().name()).collect(Collectors.toList());
user.tickFeedback(() -> user.meta().inventory().setItems(collect));
// System.out.println(collect);
}
}
}
// NOTE (AI): receiveCloseWindow is lines 144-149; the beacon no-close-window workaround is lines 50-63 inside sentOpenInventory. BaseStage.java line 475 reads the ChestStealer violation history produced from this tracker's state.Related Packets
Wiki Cross-Reference
Vanilla clients send a close-window packet with window ID 0 to close their own inventory even though no open packet is ever sent for it.
MCP 1.8.9 C0DPacketCloseWindow implements Packet
1.8.9 callers: EntityPlayerSP.closeScreen sends new C0DPacketCloseWindow (line 332): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/client/entity/EntityPlayerSP.java
Cross-checked against minecraft.wiki (CC BY-SA 3.0) for 1.8.9 accuracy.
Vanilla Internals
Full 1.8.9 logic-class sources that send or handle this packet, stored verbatim.
Module Analyses Using C0DPacketCloseWindow
Full source walkthroughs of the modules and anti-cheats that use this packet.