0x20 S20PacketEntityProperties
Updates an entity's generic attributes (movement speed, max health, knockback resistance, etc.).
Published 2026-06-18 · Updated 2026-10-14
Fields
| Field | Type | Description |
|---|---|---|
| entityId | VarInt | Entity ID |
| properties | List of Attribute | Attribute key-value pairs |
Wire Encoding
| Field | Type | Notes |
|---|---|---|
| Entity ID | VarInt | |
| Number of Properties | int | |
| Per-Property | String + double + VarInt + Modifier[] | Attribute key, base value, modifiers |
MCP References
NetHandlerPlayClient.handleEntityProperties()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 | |
Deobfuscated MCP 1.8.9 source of S20PacketEntityProperties, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/server/S20PacketEntityProperties.java) at build time and verified present.
Deep Dive
Role in the protocol
S20PacketEntityProperties is a full attribute snapshot for one entity: entityId VarInt, property count int, then per property a String key, double base value, modifier count, and per modifier a UUID, name, amount and operation byte. The server sends it from EntityTrackerEntry when an entity's attributes change (line 267/311 in the corpus) and to new watchers when they start tracking (line 329/374). This is the only channel by which the client learns other entities' movement speed, knockback resistance, max health and attack damage.
Vanilla handling
NetHandlerPlayClient.handleEntityProperties resolves the entity and throws IllegalStateException if it is not EntityLivingBase ('Server tried to update attributes of a non-living entity'). It then walks the snapshot list: unknown attribute keys are registered on the fly as RangedAttribute with the full double range, setBaseValue is applied, all modifiers are removed and re-added from the wire. EntityLivingBase reads these attributes for its own speed, health and knockback math, so the packet directly drives client-side entity physics.
Why clients touch it
Rise 6.1.30 and 6.2.4 PingSpoofComponent include S20PacketEntityProperties in the 'players' class tuple: when a module enables players=true spoofing, incoming S20 packets are cancelled and released late. Rise 6.x NetworkAPI also registers the class (clientbound index 75). Memeware, Nekoware, Sigma, Spicy and Tenacity carry only the vanilla handler; the AntiBot/TargetInfo attribute-reading modules from older docs have no corpus hits in the reference set.
Exploit surface
The interesting abuse is buffering, not reading: PingSpoofComponent holds S20 for other entities so their attribute snapshots arrive after their position updates, keeping the client's view of entity speeds consistent with frozen positions during blink windows. Delaying entity-state packets does not touch the player's own server-authoritative motion, so no anti-cheat flags it. A client that reads S20 precisely could predict player speeds for aim/velocity math, but none of the 8 clients does.
Server-Side Handling
EntityTrackerEntry sends the full attribute map on change (line 267/311) and on watcher start (line 329/374). The packet carries base values plus modifiers, so the client rebuilds the complete attribute state from scratch on every arrival; there is no delta encoding and no inbound handler. Server-side validation is absent by design: the packet is clientbound.
Protocol Analysis
The property count is a plain int, not a VarInt, unlike most 1.8.9 counts. Attribute keys are the unlocalized names ('generic.movementSpeed', 'generic.knockbackResistance', 'generic.maxHealth', 'generic.attackDamage', 'horse.jumpStrength', 'zombie.spawnReinforcements'). Modifier operation is a byte (0 add, 1 multiply, 2 multiply-base). The client registers unknown keys as RangedAttribute with near-infinite bounds, so a server can push arbitrary named attributes.
Anti-Cheat Landscape
Entity attribute state is derived server-side, so anti-cheats never validate S20 traffic. The only observable effect of buffering it is delayed visual entity speed, which looks like normal lag. This is why PingSpoofComponent can park S20 for hundreds of milliseconds without risk.
implementation Implementation Cases
The client's only window into other entities' attributes. Rise 6.x PingSpoofComponent buffers S20 as part of its 'players' spoof category, and NetworkAPI registers it for scripts; the other six clients leave the vanilla handler untouched.
Buffers S20PacketEntityProperties for other entities during a spoof/blink window so attribute snapshots arrive late and stay consistent with frozen entity positions.
The 'players' Tuple lists S20PacketEntityProperties alongside S13PacketDestroyEntities, S14PacketEntity variants, S18PacketEntityTeleport and S19PacketEntityHeadLook. onPacketReceive cancels any listed class when its category flag is enabled and parks it as a TimedPacket; onPostMotion flushes entries whose time plus the spoof amount has elapsed, and dispatch() releases everything on world change or disable.
// ===== FILE: Rise 6.1.30, com/alan/clients/component/impl/player/PingSpoofComponent.java =====
package com.alan.clients.component.impl.player;
import com.alan.clients.component.Component;
import com.alan.clients.event.CancellableEvent;
import com.alan.clients.event.Listener;
import com.alan.clients.event.annotations.EventLink;
import com.alan.clients.event.impl.motion.PostMotionEvent;
import com.alan.clients.event.impl.other.WorldChangeEvent;
import com.alan.clients.event.impl.packet.PacketReceiveEvent;
import com.alan.clients.event.impl.packet.PacketSendEvent;
import com.alan.clients.util.packet.PacketUtil;
import net.minecraft.client.gui.GuiDownloadTerrain;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.*;
import net.minecraft.network.play.server.*;
import net.minecraft.util.Tuple;
import rip.vantage.commons.util.time.StopWatch;
import java.util.Arrays;
import java.util.concurrent.ConcurrentLinkedQueue;
public final class PingSpoofComponent extends Component {
public static ConcurrentLinkedQueue<PacketUtil.TimedPacket> packets = new ConcurrentLinkedQueue<>();
static StopWatch enabledTimer = new StopWatch();
public static boolean enabled;
static long amount;
static Tuple<Class[], Boolean> regular = new Tuple<>(new Class[]{C0FPacketConfirmTransaction.class, C00PacketKeepAlive.class, S1CPacketEntityMetadata.class}, false);
static Tuple<Class[], Boolean> velocity = new Tuple<>(new Class[]{S12PacketEntityVelocity.class, S27PacketExplosion.class}, false);
static Tuple<Class[], Boolean> teleports = new Tuple<>(new Class[]{S08PacketPlayerPosLook.class, S39PacketPlayerAbilities.class, S09PacketHeldItemChange.class}, false);
static Tuple<Class[], Boolean> players = new Tuple<>(new Class[]{S13PacketDestroyEntities.class, S14PacketEntity.class, S14PacketEntity.S16PacketEntityLook.class, S14PacketEntity.S15PacketEntityRelMove.class, S14PacketEntity.S17PacketEntityLookMove.class, S18PacketEntityTeleport.class, S20PacketEntityProperties.class, S19PacketEntityHeadLook.class}, false);
static Tuple<Class[], Boolean> blink = new Tuple<>(new Class[]{C02PacketUseEntity.class, C0DPacketCloseWindow.class, C0EPacketClickWindow.class, C0CPacketInput.class, C0BPacketEntityAction.class, C08PacketPlayerBlockPlacement.class, C07PacketPlayerDigging.class, C09PacketHeldItemChange.class, C13PacketPlayerAbilities.class, C15PacketClientSettings.class, C16PacketClientStatus.class, C17PacketCustomPayload.class, C18PacketSpectate.class, C19PacketResourcePackStatus.class, C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class, C0APacketAnimation.class}, false);
static Tuple<Class[], Boolean> movement = new Tuple<>(new Class[]{C03PacketPlayer.class, C03PacketPlayer.C04PacketPlayerPosition.class, C03PacketPlayer.C05PacketPlayerLook.class, C03PacketPlayer.C06PacketPlayerPosLook.class}, false);
public static Tuple<Class[], Boolean>[] types = new Tuple[]{regular, velocity, teleports, players, blink, movement};
@EventLink
public final Listener<PacketSendEvent> send = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());
@EventLink
public final Listener<PacketReceiveEvent> receive = event -> event.setCancelled(onPacket(event.getPacket(), event).isCancelled());
public CancellableEvent onPacket(Packet<?> packet, CancellableEvent event) {
if (!event.isCancelled() && enabled && Arrays.stream(types).anyMatch(tuple -> tuple.getSecond() && Arrays.stream(tuple.getFirst()).anyMatch(regularpacket -> regularpacket == packet.getClass()))) {
event.setCancelled();
packets.add(new PacketUtil.TimedPacket(packet));
}
return event;
}
public static void dispatch() {
if (!packets.isEmpty()) {
// Stops the packets from being called twice
boolean enabled = PingSpoofComponent.enabled;
PingSpoofComponent.enabled = false;
packets.forEach(timedPacket -> PacketUtil.queue(timedPacket.getPacket()));
PingSpoofComponent.enabled = enabled;
packets.clear();
}
}
public static void disable() {
enabled = false;
enabledTimer.setMillis(enabledTimer.millis - 999999999);
}
@EventLink
public final Listener<WorldChangeEvent> onWorldChange = event -> dispatch();
@EventLink
public final Listener<PostMotionEvent> onPostMotion = event -> {
if (!(enabled = !enabledTimer.finished(100) && !(mc.currentScreen instanceof GuiDownloadTerrain))) {
dispatch();
} else {
// Stops the packets from being called twice
enabled = false;
packets.forEach(packet -> {
if (packet.getTime() + amount < System.currentTimeMillis()) {
PacketUtil.queue(packet.getPacket());
packets.remove(packet);
}
});
enabled = true;
}
};
public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players) {
spoof(amount, regular, velocity, teleports, players, false);
}
public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink, boolean movement) {
enabledTimer.reset();
PingSpoofComponent.regular.setSecond(regular);
PingSpoofComponent.velocity.setSecond(velocity);
PingSpoofComponent.teleports.setSecond(teleports);
PingSpoofComponent.players.setSecond(players);
PingSpoofComponent.blink.setSecond(blink);
PingSpoofComponent.movement.setSecond(movement);
PingSpoofComponent.amount = amount;
}
public static void spoof(int amount, boolean regular, boolean velocity, boolean teleports, boolean players, boolean blink) {
spoof(amount, regular, velocity, teleports, players, blink, false);
}
public static void blink() {
spoof(9999999, true, false, false, false, true);
}
}
// NOTE (AI): S20PacketEntityProperties appears on line 30 inside the 'players'
// class tuple: when a module calls PingSpoofComponent.spoof(amount, ..., players=true),
// S20 packets for other entities are cancelled on receive, parked as TimedPacket
// entries, and flushed from onPostMotion once their delay elapses. The point is
// to keep attribute snapshots (movement speed, knockback resistance, health)
// consistent with the frozen entity positions during a blink/spoof window.anticheat Anti-Cheat Checks
The attribute snapshot packet is the server's only channel for entity attribute state, and anticheats treat it as authoritative input for movement simulation. Trackers capture the movement-speed attribute and its modifiers (Hydro, AntiHaxerman, intave), Grim clamps attribute values to the wiki-defined client bounds and excludes the sprinting modifier from the base value, TruthfulAC records attribute snapshots from the Bukkit API that mirrors the S20 state, and Photon rewrites the max-health attribute. Knockback resistance is present in the packet but no check in the corpus consumes it.
Model one server-sent attribute with wiki-defined min/max bounds and recompute its value from the S20 property, so the simulation never trusts an out-of-range base or modifier sum.
with() recomputes the value as (base + addition sum) x (1 + multiply-base sum) x product of (1 + multiply-total) and clamps to [min, max]; the sprinting modifier is removed first because Grim tracks sprint separately in CompensatedEntities. requiredVersion gates value changes behind a client version, and setRewriter/getRewriter adapt the value per client and server version. The constructor rejects defaults outside the range.
// ===== FILE: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/utils/data/attribute/ValuedAttribute.java =====
package ac.grim.grimac.utils.data.attribute;
import ac.grim.grimac.player.GrimPlayer;
import ac.grim.grimac.utils.math.GrimMath;
import com.github.retrooper.packetevents.protocol.attribute.Attribute;
import com.github.retrooper.packetevents.protocol.player.ClientVersion;
import com.github.retrooper.packetevents.wrapper.play.server.WrapperPlayServerUpdateAttributes;
import java.util.List;
import java.util.Optional;
import java.util.function.DoubleBinaryOperator;
import java.util.function.DoubleUnaryOperator;
import static ac.grim.grimac.utils.latency.CompensatedEntities.SPRINTING_MODIFIER_UUID;
public final class ValuedAttribute {
private static final DoubleUnaryOperator DEFAULT_GET_REWRITE = DoubleUnaryOperator.identity();
private final Attribute attribute;
// Attribute limits defined by https://minecraft.wiki/w/Attribute
// These seem to be clamped on the client, but not the server
private final double min, max;
private final double defaultValue;
private WrapperPlayServerUpdateAttributes.Property lastProperty;
private double value;
// This allows us to rewrite the value based on client & server version
private DoubleBinaryOperator setRewriter;
private DoubleUnaryOperator getRewriter;
private ValuedAttribute(Attribute attribute, double defaultValue, double min, double max) {
if (defaultValue < min || defaultValue > max) {
throw new IllegalArgumentException("Default value must be between min and max!");
}
this.attribute = attribute;
this.defaultValue = defaultValue;
this.value = defaultValue;
this.min = min;
this.max = max;
this.getRewriter = DEFAULT_GET_REWRITE;
}
public static ValuedAttribute ranged(Attribute attribute, double defaultValue, double min,
double max) {
return new ValuedAttribute(attribute, defaultValue, min, max);
}
public ValuedAttribute withSetRewriter(DoubleBinaryOperator rewriteFunction) {
this.setRewriter = rewriteFunction;
return this;
}
/**
* Creates a rewriter that prevents the value from ever being modified unless the player meets the required version.
* @param player the player
* @param requiredVersion the required version for the attribute
* @return this instance for chaining
*/
public ValuedAttribute requiredVersion(GrimPlayer player, ClientVersion requiredVersion) {
withSetRewriter((oldValue, newValue) -> {
if (player.getClientVersion().isOlderThan(requiredVersion)) {
return oldValue;
}
return newValue;
});
return this;
}
public ValuedAttribute withGetRewriter(DoubleUnaryOperator getRewriteFunction) {
this.getRewriter = getRewriteFunction;
return this;
}
public Attribute attribute() {
return attribute;
}
public void reset() {
this.value = defaultValue;
this.lastProperty =
null; // Remove the old property with its modifiers so we don't accidentally use it again, messing up the calculation.
}
public double get() {
return getRewriter.applyAsDouble(this.value);
}
public void override(double value) {
this.value = value;
}
@Deprecated // Avoid using this, it only exists for special cases
public Optional<WrapperPlayServerUpdateAttributes.Property> property() {
return Optional.ofNullable(lastProperty);
}
public void recalculate() {
with(lastProperty);
}
public double with(WrapperPlayServerUpdateAttributes.Property property) {
double baseValue = property.getValue();
double additionSum = 0;
double multiplyBaseSum = 0;
double multiplyTotalProduct = 1.0;
List<WrapperPlayServerUpdateAttributes.PropertyModifier> modifiers =
property.getModifiers();
modifiers.removeIf(modifier -> modifier.getUUID().equals(SPRINTING_MODIFIER_UUID) ||
modifier.getName().getKey().equals("sprinting"));
for (WrapperPlayServerUpdateAttributes.PropertyModifier modifier : modifiers) {
switch (modifier.getOperation()) {
case ADDITION:
additionSum += modifier.getAmount();
break;
case MULTIPLY_BASE:
multiplyBaseSum += modifier.getAmount();
break;
case MULTIPLY_TOTAL:
multiplyTotalProduct *= (1.0 + modifier.getAmount());
break;
}
}
double newValue = GrimMath.clamp((baseValue + additionSum) * (1 + multiplyBaseSum) * multiplyTotalProduct, min, max);
if (setRewriter != null) {
newValue = setRewriter.applyAsDouble(this.value, newValue);
}
if (newValue < min || newValue > max) {
throw new IllegalArgumentException("New value must be between min and max!");
}
this.lastProperty = property;
return this.value = newValue;
}
}
// NOTE (AI): The min/max clamps mirror the client-side clamp the wiki documents; the comment in the source notes the server does not clamp, which is the exact hole this class closes.Capture the player's walk speed from the S20 update, combine it with speed and slowness potion effects, and expose the effective move speed the simulation checks use.
handleAttributeUpdate matches generic.movementSpeed in the property list and stores the base value inside the transaction-confirm window. Entity-effect packets feed speed, slowness and jump boost levels, and getMoveSpeed(sprint) composes walk speed with the 0.3 sprint modifier and 0.2/-0.15 potion modifiers.
// ===== FILE: Incognitolol-Hydro, src/main/java/integral/studios/hydro/model/tracker/impl/AttributeTracker.java =====
package integral.studios.hydro.model.tracker.impl;
import com.github.retrooper.packetevents.event.PacketSendEvent;
import com.github.retrooper.packetevents.protocol.packettype.PacketType;
import com.github.retrooper.packetevents.wrapper.play.server.*;
import integral.studios.hydro.model.tracker.Tracker;
import integral.studios.hydro.model.PlayerData;
import integral.studios.hydro.util.lag.ConfirmedAbilities;
import lombok.Getter;
@Getter
public class AttributeTracker extends Tracker {
private static final double DEFAULT_WALK_SPEED = 0.1;
private static final double SPRINT_MODIFIER = 0.3;
private static final double SPEED_EFFECT_MODIFIER = 0.2;
private static final double SLOWNESS_EFFECT_MODIFIER = -0.15;
private static final int SPEED_EFFECT_ID = 1;
private static final int SLOWNESS_EFFECT_ID = 2;
private static final int JUMP_BOOST_EFFECT_ID = 8;
private double walkSpeed = DEFAULT_WALK_SPEED;
private int jumpBoost = 0;
private int speedBoost = 0;
private int slowness = 0;
private ConfirmedAbilities abilities = new ConfirmedAbilities();
private final ConfirmedAbilities lastAbilities = new ConfirmedAbilities();
public AttributeTracker(PlayerData playerData) {
super(playerData);
}
@Override
public void registerOutgoingPreHandler(PacketSendEvent event) {
if (event.getPacketType() == PacketType.Play.Server.PLAYER_ABILITIES) {
handlePlayerAbilities(event);
} else if (event.getPacketType() == PacketType.Play.Server.UPDATE_ATTRIBUTES) {
handleAttributeUpdate(event);
} else if (event.getPacketType() == PacketType.Play.Server.ENTITY_EFFECT) {
handleEntityEffect(event);
} else if (event.getPacketType() == PacketType.Play.Server.REMOVE_ENTITY_EFFECT) {
handleRemoveEntityEffect(event);
}
}
private void handlePlayerAbilities(PacketSendEvent event) {
final WrapperPlayServerPlayerAbilities wrapper = new WrapperPlayServerPlayerAbilities(event);
playerData.getTransactionTracker().confirmPre(() -> {
abilities = new ConfirmedAbilities(
wrapper.isInGodMode(),
wrapper.isFlying(),
wrapper.isFlightAllowed(),
wrapper.isInCreativeMode(),
wrapper.getFOVModifier(),
wrapper.getFlySpeed()
);
});
}
private void handleAttributeUpdate(PacketSendEvent event) {
WrapperPlayServerUpdateAttributes updateAttributes = new WrapperPlayServerUpdateAttributes(event);
for (WrapperPlayServerUpdateAttributes.Property property : updateAttributes.getProperties()) {
if ("generic.movementSpeed".equals(property.getKey())) {
playerData.getTransactionTracker().confirmPre(() -> {
walkSpeed = property.getValue();
});
break;
}
}
}
private void handleEntityEffect(PacketSendEvent event) {
WrapperPlayServerEntityEffect entityEffect = new WrapperPlayServerEntityEffect(event);
if (entityEffect.getEntityId() != playerData.getEntityId()) {
return;
}
int amplifier = entityEffect.getEffectAmplifier();
int effectId = entityEffect.getPotionType().getId(playerData.getClientVersion());
playerData.getTransactionTracker().confirmPre(() -> {
applyEffect(effectId, amplifier + 1);
});
}
private void handleRemoveEntityEffect(PacketSendEvent event) {
WrapperPlayServerRemoveEntityEffect removeEntityEffect = new WrapperPlayServerRemoveEntityEffect(event);
if (removeEntityEffect.getEntityId() != playerData.getEntityId()) {
return;
}
int effectId = removeEntityEffect.getPotionType().getId(playerData.getClientVersion());
playerData.getTransactionTracker().confirmPre(() -> {
removeEffect(effectId);
});
}
private void applyEffect(int effectId, int level) {
switch (effectId) {
case SPEED_EFFECT_ID:
speedBoost = level;
break;
case SLOWNESS_EFFECT_ID:
slowness = level;
break;
case JUMP_BOOST_EFFECT_ID:
jumpBoost = level;
break;
}
}
private void removeEffect(int effectId) {
switch (effectId) {
case SPEED_EFFECT_ID:
speedBoost = 0;
break;
case SLOWNESS_EFFECT_ID:
slowness = 0;
break;
case JUMP_BOOST_EFFECT_ID:
jumpBoost = 0;
break;
}
}
public double getMoveSpeed(boolean sprint) {
double baseSpeed = walkSpeed;
// Apply sprint modifier
if (sprint) {
baseSpeed *= (1.0 + SPRINT_MODIFIER);
}
// Apply potion effects
if (speedBoost > 0) {
baseSpeed *= (1.0 + (speedBoost * SPEED_EFFECT_MODIFIER));
}
if (slowness > 0) {
baseSpeed *= (1.0 + (slowness * SLOWNESS_EFFECT_MODIFIER));
}
return baseSpeed;
}
public double getJumpVelocityModifier() {
return jumpBoost * 0.1;
}
public void reset() {
walkSpeed = DEFAULT_WALK_SPEED;
jumpBoost = 0;
speedBoost = 0;
slowness = 0;
abilities = new ConfirmedAbilities();
}
}
// NOTE (AI): Hydro keys on the raw key string generic.movementSpeed, which is the 1.8-era key format the S20 packet carries.Keep the player's current attribute snapshot and potion levels, refreshed on connection confirm, so movement checks know the exact speed and effect state.
The tracker handles GPacketPlayServerUpdateAttributes for the player's own entity id and stores the full Snapshot list inside a connection-confirm action; entity-effect packets update the potion map the same way. getPotionLevel and hasPotion expose the effect state.
// ===== FILE: Tecnio-AntiHaxerman, src/main/java/me/tecnio/ahm/data/tracker/impl/AttributeTracker.java =====
package me.tecnio.ahm.data.tracker.impl;
import ac.artemis.packet.spigot.wrappers.GPacket;
import cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerEntityEffect;
import cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerEntityEffectRemove;
import cc.ghast.packet.wrapper.packet.play.server.GPacketPlayServerUpdateAttributes;
import lombok.Getter;
import me.tecnio.ahm.data.PlayerData;
import me.tecnio.ahm.data.tracker.Tracker;
import org.bukkit.potion.PotionEffectType;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Getter
public final class AttributeTracker extends Tracker {
private final Map<PotionEffectType, Integer> potions = new HashMap<>();
private List<GPacketPlayServerUpdateAttributes.Snapshot> attributes = new ArrayList<>();
public AttributeTracker(final PlayerData data) {
super(data);
}
@Override
public void handle(final GPacket packet) {
if (packet instanceof GPacketPlayServerEntityEffect) {
final GPacketPlayServerEntityEffect wrapper = ((GPacketPlayServerEntityEffect) packet);
if (wrapper.getEntityId() == data.getPlayer().getEntityId()) {
final PotionEffectType type = PotionEffectType.getById(wrapper.getEffectId());
final int amplifier = wrapper.getAmplifier();
data.getConnectionTracker().confirm(() -> this.potions.put(type, amplifier + 1));
}
} else if (packet instanceof GPacketPlayServerEntityEffectRemove) {
final GPacketPlayServerEntityEffectRemove wrapper = ((GPacketPlayServerEntityEffectRemove) packet);
if (wrapper.getEntityId() == data.getPlayer().getEntityId()) {
final PotionEffectType type = PotionEffectType.getById(wrapper.getEffectId());
data.getConnectionTracker().confirm(() -> this.potions.remove(type));
}
} else if (packet instanceof GPacketPlayServerUpdateAttributes) {
final GPacketPlayServerUpdateAttributes wrapper = ((GPacketPlayServerUpdateAttributes) packet);
if (wrapper.getEntityId() == data.getPlayer().getEntityId()) {
data.getConnectionTracker().confirm(() -> this.attributes = wrapper.getAttributes());
}
}
}
public int getPotionLevel(final PotionEffectType type) {
return this.potions.getOrDefault(type, 0);
}
public boolean hasPotion(final PotionEffectType type) {
return this.potions.containsKey(type);
}
}
// NOTE (AI): The confirm() wrapping means the snapshot applies at the player's confirmed tick, matching the tracker pattern used across the corpus.Read the S20 attribute collection for the player, store the server's modifier set, and derive whether the player has the sprinting modifier active.
sentAttributes reads the attribute collection modifier of the UPDATE_ATTRIBUTES packet for the player's own entity id, converts each WrappedAttribute into intave's Attribute model, clears the stored modifiers, then stores the server's modifier set and sets movement.hasSprintSpeed when the SPRINTING_MODIFIER is present. Base values update the ability metadata.
// ===== FILE: intave-intave, src/main/java/de/jpx3/intave/module/tracker/player/AttributeTracker.java =====
package de.jpx3.intave.module.tracker.player;
import com.comphenix.protocol.events.PacketContainer;
import com.comphenix.protocol.events.PacketEvent;
import com.comphenix.protocol.reflect.StructureModifier;
import com.comphenix.protocol.wrappers.WrappedAttribute;
import de.jpx3.intave.module.Module;
import de.jpx3.intave.module.linker.packet.ListenerPriority;
import de.jpx3.intave.module.linker.packet.PacketSubscription;
import de.jpx3.intave.player.attribute.Attribute;
import de.jpx3.intave.player.attribute.AttributeModifier;
import de.jpx3.intave.user.User;
import de.jpx3.intave.user.UserRepository;
import de.jpx3.intave.user.meta.AbilityMetadata;
import de.jpx3.intave.user.meta.MovementMetadata;
import org.bukkit.entity.Player;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import static de.jpx3.intave.module.linker.packet.PacketId.Server.UPDATE_ATTRIBUTES;
public final class AttributeTracker extends Module {
@PacketSubscription(
priority = ListenerPriority.HIGH,
packetsOut = {
UPDATE_ATTRIBUTES
}
)
public void sentAttributes(PacketEvent event) {
Player player = event.getPlayer();
User user = UserRepository.userOf(player);
PacketContainer packet = event.getPacket();
if (packet.getIntegers().read(0) == player.getEntityId()) {
StructureModifier<List<WrappedAttribute>> mod = packet.getAttributeCollectionModifier();
List<WrappedAttribute> attributes = mod.read(0);
mod.write(0, attributes);
user.tickFeedback(() -> {
attributes.forEach(attribute -> receivedAttribute(user, attribute));
});
}
}
private void receivedAttribute(User user, WrappedAttribute attribute) {
AbilityMetadata abilities = user.meta().abilities();
MovementMetadata movement = user.meta().movement();
String attributeKey = attribute.getAttributeKey();
if (abilities.findAttribute(attributeKey) != null) {
Attribute intaveAttribute = Attribute.fromProtocolLib(attribute);
List<AttributeModifier> intaveAttributes = abilities.modifiersOf(intaveAttribute);
intaveAttributes.clear();
Set<AttributeModifier> serverAttributes = intaveAttribute.modifiers();
movement.hasSprintSpeed = serverAttributes.contains(MovementMetadata.SPRINTING_MODIFIER);
intaveAttributes.addAll(new HashSet<>(serverAttributes));
abilities.modifyBaseValue(attributeKey, attribute.getBaseValue());
}
}
}
// NOTE (AI): The sprinting modifier has a fixed UUID in vanilla, which is how intave recognizes it in the raw modifier set.Record walk speed, gravity, jump strength, step height, movement efficiency and potion levels over a 1.5 second window so the simulation checks bound their physics assumptions.
updateStateCache in PlayerData reads the Bukkit attribute API (generic.movementSpeed, generic.gravity, generic.jumpStrength, generic.stepHeight, generic.movementEfficiency, player.sneakingSpeed) and potion levels, then calls attributeEngine.record. The engine keeps a timestamped deque, exposes max walk speed, min gravity, max jump strength and step height, and hasAttributeTransition detects attribute changes within the window. The debug tags (ATTR_LOW_GRAVITY, ATTR_SPEED, ATTR_JUMP, ATTR_STEP) label the active conditions.
// ===== FILE: TawnyE-TruthfulAC, src/main/java/ret/tawny/truthful/attributes/AttributeEngine.java =====
package ret.tawny.truthful.attributes;
import org.bukkit.potion.PotionEffectType;
import ret.tawny.truthful.data.PlayerData;
import java.util.Deque;
import java.util.concurrent.ConcurrentLinkedDeque;
public final class AttributeEngine {
private static final long HISTORY_DURATION_MS = 1500L;
private static final double EPSILON = 1.0E-4D;
private final PlayerData data;
private final Deque<AttributeSnapshot> history = new ConcurrentLinkedDeque<>();
private static final class AttributeSnapshot {
final double walkSpeed;
final double gravity;
final double jumpStrength;
final double stepHeight;
final double movementEfficiency;
final double waterMovementEfficiency;
final double sneakingSpeed;
final int speedLevel;
final int slownessLevel;
final int jumpBoostLevel;
final long timestamp;
AttributeSnapshot(double walkSpeed, int speedLevel, int slownessLevel, int jumpBoostLevel) {
this(walkSpeed, 0.08D, 0.42D, 0.6D, 0.0D, 0.0D, 0.3D,
speedLevel, slownessLevel, jumpBoostLevel);
}
AttributeSnapshot(double walkSpeed, double gravity, double jumpStrength, double stepHeight,
double movementEfficiency, double waterMovementEfficiency, double sneakingSpeed,
int speedLevel, int slownessLevel, int jumpBoostLevel) {
this.walkSpeed = walkSpeed;
this.gravity = gravity;
this.jumpStrength = jumpStrength;
this.stepHeight = stepHeight;
this.movementEfficiency = movementEfficiency;
this.waterMovementEfficiency = waterMovementEfficiency;
this.sneakingSpeed = sneakingSpeed;
this.speedLevel = speedLevel;
this.slownessLevel = slownessLevel;
this.jumpBoostLevel = jumpBoostLevel;
this.timestamp = System.currentTimeMillis();
}
}
public AttributeEngine(final PlayerData data) {
this.data = data;
}
/**
* Records a new snapshot of the player's current attributes and speed-affecting potions.
*/
public void record(final double walkSpeed, final int speedLevel, final int slownessLevel, final int jumpBoostLevel) {
history.addLast(new AttributeSnapshot(walkSpeed, speedLevel, slownessLevel, jumpBoostLevel));
cleanUp();
}
public void record(final double walkSpeed, final double gravity, final double jumpStrength,
final double stepHeight, final double movementEfficiency,
final double waterMovementEfficiency, final double sneakingSpeed,
final int speedLevel, final int slownessLevel, final int jumpBoostLevel) {
history.addLast(new AttributeSnapshot(walkSpeed, gravity, jumpStrength, stepHeight,
movementEfficiency, waterMovementEfficiency, sneakingSpeed,
speedLevel, slownessLevel, jumpBoostLevel));
cleanUp();
}
/**
* Cleans up snapshots older than the configured duration window.
*/
private void cleanUp() {
final long now = System.currentTimeMillis();
while (!history.isEmpty()) {
final AttributeSnapshot snap = history.peekFirst();
if (snap == null || now - snap.timestamp <= HISTORY_DURATION_MS) {
break;
}
history.pollFirst();
}
}
/**
* Gets the maximum walk speed attribute recorded in the history window.
*/
public double getMaxWalkSpeed() {
cleanUp();
double maxSpeed = 0.1D;
boolean hasElements = false;
for (final AttributeSnapshot snap : history) {
hasElements = true;
if (snap.walkSpeed > maxSpeed) {
maxSpeed = snap.walkSpeed;
}
}
// Fall back to current cached value if no snapshots exist yet
return hasElements ? maxSpeed : data.getWalkSpeedCacheRaw();
}
public double getMinGravity() {
cleanUp();
if (history.isEmpty()) return 0.08D;
double min = Double.MAX_VALUE;
for (final AttributeSnapshot snap : history) {
min = Math.min(min, snap.gravity);
}
return min == Double.MAX_VALUE ? 0.08D : min;
}
public double getMaxJumpStrength() {
cleanUp();
double max = 0.42D;
for (final AttributeSnapshot snap : history) {
max = Math.max(max, snap.jumpStrength);
}
return max;
}
public double getMaxStepHeight() {
cleanUp();
double max = 0.6D;
for (final AttributeSnapshot snap : history) {
max = Math.max(max, snap.stepHeight);
}
return max;
}
public double getMaxMovementEfficiency() {
cleanUp();
double max = 0.0D;
for (final AttributeSnapshot snap : history) {
max = Math.max(max, snap.movementEfficiency);
}
return max;
}
public double getMaxWaterMovementEfficiency() {
cleanUp();
double max = 0.0D;
for (final AttributeSnapshot snap : history) {
max = Math.max(max, snap.waterMovementEfficiency);
}
return max;
}
public double getMaxSneakingSpeed() {
cleanUp();
double max = 0.3D;
for (final AttributeSnapshot snap : history) {
max = Math.max(max, snap.sneakingSpeed);
}
return max;
}
/**
* Gets the maximum speed potion level recorded in the history window.
*/
public int getMaxSpeedLevel() {
cleanUp();
int maxLevel = 0;
for (final AttributeSnapshot snap : history) {
if (snap.speedLevel > maxLevel) {
maxLevel = snap.speedLevel;
}
}
return maxLevel;
}
/**
* Gets the minimum slowness level recorded in the history window.
* Prevents false positives during transition where slowness is applied.
*/
public int getMinSlownessLevel() {
cleanUp();
if (history.isEmpty()) return 0;
int minLevel = Integer.MAX_VALUE;
for (final AttributeSnapshot snap : history) {
if (snap.slownessLevel < minLevel) {
minLevel = snap.slownessLevel;
}
}
return minLevel == Integer.MAX_VALUE ? 0 : minLevel;
}
/**
* Gets the maximum jump boost level recorded in the history window.
*/
public int getMaxJumpBoostLevel() {
cleanUp();
int maxLevel = 0;
for (final AttributeSnapshot snap : history) {
if (snap.jumpBoostLevel > maxLevel) {
maxLevel = snap.jumpBoostLevel;
}
}
return maxLevel;
}
public boolean hasAttributeTransition() {
cleanUp();
if (history.size() < 2) return false;
double minWalk = Double.MAX_VALUE, maxWalk = 0.0D;
double minGravity = Double.MAX_VALUE, maxGravity = 0.0D;
double minJump = Double.MAX_VALUE, maxJump = 0.0D;
int minSpeed = Integer.MAX_VALUE, maxSpeed = 0;
int minSlow = Integer.MAX_VALUE, maxSlow = 0;
int minJumpBoost = Integer.MAX_VALUE, maxJumpBoost = 0;
for (final AttributeSnapshot snap : history) {
minWalk = Math.min(minWalk, snap.walkSpeed);
maxWalk = Math.max(maxWalk, snap.walkSpeed);
minGravity = Math.min(minGravity, snap.gravity);
maxGravity = Math.max(maxGravity, snap.gravity);
minJump = Math.min(minJump, snap.jumpStrength);
maxJump = Math.max(maxJump, snap.jumpStrength);
minSpeed = Math.min(minSpeed, snap.speedLevel);
maxSpeed = Math.max(maxSpeed, snap.speedLevel);
minSlow = Math.min(minSlow, snap.slownessLevel);
maxSlow = Math.max(maxSlow, snap.slownessLevel);
minJumpBoost = Math.min(minJumpBoost, snap.jumpBoostLevel);
maxJumpBoost = Math.max(maxJumpBoost, snap.jumpBoostLevel);
}
return maxWalk - minWalk > 0.005D
|| maxGravity - minGravity > 0.002D
|| maxJump - minJump > 0.01D
|| maxSpeed != minSpeed
|| maxSlow != minSlow
|| maxJumpBoost != minJumpBoost;
}
public String getDebugTags() {
cleanUp();
if (history.isEmpty()) return "ATTR_DEFAULT";
StringBuilder builder = new StringBuilder();
if (hasAttributeTransition()) append(builder, "ATTR_TRANSITION");
if (getMaxWalkSpeed() > 0.100D + EPSILON) append(builder, "ATTR_SPEED");
if (getMinGravity() < 0.080D - EPSILON) append(builder, "ATTR_LOW_GRAVITY");
if (getMaxJumpStrength() > 0.420D + EPSILON) append(builder, "ATTR_JUMP");
if (getMaxStepHeight() > 0.600D + EPSILON) append(builder, "ATTR_STEP");
if (getMaxMovementEfficiency() > EPSILON) append(builder, "ATTR_TERRAIN");
if (getMaxWaterMovementEfficiency() > EPSILON) append(builder, "ATTR_WATER");
if (getMaxSneakingSpeed() > 0.300D + EPSILON) append(builder, "ATTR_SNEAK");
return builder.length() == 0 ? "ATTR_VANILLA" : builder.toString();
}
private void append(StringBuilder builder, String value) {
if (builder.length() > 0) builder.append(',');
builder.append(value);
}
}
// NOTE (AI): This entry is included on the attribute domain: the file matches the corpus through the attribute keyword, and the engine consumes the state that S20 carries rather than the packet itself.Related Packets
Wiki Cross-Reference
Modifier operations apply in a fixed order: all addition modifiers first, then multiply-base percentage modifiers, then multiply-total modifiers.
MCP 1.8.9 S20PacketEntityProperties implements Packet
1.8.9 callers: EntityTrackerEntry.sendMetadataToAllAssociatedPlayers sends new S20PacketEntityProperties (line 324): https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityTrackerEntry.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.