0x07 S07PacketRespawn
Sends respawn or dimension change request. The client must reload the world (clear chunks, entities) and re-sync position.
Published 2026-06-18 · Updated 2026-10-14
Fields
| Field | Type | Description |
|---|---|---|
| dimensionId | int | -1=nether, 0=overworld, 1=end |
| difficulty | unsigned byte | Current server difficulty |
| gamemode | unsigned byte | Current gamemode |
| worldType | String | World type string |
Wire Encoding
| Field | Type | Notes |
|---|---|---|
| Dimension | int | -1=nether, 0=overworld, 1=end |
| Difficulty | unsigned byte | 0=peaceful, 1=easy, 2=normal, 3=hard |
| Gamemode | unsigned byte | 0=survival, 1=creative, 2=adventure, 3=spectator |
| Level Type | String | World type |
MCP References
NetHandlerPlayClient.handleRespawn()Handler Interface
INetHandlerPlayClientNotes
Vanilla Source
| 1 | |
| 2 | |
| 3 | |
| 4 | |
| 5 | |
| 6 | |
| 7 | |
| 8 | |
| 9 | |
| 10 | |
| 11 | |
| 12 | |
| 13 | |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
Deobfuscated MCP 1.8.9 source of S07PacketRespawn, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/server/S07PacketRespawn.java) at build time and verified present.
Deep Dive
Role in the protocol
The respawn and dimension-change control. The server sends it on death respawn (ServerConfigurationManager line ~496), on portal dimension transfer (NetHandlerPlayServer line ~587, ServerConfigurationManager line ~473) and on gamemode changes; the payload is dimension id, difficulty, terrain type and gamemode. The client must treat it as a world-reload command: clear entities, rebuild chunk state, re-arm keepalive and re-sync position.
Vanilla handling
handleRespawn branches on the dimension: an equal dimension is a soft reset that rebuilds the player entity in place, a different dimension triggers a full world load with chunks unloaded, entities cleared and the player respawned. PacketThreadUtil special-cases S07 so the reload runs on the main thread and pre-processes the world transition before ordinary packet handling resumes. Every module that buffers per-world state (blink queues, transaction lists, teleport buffers, freecam position) must flush on this packet or carry stale state across the boundary.
Why clients touch it
The corpus reaction surface is exactly the flush pattern, and it lives in the disabler machinery. Rise 6.1.30 WatchdogDisabler clears its position, transaction and blink queues plus both stopwatches on S07; Rise 6.2.4 keeps only the import. UniversoCraftDisabler (both builds) uses S07 to arm a respawn-window transaction corruption. Tenacity 6.0 AdvancedDisablerModule carries a commented-out S07 import, evidence the reset was planned and disabled. No Freecam, AutoTool or inventory module hooks S07 in this corpus even though world reload visibly resets their state; those clients rely on vanilla world-load callbacks instead of the packet. LiquidSense Dev's MixinNetworkManager promotes S07 to a first-class EventRespawn: readpacket fires it right before the vanilla handler runs, giving every module a hookable world-reload signal.
Exploit surface
The respawn window is the attack surface: after S07 the server re-arms the player's transaction stream, so replaying C0F uids from the previous world desynchronizes the server's bookkeeping. UniversoCraftDisabler weaponizes the window by overwriting C0F uids with Short.MIN_VALUE or Short.MAX_VALUE for the first 350 ticks after respawn, alternating on tick parity. Anti-cheats that key transaction continuity off confirm/transaction pairs are the target. S07 itself is server-authored and not client-spoofable in the vanilla protocol, so the client side is purely defensive: flush old state, then corrupt the new window.
Server-Side Handling
ServerConfigurationManager sends S07 on death respawn (line ~496) and on dimension transfer (line ~473), NetHandlerPlayServer sends it on its own dimension-change path (line ~587 in MCP builds), always with the player's current dimension, difficulty, terrain type and gamemode. After sending, the server waits for the client's position re-sync (C03/C06) before resuming normal tracking. The client never sends S07; the closest serverbound step is C16 PERFORM_RESPAWN from the death screen.
Protocol Analysis
Fields in order: int dimension, unsigned byte difficulty, unsigned byte gamemode, String level type. PacketThreadUtil pre-processes S07 in Rise 6.1.30/6.2.4 and Tenacity (lines ~31 and ~40 respectively), forcing the world transition onto the main thread ahead of queued packets. The dimension field is the branch key: equal dimension means soft reset, different dimension means full reload, and modules keying state resets on S07 catch both cases in one hook.
Anti-Cheat Landscape
Transaction-continuity anti-cheats (Watchdog, Verus) reset their per-player counters on respawn, which is why stale C0F uids replayed across the boundary flag. The UniversoCraft corruption window targets exactly this reset: uid values of Short.MIN_VALUE and Short.MAX_VALUE alternating on tick parity are chosen to break the server's expectation of monotonic actions without a visible cancel pattern. The flush side (WatchdogDisabler) is the defensive mirror and is invisible; the corruption side is the detectable one if the server validates uids.
implementation Implementation Cases
The world-reload command: death respawn, portal transfer and gamemode change all arrive as S07, and the client tears down and rebuilds world state in response. In this corpus the packet is consumed by disabler state machines (Rise WatchdogDisabler flush, UniversoCraftDisabler corruption window) and was planned-but-disabled in Tenacity's AdvancedDisablerModule. LiquidSense Dev turns the packet into a dedicated EventRespawn fired from its NetworkManager mixin.
Hypixel Watchdog disabler mode that uses S07 as the hard reset point for its buffered packet state.
On PacketReceiveEvent, S07 clears positionQueue, transactionQueue, blinkQueue and actionNumbers, resets pingStopwatch and transactionStopwatch and sets disabled=false. This is the defensive flush: after respawn or dimension change the old world's transaction stream is dead, so stale C0F uids and queued positions would desync the new world. The ping-spoof branch then restarts collecting negative-action S32 transactions, shuffling and replaying them a second later.
// ===== FILE: Rise 6.1.30, com/alan/clients/module/impl/exploit/disabler/WatchdogDisabler.java =====
package com.alan.clients.module.impl.exploit.disabler;
import com.alan.clients.event.Listener;
import com.alan.clients.event.annotations.EventLink;
import com.alan.clients.event.impl.motion.PreMotionEvent;
import com.alan.clients.event.impl.other.TeleportEvent;
import com.alan.clients.event.impl.packet.PacketReceiveEvent;
import com.alan.clients.event.impl.packet.PacketSendEvent;
import com.alan.clients.module.impl.exploit.Disabler;
import com.alan.clients.value.Mode;
import com.alan.clients.value.impl.BooleanValue;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C0DPacketCloseWindow;
import net.minecraft.network.play.client.C0EPacketClickWindow;
import net.minecraft.network.play.client.C0FPacketConfirmTransaction;
import net.minecraft.network.play.client.C16PacketClientStatus;
import net.minecraft.network.play.server.S07PacketRespawn;
import net.minecraft.network.play.server.S32PacketConfirmTransaction;
import net.minecraft.util.Vec3;
import rip.vantage.commons.util.time.StopWatch;
import java.util.*;
public class WatchdogDisabler extends Mode<Disabler> {
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;
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 morePackets = new BooleanValue("More Packets", this, false);
public final BooleanValue ban = new BooleanValue("Ping Spoof", this, false);
public final BooleanValue inventory = new BooleanValue("Inventory", this, false);
@EventLink
private final Listener<TeleportEvent> onTeleport = event -> {
};
@EventLink
private final Listener<PreMotionEvent> preMotionEventListener = event -> {
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;
}
}
};
@EventLink
private final Listener<PacketReceiveEvent> packetReceiveEventListener = event -> {
if (event.getPacket() instanceof S07PacketRespawn) {
this.positionQueue.clear();
this.transactionQueue.clear();
this.pingStopwatch.reset();
this.blinkQueue.clear();
this.transactionStopwatch.reset();
this.actionNumbers.clear();
this.disabled = false;
}
if (ban.getValue()) {
if (event.getPacket() instanceof S32PacketConfirmTransaction) {
final S32PacketConfirmTransaction transaction = (S32PacketConfirmTransaction) event.getPacket();
if (transaction.getActionNumber() < 0) {
if (!this.disabled) {
this.actionNumbers.add(transaction.getActionNumber());
transactionStopwatch.reset();
event.setCancelled(true);
}
}
}
}
};
@EventLink
private final Listener<PacketSendEvent> packetSendEventListener = event -> {
if (inventory.getValue()) {
if (event.getPacket() instanceof C0EPacketClickWindow && ((C0EPacketClickWindow) event.getPacket()).getWindowId() == mc.thePlayer.inventoryContainer.windowId && !(mc.currentScreen instanceof GuiInventory)) {
event.setCancelled();
mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(new C16PacketClientStatus(C16PacketClientStatus.EnumState.OPEN_INVENTORY_ACHIEVEMENT));
mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(event.getPacket());
mc.getNetHandler().getNetworkManager().sendUnregisteredPacket(new C0DPacketCloseWindow(mc.thePlayer.inventoryContainer.windowId));
}
}
};
}
// NOTE (AI): This is the Rise 6.1.30 copy; the S07 handler at line 68 is live here. In
// Rise 6.2.4 the S07PacketRespawn import remains (line 42) but the receive-side flush was
// removed, so 6.2.4 no longer resets state on respawn. The module is a Mode of the Disabler
// module and its S07 handling is purely defensive: it guarantees no buffered transaction or
// position from the pre-respawn world leaks into the new world's stream.
UniversoCraft disabler mode that arms a respawn-window transaction corruption from the S07 packet.
On the packet send listener, S07 sets disabling=true; C02PacketUseEntity clears it; C03PacketPlayer within the first 10 ticks sets it; and while disabling with ticksExisted below 350, every C0FPacketConfirmTransaction gets its uid overwritten with Short.MIN_VALUE or Short.MAX_VALUE alternating on tick parity. The S07 branch is redundant in practice because the C03-within-10-ticks branch arms the same flag, and its usefulness depends on the client's event wiring delivering clientbound packets to this listener.
// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/disabler/UniversoCraftDisabler.java =====
package com.alan.clients.module.impl.exploit.disabler;
import com.alan.clients.event.Listener;
import com.alan.clients.event.annotations.EventLink;
import com.alan.clients.event.impl.packet.PacketSendEvent;
import com.alan.clients.module.impl.exploit.Disabler;
import com.alan.clients.value.Mode;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.C02PacketUseEntity;
import net.minecraft.network.play.client.C03PacketPlayer;
import net.minecraft.network.play.client.C0FPacketConfirmTransaction;
import net.minecraft.network.play.server.S07PacketRespawn;
public class UniversoCraftDisabler extends Mode<Disabler> {
private boolean disabling;
public UniversoCraftDisabler(String name, Disabler parent) {
super(name, parent);
}
@EventLink
public final Listener<PacketSendEvent> onPacketSend = event -> {
Packet<?> packet = event.getPacket();
if (packet instanceof S07PacketRespawn) {
disabling = true;
} else if (packet instanceof C02PacketUseEntity) {
disabling = false;
} else if (packet instanceof C03PacketPlayer && mc.thePlayer.ticksExisted <= 10) {
disabling = true;
} else if (packet instanceof C0FPacketConfirmTransaction && disabling && mc.thePlayer.ticksExisted < 350) {
((C0FPacketConfirmTransaction) event.getPacket()).setUid(
mc.thePlayer.ticksExisted % 2 == 0 ? Short.MIN_VALUE : Short.MAX_VALUE);
}
};
}
// NOTE (AI): S07PacketRespawn is tested inside a PacketSendEvent listener even though it
// is a clientbound packet; in Rise's event pipeline this branch only matters if clientbound
// traffic reaches the send listener, otherwise the flag is armed exclusively by the C03
// branch (first 10 ticks). The corruption window (ticksExisted < 350, alternating
// Short.MIN_VALUE / Short.MAX_VALUE uids) targets transaction-continuity checks on
// UniversoCraft, and the disabling flag is cleared by any C02 attack.
Fire a dedicated EventRespawn on the LiquidBounce event bus whenever S07PacketRespawn arrives, giving every module a hookable world-reload signal at the exact boundary.
readpacket injects into NetworkManager.channelRead0 right before Packet.processPacket runs: it posts EventPacketReceive and, when the packet is an S07PacketRespawn, also posts EventRespawn before the vanilla handler executes, then cancels the read if the event was cancelled.
// ===== FILE: LiquidSense Dev, net/ccbluex/liquidbounce/injection/forge/mixins/network/MixinNetworkManager.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.injection.forge.mixins.network;
import io.netty.channel.Channel;
import io.netty.channel.ChannelHandlerContext;
import net.ccbluex.liquidbounce.LiquidBounce;
import net.ccbluex.liquidbounce.event.EventPacketReceive;
import net.ccbluex.liquidbounce.event.EventRespawn;
import net.ccbluex.liquidbounce.event.PacketEvent;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet;
import net.minecraft.network.play.server.S07PacketRespawn;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(NetworkManager.class)
public class MixinNetworkManager {
@Shadow
private Channel channel;
@Inject(method = "channelRead0", at = @At("HEAD"), cancellable = true)
private void read(ChannelHandlerContext context, Packet<?> packet, CallbackInfo callback) {
final PacketEvent event = new PacketEvent(packet);
LiquidBounce.eventManager.callEvent(event);
if(event.isCancelled())
callback.cancel();
}
@Inject(method = "channelRead0", at = @At(value = "INVOKE", target = "Lnet/minecraft/network/Packet;processPacket(Lnet/minecraft/network/INetHandler;)V", shift = At.Shift.BEFORE), cancellable = true)
private void readpacket(ChannelHandlerContext context, Packet packet, CallbackInfo callback) {
if (this.channel.isOpen()) {
EventPacketReceive event = new EventPacketReceive(packet);
LiquidBounce.eventManager.callEvent(event);
if (packet instanceof S07PacketRespawn) {
EventRespawn eventRespawn = new EventRespawn();
LiquidBounce.eventManager.callEvent(eventRespawn);
}
if (event.isCancelled()) {
callback.cancel();
}
}
}
@Inject(method = "sendPacket(Lnet/minecraft/network/Packet;)V", at = @At("HEAD"), cancellable = true)
private void send(Packet<?> packet, CallbackInfo callback) {
final PacketEvent event = new PacketEvent(packet);
LiquidBounce.eventManager.callEvent(event);
if(event.isCancelled())
callback.cancel();
}
}
// NOTE (AI): EventRespawn is fired synchronously before vanilla handleRespawn runs, so modules subscribed to it reset per-world state before the world reload touches entities. The same mixin hosts the client's global packet pipeline: PacketEvent on both channelRead0 (HEAD) and sendPacket, and EventPacketReceive before processPacket.anticheat Anti-Cheat Checks
The respawn packet is a state-reset command: the world reloads, so every anticheat that keeps per-player state must re-arm it on respawn. Simulation anticheats parse WrapperPlayServerRespawn on the send side and rebuild their player model (Grim, Shard, Artemis), while classic anticheats zero grace timers on PlayerRespawnEvent so freshly respawned players are not flagged by movement and combat checks. The packet itself is never flagged; it is the boundary that makes the checks after it trustworthy.
Reset the entire simulated player model on respawn and dimension change: positions, ground flags, attributes, entity list and the death-screen state.
The RESPAWN branch wraps the packet as WrapperPlayServerRespawn, invalidates the setback teleport (hasAcceptedSpawnTeleport = false), clears server entity positions on world change, and schedules a real-time task that resets onGround, pose, sprinting, food, known input, the self PacketEntity and the BadPacketsE/G/M/F state. KEEP_TRACKED_DATA and KEEP_ATTRIBUTES flags decide what survives on 1.20.2+; isWorldChange compares world name or dimension type to detect cross-dimension teleports that wipe chunks and entities.
// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketPlayerRespawn.java =====
package ac.grim.grimac.events.packets;
import ac.grim.grimac.GrimAPI;
import ac.grim.grimac.checks.impl.badpackets.*;
import ac.grim.grimac.checks.impl.elytra.ElytraC;
import ac.grim.grimac.player.GrimPlayer;
import ac.grim.grimac.utils.data.KnownInput;
import ac.grim.grimac.utils.data.SprintingState;
import ac.grim.grimac.utils.data.TrackerData;
import ac.grim.grimac.utils.data.packetentity.PacketEntitySelf;
import ac.grim.grimac.utils.enums.Pose;
import ac.grim.grimac.utils.math.Vector3dm;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.event.PacketListenerAbstract;
import com.github.retrooper.packetevents.event.PacketListenerPriority;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.entity.type.EntityTypes;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.util.Vector3d;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerJoinGame;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerRespawn;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateHealth;
import java.util.Objects;
/**
* PlayerRespawnS2CPacket info (1.20.2+):
* If the world is different (check via registry key), world is recreated (all entities etc destroyed).
* <p>
* Client player is ALWAYS recreated
* <p>
* If the packet has the `KEEP_TRACKED_DATA` flag:
* Sneaking and Sprinting fields are kept on the new client player.
* <p>
* If the packet has the `KEEP_ATTRIBUTES` flag:
* Attributes are kept.
* <p>
* New client player is initialised:
* Pose is set to standing.
* Velocity is set to zero.
* Pitch is set to 0.
* Yaw is set to -180.
*/
// TODO update for 1.20.2-
public class PacketPlayerRespawn extends PacketListenerAbstract {
private static final byte KEEP_ATTRIBUTES = 1;
private static final byte KEEP_TRACKED_DATA = 2;
private static final byte KEEP_ALL = 3;
public PacketPlayerRespawn() {
super(PacketListenerPriority.HIGH);
}
private boolean hasFlag(WrapperPlayServerRespawn respawn, byte flag) {
// This packet was added in 1.16
if (flag == KEEP_ATTRIBUTES) {
// On versions older than 1.15, via does not keep all attributes.
// https://github.com/ViaVersion/ViaVersion/blob/master/common/src/main/java/com/viaversion/viaversion/protocols/v1_15_2to1_16/rewriter/EntityPacketRewriter1_16.java#L124
if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_15)) {
return false;
}
} else if (flag == KEEP_TRACKED_DATA) {
// But for metadata, via DOES keep all data
if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_15)) {
return true;
}
}
return (respawn.getKeptData() & flag) != 0;
}
@Override
public void onPacketSend(PacketSendEvent event) {
if (event.getPacketType() == PacketType.Play.Server.UPDATE_HEALTH) {
WrapperPlayServerUpdateHealth health = new WrapperPlayServerUpdateHealth(event);
GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());
if (player == null) return;
//
if (player.packetStateData.lastFood == health.getFood()
&& player.packetStateData.lastHealth == health.getHealth()
&& player.packetStateData.lastSaturation == health.getFoodSaturation()
&& PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_9))
return;
player.packetStateData.lastFood = health.getFood();
player.packetStateData.lastHealth = health.getHealth();
player.packetStateData.lastSaturation = health.getFoodSaturation();
player.sendTransaction();
if (health.getFood() == 20) { // Split so transaction before packet
player.latencyUtils.addRealTimeTask(player.lastTransactionReceived.get(), () -> player.food = 20);
} else { // Split so transaction after packet
player.latencyUtils.addRealTimeTask(player.lastTransactionReceived.get() + 1, () -> player.food = health.getFood());
}
if (health.getHealth() <= 0) {
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {
player.compensatedEntities.self.isDead = true;
player.checkManager.getCheck(BadPacketsM.class).onDeath();
});
} else {
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.compensatedEntities.self.isDead = false);
}
event.getTasksAfterSend().add(player::sendTransaction);
}
if (event.getPacketType() == PacketType.Play.Server.JOIN_GAME) {
GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());
if (player == null) return;
WrapperPlayServerJoinGame joinGame = new WrapperPlayServerJoinGame(event);
player.gamemode = joinGame.getGameMode();
player.entityID = joinGame.getEntityId();
player.dimensionType = joinGame.getDimensionType();
player.worldName = joinGame.getWorldName();
if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_15)
&& event.getServerVersion().isNewerThanOrEquals(ServerVersion.V_1_15)) {
player.packetStateData.showsDeathScreen = joinGame.isRespawnScreenEnabled();
}
if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_17))
return;
player.compensatedWorld.setDimension(joinGame.getDimensionType(), event.getUser());
}
if (event.getPacketType() == PacketType.Play.Server.RESPAWN) {
WrapperPlayServerRespawn respawn = new WrapperPlayServerRespawn(event);
GrimPlayer player = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());
if (player == null) return;
player.sendTransaction();
event.getTasksAfterSend().add(player::sendTransaction);
// Force the player to accept a teleport before respawning
// (We won't process movements until they accept a teleport, we won't let movements though either)
// Also invalidate previous positions
player.getSetbackTeleportUtil().hasAcceptedSpawnTeleport = false;
player.getSetbackTeleportUtil().lastKnownGoodPosition = null;
// clear server entity positions when the world changes
if (isWorldChange(player, respawn)) {
player.compensatedEntities.serverPositionsMap.clear();
}
player.addRealTimeTaskNow(player.cameraEntity::reset);
player.addRealTimeTaskNext(() -> {
// From 1.16 to 1.19, this doesn't get set to false for whatever reason
if (player.getClientVersion().isOlderThan(ClientVersion.V_1_16) || player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_20)) {
player.isSneaking = false;
}
player.lastOnGround = false;
player.clientClaimsLastOnGround = false;
player.onGround = false;
player.isInBed = false;
player.packetStateData.setSlowedByUsingItem(false);
player.packetStateData.packetPlayerOnGround = false; // If somewhere else pulls last ground to fix other issues
player.packetStateData.lastClaimedPosition = new Vector3d();
player.filterMojangStupidityOnMojangStupidity.zero();
player.checkManager.getCheck(BadPacketsM.class).onRespawn();
final boolean keepTrackedData = this.hasFlag(respawn, KEEP_TRACKED_DATA);
if (!keepTrackedData) {
player.food = 20;
player.powderSnowFrozenTicks = 0;
player.compensatedEntities.self.hasGravity = true;
player.playerEntityHasGravity = true;
player.packetStateData.knownInput = KnownInput.DEFAULT;
player.checkManager.getCheck(ElytraC.class).exempt = true;
// 1.19.4 uses current sprinting, older versions use last sprinting
if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_19_4)) {
player.isSprinting = false;
player.vehicleData.camelSprintingState = SprintingState.STOPPED;
} else {
player.lastSprintingForSpeed = false;
}
}
player.checkManager.getCheck(BadPacketsE.class).handleRespawn(); // Reminder ticks reset
player.checkManager.getCheck(BadPacketsG.class).handleRespawn();
// compensate for immediate respawn gamerule
if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_15)) {
player.checkManager.getCheck(BadPacketsF.class).exemptNext = true;
}
// EVERYTHING gets reset on a cross dimensional teleport, clear chunks and entities!
if (isWorldChange(player, respawn)) {
player.compensatedEntities.entityMap.clear();
player.compensatedWorld.activePistons.clear();
player.compensatedWorld.openShulkerBoxes.clear();
player.compensatedWorld.chunks.clear();
player.compensatedGeysers.clear();
player.compensatedWorld.isRaining = false;
player.checkManager.getCheck(BadPacketsH.class).onWorldChange();
}
player.dimensionType = respawn.getDimensionType();
player.worldName = respawn.getWorldName().orElse(null);
player.compensatedEntities.serverPlayerVehicle = null; // All entities get removed on respawn
player.compensatedEntities.self = new PacketEntitySelf(player, player.compensatedEntities.self);
player.compensatedEntities.selfTrackedEntity = new TrackerData(0, 0, 0, 0, 0, EntityTypes.PLAYER, player.lastTransactionSent.get());
player.cameraEntity.reset();
if (player.getClientVersion().isOlderThan(ClientVersion.V_1_14)) { // 1.14+ players send a packet for this, listen for it instead
player.isSprinting = false;
player.vehicleData.camelSprintingState = SprintingState.STOPPED;
player.checkManager.getCheck(BadPacketsF.class).lastSprinting = false; // Pre 1.14 clients set this to false when creating new entity
// TODO: What the fuck viaversion, why do you throw out keep all metadata?
// The server doesn't even use it... what do we do?
player.compensatedEntities.hasSprintingAttributeEnabled = false;
}
player.pose = Pose.STANDING;
if (!keepTrackedData || player.getClientVersion().isOlderThan(ClientVersion.V_1_21_2)) {
player.clientVelocity = new Vector3dm();
}
if (!GrimAPI.INSTANCE.getSpectateManager().isSpectating(player.uuid)) {
player.gamemode = respawn.getGameMode();
}
if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_17)) {
player.compensatedWorld.setDimension(respawn.getDimensionType(), event.getUser());
}
if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_16) && !this.hasFlag(respawn, KEEP_ATTRIBUTES)) {
// Reset attributes if not kept
player.compensatedEntities.self.resetAttributes();
player.compensatedEntities.hasSprintingAttributeEnabled = false;
}
});
}
}
private boolean isWorldChange(GrimPlayer player, WrapperPlayServerRespawn respawn) {
if (player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_16) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThan(ServerVersion.V_1_16)) {
return !Objects.equals(respawn.getWorldName().orElse(null), player.worldName);
}
ClientVersion version = PacketEvents.getAPI().getServerManager().getVersion().toClientVersion();
return respawn.getDimensionType().getId(version) != player.dimensionType.getId(version)
|| !Objects.equals(respawn.getDimensionType().getName(), player.dimensionType.getName());
}
}
// NOTE (AI): The RESPAWN branch is lines 133-243. BadPacketsE and BadPacketsG handleRespawn calls are the reminder-tick and repeat-packet resets; BadPacketsM.onRespawn clears death-buffer state, and BadPacketsF.exemptNext covers the immediate-respawn gamerule.
Stamp the respawn moment and clear inventory and vehicle state so every check can exempt the respawn window.
fastHandle runs on the packet thread: GPacketPlayServerRespawn schedules a transaction-confirmed action that calls setLastRespawn(packet.getTimestamp()), closes the inventory state and drops the predicted vehicle. ExemptType.RESPAWN then exempts checks while lastRespawn is under three seconds or respawnTicks is positive, and MovementPreProcessor decrements respawnTicks each tick. The same timestamp is also set from the client's C16 PERFORM_RESPAWN command.
// ===== FILE: artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/miscellaneous/MiscellaneousPreProcessor.java =====
package ac.artemis.core.v4.processor.miscellaneous;
import ac.artemis.core.v4.check.FastProcessHandler;
import ac.artemis.core.v4.data.PlayerData;
import ac.artemis.core.v4.data.holders.ConnectionHolder;
import ac.artemis.core.v4.nms.NMSManager;
import ac.artemis.core.v4.processor.AbstractHandler;
import ac.artemis.core.v4.utils.function.PacketAction;
import cc.ghast.packet.PacketAPI;
import cc.ghast.packet.wrapper.mc.PlayerEnums;
import ac.artemis.packet.spigot.wrappers.GPacket;
import cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientClientCommand;
import cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientWindowClose;
import cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientHeldItemSlot;
import cc.ghast.packet.wrapper.packet.play.client.GPacketPlayClientTransaction;
import cc.ghast.packet.wrapper.packet.play.server.*;
import java.util.ArrayList;
import java.util.Arrays;
/**
* @author Ghast
* @since 06-Mar-20
*/
public class MiscellaneousPreProcessor extends AbstractHandler implements FastProcessHandler {
public MiscellaneousPreProcessor(PlayerData data) {
super("Misc [0x01]", data);
}
@Override
public void handle(final GPacket packet) {
long now = System.currentTimeMillis();
if (packet instanceof GPacketPlayClientHeldItemSlot) {
data.user.usingItem = false;
}
else if (packet instanceof GPacketPlayClientClientCommand) {
final GPacketPlayClientClientCommand cmd = (GPacketPlayClientClientCommand) packet;
if (cmd.getCommand().equals(PlayerEnums.ClientCommand.PERFORM_RESPAWN)) {
data.user.setLastRespawn(packet.getTimestamp());
data.prediction.setVehicle(null);
}
}
else if (packet instanceof GPacketPlayClientTransaction) {
final GPacketPlayClientTransaction trx = (GPacketPlayClientTransaction) packet;
if (!trx.isAccepted()) {
//data.user.setInventoryOpen(true);
}
}
else if (packet instanceof GPacketPlayClientWindowClose) {
data.user.setInventoryOpen(false);
}
/*else if (packet instanceof GPacketPlayServerEntityTeleport) {
final GPacketPlayServerEntityTeleport tp = (GPacketPlayServerEntityTeleport) packet;
if (data.prediction.getVehicle() != null &&
(tp.getEntityId() == data.getPlayer().getEntityId() || tp.getEntityId() == data.prediction.getVehicle().getEntityId())) {
data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {
@Override
public void pre() {
data.prediction.setVehicle(null);
}
});
}
}*/
/*else if (packet instanceof GPacketPlayServerPosition) {
if (data.prediction.getVehicle() != null) {
data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {
@Override
public void pre() {
data.prediction.setVehicle(null);
}
});
}
}*/
data.timing.miscTiming.addTime(now, System.currentTimeMillis());
}
@Override
public void fastHandle(GPacket packet) {
if (packet instanceof GPacketPlayServerRespawn) {
data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {
@Override
public void pre() {
data.user.setLastRespawn(packet.getTimestamp());
data.user.setInventoryOpen(false);
data.prediction.setVehicle(null);
}
});
}
else if (packet instanceof GPacketPlayServerWindowClose) {
data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {
@Override
public void pre() {
data.user.setInventoryOpen(false);
}
});
}
else if (packet instanceof GPacketPlayServerEntityAttach) {
final GPacketPlayServerEntityAttach attach = (GPacketPlayServerEntityAttach) packet;
if (attach.getEntityId() == data.getPlayer().getEntityId()) {
data.connection.confirmFunctionAndTick(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {
@Override
public void pre() {
data.prediction.setVehicle(NMSManager.getInms().getEntity(data.getPlayer().getWorld(), attach.getVehicleId()));
if (data.prediction.getVehicle() == null) {
data.resetMotion();
}
}
});
}
}
else if (packet instanceof GPacketPlayServerEntityDestroy) {
final GPacketPlayServerEntityDestroy dtr = (GPacketPlayServerEntityDestroy) packet;
final boolean flag = data.prediction.getVehicle() != null
&& Arrays.stream(dtr.getEntities()).anyMatch(e -> data.prediction.getVehicle().getEntityId() == e);
if (flag) {
data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {
@Override
public void pre() {
data.prediction.setVehicle(null);
data.resetMotion();
}
});
}
}
else if (packet instanceof GPacketPlayServerBed) {
final GPacketPlayServerBed bed = (GPacketPlayServerBed) packet;
if (bed.getPlayerID() == data.getPlayer().getEntityId()) {
data.connection.confirmFunction(ConnectionHolder.ConfirmationType.TRANSACTION, new PacketAction() {
@Override
public void pre() {
data.prediction.setVehicle(null);
data.resetMotion();
}
});
}
}
}
}
// NOTE (AI): The respawn branch is fastHandle lines 89-98, transaction-confirmed so the timestamp applies only after the client acknowledges. EmulatorPreProcessor (lines 616-633) mirrors it by setting movement.respawnTicks to 150 on the same packet.
Zero the per-player respawnTick on respawn so every movement and combat check skips the respawn window.
PlayerEventListener.onRespawn (PlayerRespawnEvent) sets salmonPlayer.respawnTick = 0, and the counter increments in SalmonPlayer. Checks then bail early while the tick is under their threshold, from 20 ticks (ReachA, CriticalA, SpeedCode) to 60 ticks (TimerC, Invalid0A, JesusC). The same listener registers players on PlayerJoinEvent and zeroes respawnTick on join too.
// ===== FILE: ch1ck3n-ovo-SalmonAC, src/main/java/com/ch1ck3n/salmonac/events/PlayerEventListener.java =====
package com.ch1ck3n.salmonac.events;
import com.ch1ck3n.salmonac.SalmonAC;
import com.ch1ck3n.salmonac.utils.SalmonPlayer;
import org.bukkit.entity.Player;
import org.bukkit.event.EventHandler;
import org.bukkit.event.Listener;
import org.bukkit.event.player.*;
public class PlayerEventListener implements Listener {
@EventHandler
public void onJoin(PlayerJoinEvent e){
SalmonAC.getInstance().getPlayerManager().registerPlayer( e.getPlayer() );
SalmonPlayer salmonPlayer = getCustomPlayer(e.getPlayer());
salmonPlayer.respawnTick = 0;
}
@EventHandler
public void onJoin(PlayerQuitEvent e){
SalmonAC.getInstance().getPlayerManager().unregisterPlayer( e.getPlayer() );
}
@EventHandler
public void onSwing(PlayerAnimationEvent e) {
if( e.getAnimationType() == PlayerAnimationType.ARM_SWING ){
SalmonPlayer salmonPlayer = getCustomPlayer(e.getPlayer());
if (salmonPlayer == null) return;
salmonPlayer.swingTick = 0;
// salmonPlayer.lastSwingDelay = salmonPlayer.getSwingDelay();
// salmonPlayer.swingDelay = System.currentTimeMillis() - salmonPlayer.getLastSwingTime();
// salmonPlayer.lastSwingTime = salmonPlayer.getSwingTime();
// salmonPlayer.swingTime = System.currentTimeMillis();
}
}
@EventHandler
public void onItemChange(PlayerItemHeldEvent e) {
SalmonPlayer salmonPlayer = getCustomPlayer(e.getPlayer());
if (salmonPlayer == null) return;
salmonPlayer.itemChangeTick = 0;
}
@EventHandler
public void onMove(PlayerMoveEvent e) {
SalmonPlayer salmonPlayer = getCustomPlayer(e.getPlayer());
if (salmonPlayer == null) return;
if ( salmonPlayer.doSetBack() ) {
e.setTo(e.getFrom());
salmonPlayer.setBackTick = 0;
salmonPlayer.setBack = false;
}
}
@EventHandler
public void onRespawn(PlayerRespawnEvent e) {
SalmonPlayer salmonPlayer = getCustomPlayer(e.getPlayer());
if (salmonPlayer == null) return;
salmonPlayer.respawnTick = 0;
}
@EventHandler
public void onTeleport(PlayerTeleportEvent e) {
SalmonPlayer salmonPlayer = getCustomPlayer(e.getPlayer());
if ( salmonPlayer == null || salmonPlayer.doSetBack() ) return;
salmonPlayer.teleportTick = 0;
}
@EventHandler
public void onVelocity(PlayerVelocityEvent e) {
SalmonPlayer salmonPlayer = SalmonAC.getInstance().getPlayerManager().getPlayer( e.getPlayer() );
if( salmonPlayer == null ) return;
salmonPlayer.velocityX = e.getVelocity().getX();
salmonPlayer.velocityY = e.getVelocity().getY();
salmonPlayer.velocityZ = e.getVelocity().getZ();
salmonPlayer.velocityH = Math.hypot(salmonPlayer.velocityX, salmonPlayer.velocityZ);
salmonPlayer.velocityTick = 0;
}
public SalmonPlayer getCustomPlayer(Player player){
return SalmonAC.getInstance().getPlayerManager().getPlayer( player );
}
}
// NOTE (AI): SalmonAC hooks the Bukkit event, not the packet: PlayerRespawnEvent fires when the respawn position is set, which is the same world-reload moment the S07 packet causes. The respawnTick field is read by every check through SalmonPlayer.getRespawnTick.
Skip the bad-packets teleport check while the player is still inside the respawn grace window.
BadPacketsC watches the flying packet family and flags an invalid teleport when the client's horizontal delta exceeds the server-position speed. The exemption list includes getRespawnTimer().hasNotPassed(20), so a respawned player's first 20 ticks are never evaluated. The timer is armed from the respawn path in the action processor; the tinyprotocol WrappedOutRespawnPacket wrapper is the packet-side representation.
// ===== FILE: JTXOfficial-FlopAC, src/main/java/me/jtx/flopac/checks/misc/badpackets/BadPacketsC.java =====
package me.jtx.flopac.checks.misc.badpackets;
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;
@CheckInformation(checkName = "BadPackets", checkType = "C", punishmentVL = 2)
public class BadPacketsC extends Check {
private double threshold;
@Override
public void onPacket(PacketEvent event) {
switch (event.getType()) {
case Packet.Client.FLYING:
case Packet.Client.LOOK:
case Packet.Client.POSITION_LOOK:
case Packet.Client.POSITION: {
User user = event.getUser();
if (user.shouldCancel()
|| user.getTick() < 60
|| user.getLastTeleportTimer().hasNotPassed(20)
|| user.getActionProcessor().getRespawnTimer().hasNotPassed(20)
|| user.getBlockData().pistonTicks > 0
|| user.getActionProcessor().getRespawnTimer().hasNotPassed(20)
|| user.getPlayer().isDead()
|| user.getGhostBlockProcessor().getGhostBlockTeleportTimer().hasNotPassed(20)
|| user.getVehicleTimer().hasNotPassed(20)) {
threshold = 0;
return;
}
double deltaXZ = user.getMovementProcessor().getDeltaXZ();
double maxSpeed = user.getMovementProcessor().getServerPositionSpeed();
if (user.getActionProcessor().getServerPositionTimer().hasNotPassed(5)) {
double delta = Math.abs(deltaXZ - maxSpeed);
if (delta > 0.8) {
if (threshold++ > 3) {
flag(user, "Invalid teleport");
}
} else {
threshold -= Math.min(threshold, 0.002);
}
} else {
threshold -= Math.min(threshold, 0.002);
}
break;
}
}
}
}
// NOTE (AI): The respawn guard appears twice in the same exemption chain (lines 27 and 29), which suggests a merged exemption list; the check is otherwise a plain delta-versus-server-speed teleport check.
Related Packets
Wiki Cross-Reference
For a dimension change the server sends respawn followed by chunks for the new dimension and then a position and look packet, and the client unloads old chunks automatically.
Avoid respawning a player into the same dimension they are already in unless they are dead, since it causes glitches such as being unable to attack.
MCP 1.8.9 S07PacketRespawn implements Packet
1.8.9 callers: NetHandlerPlayServer.handleSpectate sends new S07PacketRespawn (line 674) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/network/NetHandlerPlayServer.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 S07PacketRespawn
Full source walkthroughs of the modules and anti-cheats that use this packet.