0x38 S38PacketPlayerListItem
Adds, updates, or removes entries from the tab player list. Used for player join/leave, gamemode changes, ping updates, and display name changes.
Published 2026-06-18 · Updated 2026-10-14
Fields
| Field | Type | Description |
|---|---|---|
| action | VarInt Enum | 0=ADD_PLAYER, 1=UPDATE_GAMEMODE, 2=UPDATE_LATENCY, 3=UPDATE_DISPLAY_NAME, 4=REMOVE_PLAYER |
| players | PlayerInfo[] | List of AddPlayerData entries (UUID, name, profile properties, gamemode, ping, display name) |
Wire Encoding
| Field | Type | Notes |
|---|---|---|
| Action | VarInt Enum | 0=add, 1=updateGamemode, 2=updateLatency, 3=updateDisplayName, 4=remove |
| Number of Players | VarInt | |
| Per-Player Data | UUID + String + Property[] + VarInt + VarInt + ChatComponent | Varies by action type |
MCP References
NetHandlerPlayClient.handlePlayerListItem()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 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 206 | |
| 207 | |
| 208 | |
| 209 | |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 | |
| 218 | |
| 219 | |
| 220 | |
| 221 | |
| 222 | |
| 223 | |
| 224 | |
| 225 | |
| 226 | |
| 227 | |
| 228 | |
| 229 | |
| 230 | |
| 231 | |
| 232 | |
| 233 | |
| 234 | |
| 235 | |
| 236 | |
| 237 | |
| 238 | |
| 239 | |
| 240 | |
| 241 | |
| 242 | |
| 243 | |
| 244 | |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | |
| 250 | |
| 251 | |
| 252 | |
| 253 | |
| 254 | |
| 255 | |
| 256 | |
| 257 | |
| 258 | |
| 259 | |
| 260 | |
| 261 | |
| 262 | |
| 263 | |
| 264 | |
| 265 | |
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | |
Deobfuscated MCP 1.8.9 source of S38PacketPlayerListItem, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/server/S38PacketPlayerListItem.java) at build time and verified present.
Deep Dive
Role in the protocol
The tab list state machine: one VarInt action plus a list of per-player records. ADD_PLAYER (0) ships UUID, name, the skin property map, gamemode, ping and an optional display name; UPDATE_GAME_MODE (1) and UPDATE_LATENCY (2) carry a UUID plus one field; UPDATE_DISPLAY_NAME (3) a UUID plus an optional chat component; REMOVE_PLAYER (4) a bare UUID. ServerConfigurationManager broadcasts ADD on join, REMOVE on leave, and every 600 ticks it broadcasts UPDATE_LATENCY for the whole list, which is how ping reaches the tab GUI.
Vanilla handling
handlePlayerListItem branches per action and mutates the player info map: ADD builds a NetworkPlayerInfo from the AddPlayerData, UPDATE_LATENCY overwrites the ping field, UPDATE_DISPLAY_NAME swaps the display name, REMOVE drops the entry. The ADD path doubles as the skin pipeline: the textures property is consumed by the player renderer. Server side, the packet constructors snapshot each EntityPlayerMP's profile, ping, gamemode and tab display name into records.
Why clients touch it
Four modules across three clients. Rise 5.99 Denicker intercepts ADD_PLAYER, decodes the base64 textures property from the GameProfile and compares the embedded profileName against the displayed name to reveal nicked players, pairing results with S02PacketChat join lines. Rise 6.1.30 and 6.2.4 StaffDetector keep a hardcoded staff list, but the S38 handler is commented out in both builds, leaving only the PreMotion decay counter live. Sigma 4.11 AntiVanish reads UPDATE_LATENCY and REMOVE_PLAYER to catch vanished players, and FriendAlert notifies when an ADD_PLAYER name matches the friend list.
Exploit surface
The ADD_PLAYER payload is the richest unencrypted metadata stream in the protocol: the full GameProfile including signed skin properties, which Denicker turns into an identity oracle that nick plugins do not scrub. UPDATE_LATENCY is a ping heartbeat that enables vanish detection: a vanished player stops appearing, and AntiVanish also flags latency updates for UUIDs absent from the player info map. No anti-cheat polices the packet; the countermeasures are tab-list plugins that strip or re-sign properties.
Server-Side Handling
ServerConfigurationManager sends ADD to everyone when a player joins and REMOVE on quit; the joining player additionally receives ADD records for everyone already online. onTick broadcasts UPDATE_LATENCY for the whole list every 600 ticks. The channel is broadcast-only: the server never validates what the client does with the data, and there is no clientbound acknowledgment.
Protocol Analysis
The action is a VarInt enum. Record layout depends on action; the widest is ADD_PLAYER: UUID, name capped at 16 chars, VarInt property count, then per property name, value and optional signature strings with a boolean flag, then gamemode VarInt, ping VarInt and an optional chat component. Property strings cap at 32767 bytes. UPDATE_LATENCY entries are only UUID plus ping VarInt, which is why ping refreshes stay cheap.
Anti-Cheat Landscape
Not a detection surface; no anti-cheat measures tab list traffic. The realistic risks are social and structural: Denicker's un-nicking fails when servers strip profileName from the textures payload, and vanish alerts are defeated by networks that keep vanished players in the tab list, which is exactly why Sigma hard-disables AntiVanish on hypixel, hive and mineplex via a server-IP check.
implementation Implementation Cases
The tab list state machine and the most information-dense clientbound metadata channel: ADD_PLAYER carries full GameProfiles with signed skin properties. Four corpus modules live on it: Rise 5.99 Denicker decodes skin payloads to un-nick players, Rise 6.x StaffDetector carries a disabled S38 hook, and Sigma 4.11 AntiVanish and FriendAlert track the latency heartbeat and join records.
Reveal the real identity of nicked players by decoding the signed skin texture payload from ADD_PLAYER records.
On PacketReceiveEvent, an ADD_PLAYER S38 is read: the first AddPlayerData's GameProfile is taken, the textures property is base64-decoded into JSON, and the embedded profileName is compared with the displayed name. Mismatches are queued as realName=nickedName pairs; S02PacketChat join messages are then scanned on a background thread, and a matching nick triggers a notification plus a log4j chat rewrite when overlay support is on.
// ===== FILE: Rise 5.99, dev/rise/module/impl/other/Denicker.java =====
package dev.rise.module.impl.other;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.properties.Property;
import com.mojang.authlib.properties.PropertyMap;
import dev.rise.Rise;
import dev.rise.event.impl.other.WorldChangedEvent;
import dev.rise.event.impl.packet.PacketReceiveEvent;
import dev.rise.module.Module;
import dev.rise.module.api.ModuleInfo;
import dev.rise.module.enums.Category;
import dev.rise.notifications.NotificationType;
import dev.rise.setting.impl.BooleanSetting;
import dev.rise.setting.impl.ModeSetting;
import dev.rise.util.render.InGameBlurUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.network.play.server.S02PacketChat;
import net.minecraft.network.play.server.S38PacketPlayerListItem;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.util.ArrayList;
import java.util.Base64;
import java.util.Collection;
import java.util.Objects;
@ModuleInfo(name = "Denicker", description = "Denicks any nicked players in your game", category = Category.OTHER)
public class Denicker extends Module {
private final BooleanSetting overlaySupport = new BooleanSetting("Overlay Support", this, true);
private ArrayList<String> denickQueue = new ArrayList<String>();
private static final Logger logger = LogManager.getLogger();
@Override
public void onPacketReceive(final PacketReceiveEvent event) {
if (event.getPacket() instanceof S38PacketPlayerListItem) {
S38PacketPlayerListItem s38 = (S38PacketPlayerListItem) event.getPacket();
if (s38.func_179768_b().equals(S38PacketPlayerListItem.Action.ADD_PLAYER) && (s38.func_179767_a().get(0) != null)) {
try {
S38PacketPlayerListItem.AddPlayerData addPlayerData = s38.func_179767_a().get(0);
GameProfile gameProfile = addPlayerData.getProfile();
PropertyMap propertyMap = gameProfile.getProperties();
String nickedName = gameProfile.getName();
if (Objects.equals(nickedName, mc.thePlayer.getName())) return;
// get base64 skin data from s38
Collection<Property> values = propertyMap.get("textures");
if (values.isEmpty()) return;
String skinDataRaw = ((Property) values.toArray()[0]).getValue();
String skinData = new String(Base64.getDecoder().decode(skinDataRaw)); // decode base 64
// json decoding
JsonObject jsonObject = new JsonParser().parse(skinData).getAsJsonObject();
String realName = jsonObject.get("profileName").getAsString();
if (!Objects.equals(realName, nickedName) && !denickQueue.contains(nickedName)) {
denickQueue.add(realName + "=" + nickedName);
}
} catch (Exception e) {
e.printStackTrace();
}
}
} else if (event.getPacket() instanceof S02PacketChat) {
String message = ((S02PacketChat) event.getPacket()).chatComponent.getUnformattedText();
if (message.contains("has joined") && !denickQueue.isEmpty()) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
for (String s : denickQueue) {
String realName = s.split("=")[0];
String nickedName = s.split("=")[1];
if (message.contains(s.split("=")[1])) {
Rise.INSTANCE.getNotificationManager().registerNotification(realName + " is nicked as " + nickedName, 7500, NotificationType.NOTIFICATION);
if (overlaySupport.isEnabled()) {
logger.info("[CHAT] " + StringUtils.stripControlCodes(message.replace(nickedName, realName)));
}
}
}
}
});
thread.start();
}
}
}
@Override
public void onWorldChanged(final WorldChangedEvent event) {
denickQueue.clear();
}
}
// NOTE (AI): The identity oracle is the signed textures property: Mojang puts the real profileName inside the base64 payload, and nick plugins rewrite only the display name. The queue pairs realName=nickedName and matches them against S02 join messages on a background thread; the chat rewrite is injected through log4j, not through a packet. The world-change handler clears the queue so nicks do not leak across servers.
Detect staff on the server by matching tab list names against a hardcoded staff list, then auto-leave via /hub.
The module keeps a hardcoded comma-separated staff name list and a PreMotion counter that decays each tick. In both corpus builds the actual packet handling is commented out: the S38 ADD_PLAYER and S3EPacketTeams branches that would count staff sightings and send /hub at count 6 are dead code. Only the name list and the decay counter remain live.
// ===== FILE: Rise 6.2.4, Client-release2/Client/src/main/java/com/alan/clients/module/impl/exploit/StaffDetector.java =====
package com.alan.clients.module.impl.exploit;
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.packet.PacketReceiveEvent;
import com.alan.clients.module.Module;
import com.alan.clients.module.api.Category;
import com.alan.clients.module.api.ModuleInfo;
import com.alan.clients.value.impl.BooleanValue;
import net.minecraft.network.Packet;
@ModuleInfo(aliases = {"module.combat.staffdetector.name"}, description = "module.exploit.staffdetector.description", category = Category.EXPLOIT)
public class StaffDetector extends Module {
BooleanValue autoLeave = new BooleanValue("Auto Leave", this, true);
private String[] staff;
private int count;
public StaffDetector() {
String input = "idhoom,7so,1sweet,jinaaan,ev2n,eissaa,mohmad_q8,1daykel,ximtaig_,nshme,comsterr,e9_,1meko,1lab,mk_f16,loovq,_sadeq,nv0ola,1f5amh___3oo,frecss217,xmz7,a2bod,eyeso_diamond,bunkrat,1rana,1ahmd,1heyimhasson_,casteret,1elyy,1zeyad,lt1x,firas,postme,3mmr,xl2d,yzed,y2men,iv2a,_nonameishere_,0hfault,deficency,anauri,xluffy1,kinderbueno__,_revoox_,xidayzer,i7ilin,1adam__,27bk,ventz_,awfultimes,ahm2d,gsomar,mvp11,xxkhaledxxcraft,aymann_,1iraqi,rambokinq,undertest,zswift,strongest0ne,neverletyouknow,zixgamer,sanfoor_j,ixghoul_,imbexsl_,glowdown_,hunter47,fexoranep,1reyleigh,420waffle,ywgiz,sweetyalice,xfahadq,mr3nb_,akash1004,zaytonaaa,rma7o,mr_1990,iali_305,wacros,lwwh,pynifical,rivsci,itsjuan_,meedo_qb,_r3,1speedo_,_justidk,505t,xzvv,mauveracer,_1hypersx_,rayqquaza,swivee,absqtulate,opgaming2009,vhagardracarys,luffy404,faisaal420,hdzt,sunsnipebeastwtf,_odex,1ashu,n13m_,callinu,sh59,drnyx,iisrab5bgii,haoeris,lxrayanxl,toxiclayer,greatm7md,brksfrb2,madix707,hnxrr,1sweetty,ohhhhqls,solidfying,_i_b,escoco,dreadpirater0b,aboshxm,0ryze,spuvr,va_1,kingpvp90,rieus,prebowed,mitsichu,gogglas,battlebay,32lbo,7far_8bor,evenfai,hlazny,valrm";
staff = input.split(",");
}
@EventLink
public final Listener<PreMotionEvent> onPreMotion = event -> {
count = Math.max(0, count - 1);
};
@EventLink
public final Listener<PacketReceiveEvent> onPacketReceive = event -> {
Packet<?> packet = event.getPacket();
// if (packet instanceof S3EPacketTeams) {
// final S3EPacketTeams teams = (S3EPacketTeams) packet;
//
// for (final String name : teams.func_149310_g()) {
// if (Arrays.asList(staff).contains(name.toLowerCase())) {
// count++;
//
// if (count == 6) {
// ChatUtil.display("Staff Detected " + name);
//
// if (autoLeave.getValue()) PacketUtil.send(new C01PacketChatMessage("/hub"));
// }
// }
// }
// }
// if (packet instanceof S38PacketPlayerListItem) {
// S38PacketPlayerListItem item = ((S38PacketPlayerListItem) packet);
//
// for (S38PacketPlayerListItem.AddPlayerData player : item.func_179767_a()) {
// if (player == null || player.getProfile() == null || player.getProfile().getName() == null) {
// continue;
// } else if (!player.getProfile().getName().equals("SHOP") && !player.getProfile().getName().equals("UPGRADES")) {
// ChatUtil.display("Username: " + player.getProfile().getName());
// }
//
// if (Arrays.asList(staff).contains(player.getProfile().getName().toLowerCase())) {
// ChatUtil.display("Staff Detected " + player.getProfile().getName());
//
// if (autoLeave.getValue()) PacketUtil.send(new C01PacketChatMessage("/hub"));
// }
// }
// }
// if (packet instanceof S) {
// S06PacketUpdateHealth health = ((S06PacketUpdateHealth) packet);
//
// }
};
}
// NOTE (AI): The S38 handler is commented out in both 6.1.30 and 6.2.4: only the hardcoded staff list and the PreMotion decay counter remain live. The dead code documents the intended design: count staff sightings on S38 ADD_PLAYER and S3EPacketTeams, then send /hub once the counter reaches 6. The S38 block also shows the SHOP/UPGRADES filter used to skip NPC tab entries.
Detect vanished players by watching UPDATE_LATENCY and REMOVE_PLAYER records that reference UUIDs absent from the tab list.
On EventPacket (incoming), UPDATE_LATENCY records are checked against mc.getNetHandler().getPlayerInfo(uuid): a latency update for a UUID with no player info entry is flagged as a vanished player and added to a watch list. On the update event, any watched UUID that later gains a player info entry is reported as un-vanished. A REMOVE_PLAYER branch prints the removed display name. A server-IP guard auto-disables on hypixel, hive and mineplex.
// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/other/AntiVanish.java =====
package info.sigmaclient.module.impl.other;
import info.sigmaclient.event.Event;
import info.sigmaclient.event.RegisterEvent;
import info.sigmaclient.event.impl.EventPacket;
import info.sigmaclient.event.impl.EventRenderGui;
import info.sigmaclient.event.impl.EventUpdate;
import info.sigmaclient.management.command.Command;
import info.sigmaclient.management.notifications.Notifications;
import info.sigmaclient.module.Module;
import info.sigmaclient.module.data.ModuleData;
import info.sigmaclient.util.misc.ChatUtil;
import net.minecraft.network.play.server.S38PacketPlayerListItem;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.CopyOnWriteArrayList;
public class AntiVanish extends Module {
private List<UUID> vanished = new CopyOnWriteArrayList<>();
private HashMap<UUID, String> uuidNames = new HashMap<>();
private int delay = 20 * -160;
public AntiVanish(ModuleData data) {
super(data);
}
@RegisterEvent(events = {EventUpdate.class, EventPacket.class, EventRenderGui.class})
public void onEvent(Event event) {
if (event instanceof EventUpdate) {
EventUpdate em = (EventUpdate) event;
if (em.isPre() && mc.getCurrentServerData() != null) {
String server = mc.getCurrentServerData().serverIP.toLowerCase();
if (server.contains("hypixel") || server.contains("hive") || server.contains("mineplex")) {
Notifications.getManager().post("Auto Config", "AntiVanish disabled for spam reasons.", 1500, Notifications.Type.WARNING);
toggle();
}
if (!vanished.isEmpty()) {
if (delay > 20 * 160) {
vanished.clear();
Notifications.getManager().post("Vanish Cleared", "\247fVanish List has been \2476Cleared.", 2500L,
Notifications.Type.NOTIFY);
delay = 20 * -160;
} else {
delay++;
}
}
try {
for (UUID uuid : vanished) {
if (mc.getNetHandler().func_175102_a(uuid) != null && vanished.contains(uuid)) {
Notifications.getManager().post("Vanish Warning",
"\247b" + mc.getNetHandler().func_175102_a(uuid).getDisplayName() + "is no longer \2476Vanished",
2500L, Notifications.Type.NOTIFY);
DateFormat dateFormat = new SimpleDateFormat("hh:mm a");
Date date = new Date();
ChatUtil.printChat(Command.chatPrefix + "\2477[" + dateFormat.format(date) + "]\247f " + mc.getNetHandler().func_175102_a(uuid).getDisplayName() + "is no longer \247cVanished");
}
vanished.remove(uuid);
}
} catch (Exception e) {
Notifications.getManager().post("Vanish Error", "\247cSomething happened.");
}
}
}
if (event instanceof EventPacket) {
EventPacket ep = (EventPacket) event;
if (ep.isIncoming() && (mc.theWorld != null) && ((ep.getPacket() instanceof S38PacketPlayerListItem))) {
S38PacketPlayerListItem listItem = (S38PacketPlayerListItem) ep.getPacket();
if (listItem.func_179768_b() == S38PacketPlayerListItem.Action.UPDATE_LATENCY) {
for (Object o : listItem.func_179767_a()) {
S38PacketPlayerListItem.AddPlayerData data = (S38PacketPlayerListItem.AddPlayerData) o;
if ((mc.getNetHandler().func_175102_a(data.field_179964_d.getId()) == null)
&& (!checkList(data.field_179964_d.getId()))) {
Notifications.getManager().post("Vanish Warning",
"\247bA player is \2476Vanished!", 2500L,
Notifications.Type.WARNING);
DateFormat dateFormat = new SimpleDateFormat("hh:mm a");
Date date = new Date();
ChatUtil.printChat(Command.chatPrefix + "\2477[" + dateFormat.format(date) + "] \247cVanish Alert.");
delay = 20 * -160;
}
}
} else if (listItem.func_179768_b() == S38PacketPlayerListItem.Action.REMOVE_PLAYER) {
for (Object o : listItem.func_179767_a()) {
S38PacketPlayerListItem.AddPlayerData data = (S38PacketPlayerListItem.AddPlayerData) o;
UUID uuid = data.field_179964_d.getId();
if(mc.getNetHandler().func_175102_a(uuid) != null && mc.getNetHandler().func_175102_a(uuid).getDisplayName() != null){
ChatUtil.printChat("" + mc.getNetHandler().func_175102_a(uuid));
}
}
}
}
}
}
private boolean checkList(final UUID uuid) {
if (this.vanished.contains(uuid)) {
return true;
}
this.vanished.add(uuid);
return false;
}
}
// NOTE (AI): UPDATE_LATENCY is the vanish oracle: every 600 ticks the server pings the whole list, so a UUID that receives latency updates without a matching player info entry is a vanished player. checkList() adds the UUID to the watch list on first miss. Note the hard server-IP guard that auto-disables on hypixel/hive/mineplex because those networks keep vanished players in the tab list, which would make every latency update a false positive.
Notify when a friend joins by matching ADD_PLAYER profile names against the friend manager.
On incoming EventPacket, an ADD_PLAYER S38 is iterated and each AddPlayerData's profile name is checked with FriendManager.isFriend; a match posts a Friend Alert notification with the name. The module reads only the name field and ignores the skin properties.
// ===== FILE: Sigma 4.11, info/sigmaclient/module/impl/other/FriendAlert.java =====
/**
* Time: 8:22:36 PM
* Date: Jan 5, 2017
* Creator: cool1
*/
package info.sigmaclient.module.impl.other;
import info.sigmaclient.event.Event;
import info.sigmaclient.event.RegisterEvent;
import info.sigmaclient.event.impl.EventPacket;
import info.sigmaclient.management.friend.FriendManager;
import info.sigmaclient.management.notifications.Notifications;
import info.sigmaclient.management.notifications.Notifications.Type;
import info.sigmaclient.module.Module;
import info.sigmaclient.module.data.ModuleData;
import info.sigmaclient.util.Timer;
import net.minecraft.network.play.server.S38PacketPlayerListItem;
/**
* @author cool1
*/
public class FriendAlert extends Module {
private boolean connect;
private String name;
private int currentY, targetY;
Timer timer = new Timer();
public FriendAlert(ModuleData data) {
super(data);
// TODO Auto-generated constructor stub
}
@Override
@RegisterEvent(events = {EventPacket.class})
public void onEvent(Event event) {
EventPacket ep = (EventPacket) event;
if (ep.isIncoming() && ep.getPacket() instanceof S38PacketPlayerListItem) {
S38PacketPlayerListItem packet = (S38PacketPlayerListItem) ep.getPacket();
if (packet.func_179768_b() == S38PacketPlayerListItem.Action.ADD_PLAYER) {
for (Object o : packet.func_179767_a()) {
S38PacketPlayerListItem.AddPlayerData data = (S38PacketPlayerListItem.AddPlayerData) o;
if (FriendManager.isFriend(data.field_179964_d.getName())) {
Notifications.getManager().post("Friend Alert", "\247b" + data.field_179964_d.getName() + " has joined!", 2500L, Type.INFO);
}
}
}
}
}
}
// NOTE (AI): A minimal ADD_PLAYER consumer: it matches the profile name against FriendManager and posts a notification. It reads only the name field, so it is cheap and cannot be defeated by property stripping; the same handler shape is the base for every tab-list alert module.
anticheat Anti-Cheat Checks
The player-list packet manages tab list entries: add, remove, and updates of game mode, ping and display name. Server-side anticheats almost never validate it, and in this corpus only Grim consumes it: one listener rewrites game modes to hide spectators, and the entity replication listener stores the UUID-to-profile mappings that checks use to resolve entity identities. The keyword noise in the corpus is tab-complete and math-table code, not player-list handling.
Prevent spectators on Grim's spectate system from leaking through the tab list with spectator game mode.
PacketHidePlayerInfo is a HIGHEST-priority send listener. For PLAYER_INFO (pre-1.19.3) it walks the player data list and, for entries that should be hidden, rewrites SPECTATOR game mode to SURVIVAL, cancels the packet when every entry was hidden and the action was a pure game-mode update, and marks the packet for re-encoding otherwise. The 1.19.3+ PLAYER_INFO_UPDATE path does the same per entry, removes the UPDATE_GAME_MODE action from a cancelled packet, and re-encodes modified entries.
// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketHidePlayerInfo.java =====
package ac.grim.grimac.events.packets;
import ac.grim.grimac.GrimAPI;
import ac.grim.grimac.player.GrimPlayer;
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.packettype.PacketType;
import com.github.retrooper.packetevents.protocol.player.GameMode;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfo;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoUpdate;
import java.util.ArrayList;
import java.util.EnumSet;
import java.util.List;
public class PacketHidePlayerInfo extends PacketListenerAbstract {
public PacketHidePlayerInfo() {
super(PacketListenerPriority.HIGHEST);
}
@Override
public boolean isPreVia() {
return true;
}
@Override
public void onPacketSend(PacketSendEvent event) {
if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO) {
// iterate through players and fake their game mode if they are spectating via grim spectate
if (PacketEvents.getAPI().getServerManager().getVersion().isOlderThanOrEquals(ServerVersion.V_1_12_2))
return;
GrimPlayer receiver = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());
if (receiver == null) { // Exempt
return;
}
WrapperPlayServerPlayerInfo info = new WrapperPlayServerPlayerInfo(event);
if (info.getAction() == WrapperPlayServerPlayerInfo.Action.UPDATE_GAME_MODE || info.getAction() == WrapperPlayServerPlayerInfo.Action.ADD_PLAYER) {
List<WrapperPlayServerPlayerInfo.PlayerData> nmsPlayerInfoDataList = info.getPlayerDataList();
int hideCount = 0;
for (WrapperPlayServerPlayerInfo.PlayerData playerData : nmsPlayerInfoDataList) {
if (GrimAPI.INSTANCE.getSpectateManager().shouldHidePlayer(receiver, playerData)) {
hideCount++;
if (playerData.getGameMode() == GameMode.SPECTATOR)
playerData.setGameMode(GameMode.SURVIVAL);
}
}
// if amount of hidden players is the amount of players updated & is an update game mode action just cancel it
if (hideCount == nmsPlayerInfoDataList.size() && info.getAction() == WrapperPlayServerPlayerInfo.Action.UPDATE_GAME_MODE) {
event.setCancelled(true);
} else if (hideCount > 0) {
event.markForReEncode(true);
}
}
} else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_UPDATE) {
GrimPlayer receiver = GrimAPI.INSTANCE.getPlayerDataManager().getPlayer(event.getUser());
if (receiver == null) return;
WrapperPlayServerPlayerInfoUpdate wrapper = new WrapperPlayServerPlayerInfoUpdate(event);
EnumSet<WrapperPlayServerPlayerInfoUpdate.Action> actions = wrapper.getActions();
if (!actions.contains(WrapperPlayServerPlayerInfoUpdate.Action.UPDATE_GAME_MODE)) return;
boolean onlyGameMode = actions.size() == 1; // packet is being sent to only update game modes
int hideCount = 0;
List<WrapperPlayServerPlayerInfoUpdate.PlayerInfo> modified = new ArrayList<>(wrapper.getEntries().size());
// iterate through the player entries
for (WrapperPlayServerPlayerInfoUpdate.PlayerInfo entry : wrapper.getEntries()) {
// check if the player should be hidden
WrapperPlayServerPlayerInfoUpdate.PlayerInfo modifiedPacket = null;
if (GrimAPI.INSTANCE.getSpectateManager().shouldHidePlayer(receiver, entry.getGameProfile().getUUID())) {
hideCount++;
// modify & create a new packet from pre-existing one if they are a spectator
if (entry.getGameMode() == GameMode.SPECTATOR) {
modifiedPacket = new WrapperPlayServerPlayerInfoUpdate.PlayerInfo(entry);
modifiedPacket.setGameMode(GameMode.SURVIVAL);
modified.add(modifiedPacket);
}
}
if (modifiedPacket == null) { // if the packet wasn't modified, send original
modified.add(entry);
} else if (!onlyGameMode) { // if more than just the game mode updated, modify the packet
modified.add(modifiedPacket);
} // if only the game mode was updated and the packet was modified, don't send anything
}
// if the amount of hidden players & modified entries are the same
if (hideCount == modified.size()) {
if (onlyGameMode) { // if only the game mode changed, cancel
event.setCancelled(true);
} else { // if more than the game mode changed, remove the action
wrapper.getActions().remove(WrapperPlayServerPlayerInfoUpdate.Action.UPDATE_GAME_MODE);
event.markForReEncode(true);
}
} else { // modify entries
wrapper.setEntries(modified);
event.markForReEncode(true);
}
}
}
}
// NOTE (AI): The listener runs at HIGHEST priority pre-Via so the rewrite happens before version conversion. The SpectateManager.shouldHidePlayer policy drives both branches, and packets are cancelled only when nothing meaningful remains to send.Record the UUID-to-profile mappings announced on the player list so entity and profile lookups in checks resolve correctly.
PacketEntityReplication wraps PLAYER_INFO and PLAYER_INFO_UPDATE sends and, transaction-sandwiched, puts ADD_PLAYER game profiles into compensatedEntities.profiles and removes them on REMOVE_PLAYER. The profile map feeds checks that need the game profile behind an entity id or uuid.
// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java =====
package ac.grim.grimac.events.packets;
import ac.grim.grimac.GrimAPI;
import ac.grim.grimac.api.config.ConfigManager;
import ac.grim.grimac.checks.Check;
import ac.grim.grimac.checks.type.PacketReceiveListener;
import ac.grim.grimac.checks.type.PacketSendListener;
import ac.grim.grimac.player.GrimPlayer;
import ac.grim.grimac.utils.anticheat.LogUtil;
import ac.grim.grimac.utils.data.SprintingState;
import ac.grim.grimac.utils.data.TrackerData;
import ac.grim.grimac.utils.data.packetentity.DashableEntity;
import ac.grim.grimac.utils.data.packetentity.PacketEntity;
import ac.grim.grimac.utils.data.packetentity.PacketEntityHook;
import ac.grim.grimac.utils.data.packetentity.PacketEntityTrackXRot;
import ac.grim.grimac.utils.enums.Pose;
import ac.grim.grimac.utils.nmsutil.EntityMetadataPoseUtil;
import ac.grim.grimac.utils.viaversion.ViaVersionUtil;
import com.github.retrooper.packetevents.PacketEvents;
import com.github.retrooper.packetevents.event.PacketReceiveEvent;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.manager.server.ServerVersion;
import com.github.retrooper.packetevents.protocol.entity.EntityPositionData;
import com.github.retrooper.packetevents.protocol.entity.data.EntityData;
import com.github.retrooper.packetevents.protocol.entity.type.EntityType;
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.protocol.player.InteractionHand;
import com.github.retrooper.packetevents.protocol.player.UserProfile;
import com.github.retrooper.packetevents.protocol.potion.PotionType;
import com.github.retrooper.packetevents.util.Vector3d;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerAttachEntity;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerDestroyEntities;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEffect;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityEquipment;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityMetadata;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityPositionSync;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRelativeMove;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRelativeMoveAndRotation;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityRotation;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityStatus;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerEntityTeleport;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfo;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoRemove;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerPlayerInfoUpdate;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerRemoveEntityEffect;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetPassengers;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSetSlot;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnEntity;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnLivingEntity;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPainting;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerSpawnPlayer;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerWindowItems;
import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.atomic.AtomicBoolean;
public class PacketEntityReplication extends Check implements PacketReceiveListener, PacketSendListener {
private final AtomicBoolean hasSentPreWavePacket = new AtomicBoolean(true);
// Let's imagine the player is on a boat.
// The player breaks this boat
// If we were to despawn the boat without an extra transaction, then the boat would disappear before
// it disappeared on the client side, creating a ghost boat to flag checks with
//
// If we were to despawn the tick after, spawning must occur the transaction before to stop the same exact
// problem with ghost boats in reverse.
//
// Therefore, we despawn the transaction after, and spawn the tick before.
//
// If we despawn then spawn an entity in the same transaction, then this solution would despawn the new entity
// instead of the old entity, so we wouldn't see the boat at all
//
// Therefore, if the server sends a despawn and then a spawn in the same transaction for the same entity,
// We should simply add a transaction (which will clear this list!)
//
// Another valid solution is to simply spam more transactions, but let's not waste bandwidth.
private final List<Integer> despawnedEntitiesThisTransaction = new ArrayList<>();
// Maximum ping when a firework boost is removed from the player.
private int maxFireworkBoostPing = 1000;
public PacketEntityReplication(GrimPlayer player) {
super(player);
}
@Override
public void onPacketReceive(PacketReceiveEvent event) {
// Teleports don't interpolate, duplicate 1.17 packets don't interpolate
if (!isTickPacket(event.getPacketType())) return;
player.compensatedEntities.entitiesRemovedThisTick.clear();
boolean isTickingReliably = player.isTickingReliablyFor(3);
PacketEntity playerVehicle = player.compensatedEntities.self.getRiding();
for (PacketEntity entity : player.compensatedEntities.entityMap.values()) {
if (entity == playerVehicle && !player.vehicleData.lastDummy) {
// The player has this as their vehicle, so they aren't interpolating it.
// And it isn't a dummy position
entity.setPositionRaw(player, entity.getPossibleLocationBoxes());
} else {
entity.onMovement(isTickingReliably);
}
}
if (player.vehicleData.camelSprintingState == SprintingState.STOPPING) {
player.vehicleData.camelSprintingState = SprintingState.STOPPED;
} else if (player.vehicleData.camelSprintingState == SprintingState.STOPPED && player.isSprinting) { // For sprint desyncs
player.vehicleData.camelSprintingState = SprintingState.STARTED;
}
}
@Override
public void onPacketSend(PacketSendEvent event) {
// ensure grim is the one that sent the transaction
if ((event.getPacketType() == PacketType.Play.Server.PING || event.getPacketType() == PacketType.Play.Server.WINDOW_CONFIRMATION) && player.packetStateData.lastServerTransWasValid) {
despawnedEntitiesThisTransaction.clear();
} else if (event.getPacketType() == PacketType.Play.Server.SPAWN_LIVING_ENTITY) {
WrapperPlayServerSpawnLivingEntity packetOutEntity = new WrapperPlayServerSpawnLivingEntity(event);
addEntity(packetOutEntity.getEntityId(), packetOutEntity.getEntityUUID(), packetOutEntity.getEntityType(), packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), packetOutEntity.getEntityMetadata(), 0);
} else if (event.getPacketType() == PacketType.Play.Server.SPAWN_ENTITY) {
WrapperPlayServerSpawnEntity packetOutEntity = new WrapperPlayServerSpawnEntity(event);
addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID().orElse(null), packetOutEntity.getEntityType(), packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), null, packetOutEntity.getData());
} else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PLAYER) {
WrapperPlayServerSpawnPlayer packetOutEntity = new WrapperPlayServerSpawnPlayer(event);
addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID(), EntityTypes.PLAYER, packetOutEntity.getPosition(), packetOutEntity.getYaw(), packetOutEntity.getPitch(), packetOutEntity.getEntityMetadata(), 0);
} else if (event.getPacketType() == PacketType.Play.Server.SPAWN_PAINTING) {
WrapperPlayServerSpawnPainting packetOutEntity = new WrapperPlayServerSpawnPainting(event);
addEntity(packetOutEntity.getEntityId(), packetOutEntity.getUUID(), EntityTypes.PAINTING, packetOutEntity.getPosition().toVector3d(), 0, 0f, null, packetOutEntity.getDirection().getHorizontalIndex());
} else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE) {
WrapperPlayServerEntityRelativeMove move = new WrapperPlayServerEntityRelativeMove(event);
handleMoveEntity(event, move.getEntityId(), move.getDeltaX(), move.getDeltaY(), move.getDeltaZ(), null, null, true, true);
} else if (event.getPacketType() == PacketType.Play.Server.ENTITY_RELATIVE_MOVE_AND_ROTATION) {
WrapperPlayServerEntityRelativeMoveAndRotation move = new WrapperPlayServerEntityRelativeMoveAndRotation(event);
handleMoveEntity(event, move.getEntityId(), move.getDeltaX(), move.getDeltaY(), move.getDeltaZ(), move.getYaw() * 0.7111111F, move.getPitch() * 0.7111111F, true, true);
} else if (event.getPacketType() == PacketType.Play.Server.ENTITY_TELEPORT) {
WrapperPlayServerEntityTeleport move = new WrapperPlayServerEntityTeleport(event);
Vector3d pos = move.getPosition();
handleMoveEntity(event, move.getEntityId(), pos.getX(), pos.getY(), pos.getZ(), move.getYaw(), move.getPitch(), false, true);
} else if (event.getPacketType() == PacketType.Play.Server.ENTITY_POSITION_SYNC) {
// ENTITY_TELEPORT but without relative flags
WrapperPlayServerEntityPositionSync move = new WrapperPlayServerEntityPositionSync(event);
final EntityPositionData values = move.getValues();
final Vector3d pos = values.getPosition();
// TODO this isn't technically correct
// If the position sync is to a pos > 4096 from the entity pos, client does some special stuff without interpolation
handleMoveEntity(event, move.getId(), pos.getX(), pos.getY(), pos.getZ(), values.getYaw(), values.getPitch(), false, true);
} else if (event.getPacketType() == PacketType.Play.Server.ENTITY_ROTATION) { // Affects interpolation
WrapperPlayServerEntityRotation move = new WrapperPlayServerEntityRotation(event);
handleMoveEntity(event, move.getEntityId(), 0, 0, 0, move.getYaw() * 0.7111111F, move.getPitch() * 0.7111111F, true, false);
} else if (event.getPacketType() == PacketType.Play.Server.ENTITY_METADATA) {
WrapperPlayServerEntityMetadata entityMetadata = new WrapperPlayServerEntityMetadata(event);
schedulePoseTransition(entityMetadata, event);
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.compensatedEntities.updateEntityMetadata(entityMetadata.getEntityId(), entityMetadata.getEntityMetadata()));
} else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EQUIPMENT) {
WrapperPlayServerEntityEquipment equipment = new WrapperPlayServerEntityEquipment(event);
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.compensatedEntities.updateEntityEquipment(equipment.getEntityId(), equipment.getEquipment()));
}
// 1.19.3+
else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_UPDATE) {
WrapperPlayServerPlayerInfoUpdate info = new WrapperPlayServerPlayerInfoUpdate(event);
if (info.getActions().contains(WrapperPlayServerPlayerInfoUpdate.Action.ADD_PLAYER)) {
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {
for (WrapperPlayServerPlayerInfoUpdate.PlayerInfo entry : info.getEntries()) {
final UserProfile gameProfile = entry.getGameProfile();
final UUID uuid = gameProfile.getUUID();
player.compensatedEntities.profiles.put(uuid, gameProfile);
}
});
}
} else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO_REMOVE) {
WrapperPlayServerPlayerInfoRemove remove = new WrapperPlayServerPlayerInfoRemove(event);
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> remove.getProfileIds().forEach(player.compensatedEntities.profiles::remove));
} else if (event.getPacketType() == PacketType.Play.Server.PLAYER_INFO) {
WrapperPlayServerPlayerInfo info = new WrapperPlayServerPlayerInfo(event);
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {
if (info.getAction() == WrapperPlayServerPlayerInfo.Action.ADD_PLAYER) {
for (WrapperPlayServerPlayerInfo.PlayerData entry : info.getPlayerDataList()) {
final UserProfile gameProfile = entry.getUserProfile();
final UUID uuid = gameProfile.getUUID();
player.compensatedEntities.profiles.put(uuid, gameProfile);
}
} else if (info.getAction() == WrapperPlayServerPlayerInfo.Action.REMOVE_PLAYER) {
info.getPlayerDataList().forEach(profile -> player.compensatedEntities.profiles.remove(profile.getUserProfile().getUUID()));
}
});
} else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EFFECT) {
WrapperPlayServerEntityEffect effect = new WrapperPlayServerEntityEffect(event);
PotionType type = effect.getPotionType();
// ViaVersion tries faking levitation effects and fails badly lol, flagging the anticheat
// Block other effects just in case ViaVersion gets any ideas
//
// Set to 24 so ViaVersion blocks it
// 24 is the levitation effect
if (player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && ViaVersionUtil.isAvailable && type.getId(player.getClientVersion()) > 23) {
event.setCancelled(true);
return;
}
// ViaVersion dolphin's grace also messes us up, set it to a potion effect that doesn't exist on 1.12
// Effect 31 is bad omen
if (player.getClientVersion().isOlderThan(ClientVersion.V_1_13) && ViaVersionUtil.isAvailable && type.getId(player.getClientVersion()) == 30) {
event.setCancelled(true);
return;
}
if (isDirectlyAffectingPlayer(player, effect.getEntityId())) player.sendTransaction();
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {
PacketEntity entity = player.compensatedEntities.getEntity(effect.getEntityId());
if (entity == null) return;
entity.addPotionEffect(type, effect.getEffectAmplifier());
});
} else if (event.getPacketType() == PacketType.Play.Server.REMOVE_ENTITY_EFFECT) {
WrapperPlayServerRemoveEntityEffect effect = new WrapperPlayServerRemoveEntityEffect(event);
if (isDirectlyAffectingPlayer(player, effect.getEntityId())) player.sendTransaction();
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {
PacketEntity entity = player.compensatedEntities.getEntity(effect.getEntityId());
if (entity == null) return;
entity.removePotionEffect(effect.getPotionType());
});
} else if (event.getPacketType() == PacketType.Play.Server.UPDATE_ATTRIBUTES) {
WrapperPlayServerUpdateAttributes attributes = new WrapperPlayServerUpdateAttributes(event);
int entityID = attributes.getEntityId();
// The attributes for this entity is active, currently
if (isDirectlyAffectingPlayer(player, entityID)) player.sendTransaction();
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(),
() -> player.compensatedEntities.updateAttributes(entityID, attributes.getProperties()));
} else if (event.getPacketType() == PacketType.Play.Server.ENTITY_STATUS) {
WrapperPlayServerEntityStatus status = new WrapperPlayServerEntityStatus(event);
// This hasn't changed from 1.7.2 to 1.17
// Needed to exempt players on dead vehicles, as dead entities have strange physics.
if (status.getStatus() == 3) {
PacketEntity entity = player.compensatedEntities.getEntity(status.getEntityId());
if (entity == null) return;
entity.isDead = true;
}
if (status.getStatus() == 9) {
if (status.getEntityId() != player.entityID) return;
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));
}
if (status.getStatus() == 31) {
PacketEntity hook = player.compensatedEntities.getEntity(status.getEntityId());
if (!(hook instanceof PacketEntityHook hookEntity)) return;
if (hookEntity.attached == player.entityID) {
player.sendTransaction();
// We don't transaction sandwich this, it's too rare to be a real problem.
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.uncertaintyHandler.fishingRodPulls.add(hookEntity.owner));
}
}
if (status.getStatus() >= 24 && status.getStatus() <= 28 && status.getEntityId() == player.entityID) {
player.compensatedEntities.self.opLevel = status.getStatus() - 24;
}
} else if (event.getPacketType() == PacketType.Play.Server.SET_SLOT) {
WrapperPlayServerSetSlot slot = new WrapperPlayServerSetSlot(event);
if (slot.getWindowId() == 0) {
Runnable task = () -> {
if (slot.getSlot() - 36 == player.packetStateData.lastSlotSelected && (
!player.inventory.getHeldItem().is(slot.getItem().getType()) || player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)
) || slot.getSlot() == 45 && !player.inventory.getOffHand().is(slot.getItem().getType())) {
InteractionHand hand = slot.getSlot() == 45 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;
if (hand == player.packetStateData.itemInUseHand) {
player.packetStateData.setSlowedByUsingItem(false);
}
if (player.isResetItemUsageOnItemUpdate() && hand == GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer)) {
GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);
}
}
};
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), task);
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, task);
}
} else if (event.getPacketType() == PacketType.Play.Server.WINDOW_ITEMS) {
WrapperPlayServerWindowItems items = new WrapperPlayServerWindowItems(event);
if (items.getWindowId() == 0) { // Player inventory
Runnable task = () -> {
if (player.getClientVersion().isOlderThanOrEquals(ClientVersion.V_1_8)) {
player.packetStateData.setSlowedByUsingItem(false);
if (player.isResetItemUsageOnItemUpdate()) {
GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);
}
} else {
if (items.getItems().size() > 45 && !player.inventory.getOffHand().is(items.getItems().get(45).getType())) {
if (player.packetStateData.itemInUseHand == InteractionHand.OFF_HAND) {
player.packetStateData.setSlowedByUsingItem(false);
}
if (player.isResetItemUsageOnItemUpdate() && GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer) == InteractionHand.OFF_HAND) {
GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);
}
}
if (!player.inventory.getHeldItem().is(items.getItems().get(player.packetStateData.lastSlotSelected + 36).getType())) {
if (player.packetStateData.itemInUseHand == InteractionHand.MAIN_HAND) {
player.packetStateData.setSlowedByUsingItem(false);
}
if (player.isResetItemUsageOnItemUpdate() && GrimAPI.INSTANCE.getItemResetHandler().getItemUsageHand(player.platformPlayer) == InteractionHand.MAIN_HAND) {
GrimAPI.INSTANCE.getItemResetHandler().resetItemUsage(player.platformPlayer);
}
}
}
};
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), task);
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, task);
}
}
// 1.8 clients fail to send the RELEASE_USE_ITEM packet when a window is opened client sided while using an item
else if (event.getPacketType() == PacketType.Play.Server.OPEN_WINDOW) {
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));
} else if (event.getPacketType() == PacketType.Play.Server.OPEN_HORSE_WINDOW) {
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> player.packetStateData.setSlowedByUsingItem(false));
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get() + 1, () -> player.packetStateData.setSlowedByUsingItem(false));
} else if (event.getPacketType() == PacketType.Play.Server.SET_PASSENGERS) {
WrapperPlayServerSetPassengers mount = new WrapperPlayServerSetPassengers(event);
int vehicleID = mount.getEntityId();
int[] passengers = mount.getPassengers();
handleMountVehicle(event, vehicleID, passengers);
} else if (event.getPacketType() == PacketType.Play.Server.ATTACH_ENTITY) {
WrapperPlayServerAttachEntity attach = new WrapperPlayServerAttachEntity(event);
// This packet was replaced by the mount packet on 1.9+ servers - to support multiple passengers on one vehicle
if (PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9))
return;
// If this is mounting rather than leashing
if (!attach.isLeash()) {
// Alright, let's convert this to the 1.9+ format to make it easier for grim
int vehicleID = attach.getHoldingId();
int attachID = attach.getAttachedId();
TrackerData trackerData = player.compensatedEntities.getTrackedEntity(attachID);
if (trackerData != null) {
// 1.8 sends a vehicle ID of -1 to dismount the entity from its vehicle
// This is opposite of the 1.9+ format, which sends the vehicle ID and then an empty array.
if (vehicleID == -1) { // Dismounting
vehicleID = trackerData.getLegacyPointEightMountedUpon();
handleMountVehicle(event, vehicleID, new int[]{}); // The vehicle is empty
} else { // Mounting
trackerData.setLegacyPointEightMountedUpon(vehicleID);
handleMountVehicle(event, vehicleID, new int[]{attachID});
}
} else {
// I don't think we can recover from this... warn and move on as this shouldn't happen.
LogUtil.warn("Server sent an invalid attach entity packet for entity " + attach.getHoldingId() + " with passenger " + attach.getAttachedId() + "! The client ignores this.");
}
}
} else if (event.getPacketType() == PacketType.Play.Server.DESTROY_ENTITIES) {
WrapperPlayServerDestroyEntities destroy = new WrapperPlayServerDestroyEntities(event);
int[] destroyEntityIds = destroy.getEntityIds();
for (int entityID : destroyEntityIds) {
despawnedEntitiesThisTransaction.add(entityID);
player.compensatedEntities.serverPositionsMap.remove(entityID);
// Remove the tracked vehicle (handling tracking knockback) if despawned
if (player.compensatedEntities.serverPlayerVehicle != null && player.compensatedEntities.serverPlayerVehicle == entityID) {
player.compensatedEntities.serverPlayerVehicle = null;
}
}
final int destroyTransaction = player.lastTransactionSent.get() + 1;
player.latencyUtils.addRealTimeTask(destroyTransaction, () -> {
for (int entityId : destroyEntityIds) {
player.compensatedEntities.removeEntity(entityId);
player.dashableEntities.removeEntity(entityId);
player.fireworks.removeFirework(entityId);
player.compensatedEntities.entitiesRemovedThisTick.add(entityId);
}
});
// Don't let the player freeze transactions to keep the firework boost velocity + uncertainty
// Also generally prevents people with high ping gaining too high an advantage in firework use
if (maxFireworkBoostPing > 0) {
player.runNettyTaskInMs(() -> {
if (player.lastTransactionReceived.get() >= destroyTransaction) return;
for (int entityID : destroyEntityIds) {
// If the player has a firework boosting them, setback
if (player.fireworks.hasFirework(entityID)) {
player.getSetbackTeleportUtil().executeViolationSetback();
break;
}
}
}, maxFireworkBoostPing);
}
}
}
private void handleMountVehicle(PacketSendEvent event, int vehicleID, int[] passengers) {
boolean wasInVehicle = player.compensatedEntities.serverPlayerVehicle != null && player.compensatedEntities.serverPlayerVehicle == vehicleID;
boolean inThisVehicle = false;
for (int passenger : passengers) {
inThisVehicle = passenger == player.entityID;
if (inThisVehicle) break;
}
if (inThisVehicle && !wasInVehicle) {
player.handleMountVehicle(vehicleID);
}
if (!inThisVehicle && wasInVehicle) {
player.handleDismountVehicle(event);
}
// Better lag compensation if we were affected by this
if (wasInVehicle || inThisVehicle) {
player.sendTransaction();
}
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {
PacketEntity vehicle = player.compensatedEntities.getEntity(vehicleID);
// Vanilla likes sending null vehicles, so we must ignore those like the client ignores them
if (vehicle == null) return;
// Eject existing passengers for this vehicle
for (PacketEntity passenger : new ArrayList<>(vehicle.passengers)) {
passenger.eject();
}
// Add the entities as vehicles
for (int entityID : passengers) {
PacketEntity passenger = player.compensatedEntities.getEntity(entityID);
if (passenger == null) continue;
passenger.mount(vehicle);
}
});
}
private void handleMoveEntity(PacketSendEvent event, int entityId, double deltaX, double deltaY, double deltaZ, Float yaw, Float pitch, boolean isRelative, boolean hasPos) {
TrackerData data = player.compensatedEntities.getTrackedEntity(entityId);
final boolean didNotSendPreWave = hasSentPreWavePacket.compareAndSet(false, true);
if (didNotSendPreWave) player.sendTransaction();
if (data != null) {
// Update the tracked server's entity position
if (isRelative) {
// There is a bug where vehicles may start flying due to mojang setting packet position on the client
// (Works at 0 ping but causes funny bugs at any higher ping)
// As we don't want vehicles to fly, we need to replace it with a teleport if it is player vehicle
//
// Don't bother with client controlled vehicles though
boolean vanillaVehicleFlight = player.compensatedEntities.serverPlayerVehicle != null
&& player.compensatedEntities.serverPlayerVehicle == entityId
&& player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_9)
// TODO: https://discord.com/channels/721686193061888071/721686193515003966/1310659538831020123
// Why does the server now send an entity rel move packet matching the player's vehicle movement every time?
&& PacketEvents.getAPI().getServerManager().getVersion().isOlderThan(ServerVersion.V_1_21_2)
&& PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9);
// ViaVersion sends two relative packets when moving more than 4 blocks
// This is broken and causes the client to interpolate like (0, 4) and (1, 3) instead of (1, 7)
// This causes impossible hits, so grim must replace this with a teleport entity packet
// Not ideal, but neither is 1.8 players on a 1.9+ server.
if (vanillaVehicleFlight ||
((Math.abs(deltaX) >= 3.9375 || Math.abs(deltaY) >= 3.9375 || Math.abs(deltaZ) >= 3.9375) && player.getClientVersion().isOlderThan(ClientVersion.V_1_9) && PacketEvents.getAPI().getServerManager().getVersion().isNewerThanOrEquals(ServerVersion.V_1_9))) {
player.user.writePacket(new WrapperPlayServerEntityTeleport(entityId, new Vector3d(data.getX() + deltaX, data.getY() + deltaY, data.getZ() + deltaZ), yaw == null ? data.getXRot() : yaw, pitch == null ? data.getYRot() : pitch, false));
event.setCancelled(true);
return;
}
data.setX(data.getX() + deltaX);
data.setY(data.getY() + deltaY);
data.setZ(data.getZ() + deltaZ);
} else {
data.setX(deltaX);
data.setY(deltaY);
data.setZ(deltaZ);
}
if (yaw != null) {
data.setXRot(yaw);
data.setYRot(pitch);
}
// We can't hang two relative moves on one transaction
if (data.getLastTransactionHung() == player.lastTransactionSent.get()) {
player.sendTransaction();
}
data.setLastTransactionHung(player.lastTransactionSent.get());
}
int lastTrans = player.lastTransactionSent.get();
player.latencyUtils.addRealTimeTask(lastTrans, () -> {
PacketEntity entity = player.compensatedEntities.getEntity(entityId);
if (entity == null) return;
if (entity instanceof PacketEntityTrackXRot xRotEntity && yaw != null) {
xRotEntity.packetYaw = yaw;
xRotEntity.steps = entity.isBoat ? 10 : 3;
}
entity.onFirstTransaction(isRelative, hasPos, deltaX, deltaY, deltaZ, player);
});
player.latencyUtils.addRealTimeTask(lastTrans + 1, () -> {
PacketEntity entity = player.compensatedEntities.getEntity(entityId);
if (entity == null) return;
entity.onSecondTransaction();
});
}
public void addEntity(int entityID, UUID uuid, EntityType type, Vector3d position, float xRot, float yRot, List<EntityData<?>> entityMetadata, int extraData) {
if (despawnedEntitiesThisTransaction.contains(entityID)) {
player.sendTransaction();
}
player.compensatedEntities.serverPositionsMap.put(entityID, new TrackerData(position.getX(), position.getY(), position.getZ(), xRot, yRot, type, player.lastTransactionSent.get()));
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {
PacketEntity entity = player.compensatedEntities.addEntity(entityID, uuid, type, position, xRot, extraData);
if (entity instanceof DashableEntity dashable) {
player.dashableEntities.addEntity(entityID, dashable);
}
if (entityMetadata != null) {
if (EntityMetadataPoseUtil.usesPoseMetadata(entity) && player.getClientVersion().isNewerThanOrEquals(ClientVersion.V_1_14)) {
Pose initialPose = EntityMetadataPoseUtil.getPoseFromMetadata(entityMetadata);
if (initialPose != null) {
entity.currentPose = initialPose;
}
}
player.compensatedEntities.updateEntityMetadata(entityID, entityMetadata);
}
});
}
private void schedulePoseTransition(WrapperPlayServerEntityMetadata entityMetadata, PacketSendEvent event) {
if (player.getClientVersion().isOlderThan(ClientVersion.V_1_14)) return;
int entityId = entityMetadata.getEntityId();
if (entityId == player.entityID) return;
Pose newPose = EntityMetadataPoseUtil.getPoseFromMetadata(entityMetadata.getEntityMetadata());
if (newPose == null) return;
boolean shouldTrackPoseTransition = false;
PacketEntity entity = player.compensatedEntities.getEntity(entityId);
if (entity != null) {
shouldTrackPoseTransition = EntityMetadataPoseUtil.usesPoseMetadata(entity);
} else {
// If the client didn't respond to the spawn packet yet, we need to check if we should track the pose transition based on the entity type
// is there a better way to do this?
TrackerData trackedEntity = player.compensatedEntities.getTrackedEntity(entityId);
if (trackedEntity != null) {
shouldTrackPoseTransition = EntityMetadataPoseUtil.usesPoseMetadata(trackedEntity.getEntityType());
}
}
if (!shouldTrackPoseTransition) return;
player.sendTransaction();
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {
PacketEntity target = player.compensatedEntities.getEntity(entityId);
if (target == null) {
return;
}
target.beginPoseTransition(newPose);
});
event.getTasksAfterSend().add(() -> {
player.sendTransaction();
player.latencyUtils.addRealTimeTask(player.lastTransactionSent.get(), () -> {
PacketEntity target = player.compensatedEntities.getEntity(entityId);
if (target == null) {
return;
}
target.completePoseTransition(newPose);
});
});
}
private boolean isDirectlyAffectingPlayer(GrimPlayer player, int entityID) {
// The attributes for this entity is active, currently
return (player.compensatedEntities.serverPlayerVehicle == null && entityID == player.entityID) ||
(player.compensatedEntities.serverPlayerVehicle != null && entityID == player.compensatedEntities.serverPlayerVehicle);
}
public void onEndOfTickEvent(boolean async, boolean flush) {
// Only send a transaction at the end of the tick if we are tracking players
player.sendTransaction(async);
if (flush) player.user.flushPackets();
}
public void tickStartTick() {
hasSentPreWavePacket.set(false);
}
@Override
public void onReload(@NotNull ConfigManager config) {
maxFireworkBoostPing = config.getIntElse("max-ping-firework-boost", 1000);
}
}
// NOTE (AI): The player-list branches sit among the entity replication cases and reuse the same transaction-sandwich pattern as the rest of the listener, so profile updates land at the exact server tick.Related Packets
Wiki Cross-Reference
Tab-list ping icons follow fixed thresholds: negative (unknown) ping shows the no-connection icon, under 150 ms shows 5 bars, under 300 shows 4 bars, under 600 shows 3 bars, under 1000 shows 2 bars, and anything slower shows 1 bar.
MCP 1.8.9 S38PacketPlayerListItem implements Packet
1.8.9 callers: ItemInWorldManager.setGameType sends new S38PacketPlayerListItem (line 57) +1 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/server/management/ItemInWorldManager.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 S38PacketPlayerListItem
Full source walkthroughs of the modules and anti-cheats that use this packet.