0x1B S1BPacketEntityAttach

Attaches an entity to another (player on horse, animal on leash, leach knot).

Clientbound (Server → Client) · PLAY · net/minecraft/network/play/server/S1BPacketEntityAttach.java

Published 2026-06-18 · Updated 2026-10-14

entitymountvehicle
Complete 6/8

Fields

FieldTypeDescription
entityIdintEntity ID of the passenger
vehicleIdintEntity ID of the vehicle (-1 for detach)

Wire Encoding

FieldTypeNotes
Entity IDintPassenger
Vehicle IDintVehicle (-1 = detach)

MCP References

MCPNetHandlerPlayClient.handleEntityAttach()

Handler Interface

HNDINetHandlerPlayClient

Vanilla Source

S1BPacketEntityAttach.java68 lines · MCP 1.8.9Original ↗
1
package net.minecraft.network.play.server;
2
3
import java.io.IOException;
4
import net.minecraft.entity.Entity;
5
import net.minecraft.network.Packet;
6
import net.minecraft.network.PacketBuffer;
7
import net.minecraft.network.play.INetHandlerPlayClient;
8
9
public class S1BPacketEntityAttach implements Packet<INetHandlerPlayClient>
10
{
11
    private int leash;
12
    private int entityId;
13
    private int vehicleEntityId;
14
15
    public S1BPacketEntityAttach()
16
    {
17
    }
18
19
    public S1BPacketEntityAttach(int leashIn, Entity entityIn, Entity vehicle)
20
    {
21
        this.leash = leashIn;
22
        this.entityId = entityIn.getEntityId();
23
        this.vehicleEntityId = vehicle != null ? vehicle.getEntityId() : -1;
24
    }
25
26
    /**
27
     * Reads the raw packet data from the data stream.
28
     */
29
    public void readPacketData(PacketBuffer buf) throws IOException
30
    {
31
        this.entityId = buf.readInt();
32
        this.vehicleEntityId = buf.readInt();
33
        this.leash = buf.readUnsignedByte();
34
    }
35
36
    /**
37
     * Writes the raw packet data to the data stream.
38
     */
39
    public void writePacketData(PacketBuffer buf) throws IOException
40
    {
41
        buf.writeInt(this.entityId);
42
        buf.writeInt(this.vehicleEntityId);
43
        buf.writeByte(this.leash);
44
    }
45
46
    /**
47
     * Passes this Packet on to the NetHandler for processing.
48
     */
49
    public void processPacket(INetHandlerPlayClient handler)
50
    {
51
        handler.handleEntityAttach(this);
52
    }
53
54
    public int getLeash()
55
    {
56
        return this.leash;
57
    }
58
59
    public int getEntityId()
60
    {
61
        return this.entityId;
62
    }
63
64
    public int getVehicleEntityId()
65
    {
66
        return this.vehicleEntityId;
67
    }
68
}

Deobfuscated MCP 1.8.9 source of S1BPacketEntityAttach, fetched directly from Marcelektro/MavenMCP-1.8.9 (net/minecraft/network/play/server/S1BPacketEntityAttach.java) at build time and verified present.

Deep Dive

Role in the protocol

S1BPacketEntityAttach is the mount and leash state channel. Opcode 0 attaches an entity to a vehicle (vehicleId -1 detaches), opcode 1 manages leash knots. The corpus server senders: EntityTrackerEntry broadcasts (0, trackedEntity, ridingEntity) when a tracked entity enters range and on mount changes (lines 166, 387), EntityPlayerMP sends (0, self, ridingEntity) when the player mounts (line 630), and EntityLiving broadcasts (1, self, leashedToEntity) on leash attach and detach (lines 991, 1016). The wire format is three ints: leash code, entityId and vehicleId.

Vanilla handling

NetHandlerPlayClient.handleEntityAttach (Memeware 7.3 bundle, line 852) resolves both entities and branches on the code. For code 0 it clears the boat empty flag for the local player, shows the 'mount.onboard' sneak hint when the player mounts a vehicle, and calls mountEntity(vehicle). For code 1 it calls setLeashedToEntity or clearLeashed on the living entity. The handler is a pure state mirror: the client applies whatever the server announces.

Why clients touch it

Zero module hits in the 8-client corpus. The only non-vanilla reference is Rise 6.x NetworkAPI, the script packet whitelist, in both 6.1.30 and 6.2.4; no module in any client branches on S1B. The structural reason: attach state is fully client-rendered and server-authoritative, and the movement exploits that involve vehicles (boat fly, entity control) act on the serverbound side, on C03 positions sent while riding and on local rider physics, not on this clientbound announcement. There is nothing to gain by intercepting a state change the client must apply verbatim.

Exploit surface

The packet is a clientbound state mirror with no acknowledgement, so the abuse direction is server to client: a malicious server can spam attach packets to desync mount state or flip the client's ridingEntity, which corrupts the movement code path (client movement while riding uses the vehicle's physics). Anti-cheats flag vehicle abuse on the serverbound side: impossible vertical C03 deltas while the player's ridingEntity is set server-side. No cheat in the corpus interacts with this packet, and none needs to.

Server-Side Handling

Clientbound only. The server emits it from EntityTrackerEntry on tracking start and mount/leash changes, from EntityPlayerMP when the player mounts, and from EntityLiving on leash transitions. The client applies mountEntity or setLeashedToEntity/clearLeashed and shows the onboarding hint for the local player. No validation, no rate limit, no serverbound counterpart.

Protocol Analysis

Three ints: code (0 = riding, 1 = leash), entityId, vehicleId (-1 or null entity for detach/clear). The boat empty flag is a client-side convenience derived from the local player's mount state, not part of the wire format. The packet is sent once per state transition, not continuously; movement while riding travels through the S14/S18 stream of the vehicle entity.

Anti-Cheat Landscape

No anticheat inspects S1B because it is clientbound. Vehicle exploits are detected from the serverbound stream: boat fly produces C03 deltas inconsistent with the mounted entity's physics, and entity-control exploits abuse C09 slot changes. The packet matters to anti-cheat designers only as the trigger for the server-side riding state that those checks key on.

implementation Implementation Cases

The mount/leash packet is the one clientbound entity packet with no module consumers in the 8 clients: the only non-vanilla reference is the Rise 6.x script API whitelist. Vehicle movement exploits live entirely on the serverbound C03 side, so this announcement is left to vanilla.

None in the corpus. Rise 6.x scripts can receive it via the NetworkAPI whitelist (com/alan/clients/script/api/NetworkAPI.java, both versions), but no shipped module registers a handler.
Memeware, Nekoware, Sigma, Spicy and Tenacity appear only through the vanilla NetHandlerPlayClient handler; Rise 6.1.30 and 6.2.4 through the script API whitelist. The vanilla handler is identical across all eight bundles.

anticheat Anti-Cheat Checks

S1B is clientbound mount and leash state, and the corpus shows three real consumers: Grim converts the 1.8 attach into its 1.9+ mount format inside PacketEntityReplication, Artemis folds the player's attach into the prediction vehicle under a transaction confirmation, and Intave registers an AttachEntityReader plus an entity-tracker hook. The remaining hits are noise: NCP's attach terms are listener and block-attachment bookkeeping, Argus's CheckAttachedModules is its own client-module report channel, and Negativity, FlopAC and Artemis contribute constants and wrappers. The flagging side of vehicle exploits stays on the inbound C03 stream; these checks exist to keep the simulated vehicle state honest.

Attach replication (Grim) (GrimAnticheat-Grim)

Mirror the server's mount state into the compensated entity tracker so movement and vehicle checks know what the player and tracked entities are riding.

PacketEntityReplication parses WrapperPlayServerAttachEntity on the ATTACH_ENTITY send, ignores it on 1.9+ servers (replaced by SET_PASSENGERS), and for non-leash attaches converts the 1.8 format into handleMountVehicle: vehicleId -1 dismounts using the stored legacyPointEightMountedUpon, otherwise the mount pair is recorded. An attach naming an untracked entity logs a warning because the client itself would ignore it. SetbackTeleportUtil sends the matching detach during teleport setbacks so a player cannot re-enter a vehicle to keep a cheat active.

Detects: Nothing directly: state replication. It removes mount-state desync as a variable when movement checks evaluate vehicle motion, and the setback-time detach closes the vehicle-reentry bypass during lag-backs.

Source: GrimAnticheat-Grim, common/src/main/java/ac/grim/grimac/events/packets/PacketEntityReplication.java

Variations: Grim SetbackTeleportUtil (line 246) emits the detach itself on the 1.8 wire path during setbacks. No other anticheat mirrors attach state into a simulation.
Vehicle prediction sync (Artemis) (artemisac-artemis-minecraft-anticheat)

Apply the player's attach and detach to the prediction engine under a transaction confirmation so movement emulation knows when the player rides a vehicle.

MiscellaneousPreProcessor matches GPacketPlayServerEntityAttach: when the attach targets the player's own entity id, it registers a confirmFunctionAndTick on the TRANSACTION confirmation; at pre() the prediction vehicle is set from the vehicle id through NMS, and a null vehicle triggers resetMotion so the emulator stops attributing vehicle physics to the player.

Detects: Nothing directly: state sync. It feeds EmulatorPreProcessor's vehicle-aware movement simulation, which is what keeps vehicle-related motion flags accurate.

Source: artemisac-artemis-minecraft-anticheat, ac.artemis.core/src/main/java/ac/artemis/core/v4/processor/miscellaneous/MiscellaneousPreProcessor.java

Variations: Kauri PacketHandler (line 431) wraps the same packet on the send side. Intave tracks attach state through EntityTracker.sendAttachEntityPacket (line 120) in addition to its reader. FlopAC's WrappedOutAttachEntity and Artemis's own GPacketPlayServerEntityAttach are wrappers; Negativity's ATTACH_ENTITY constant is a registration.
Attach reader (Intave) (intave-intave)

Expose the attach packet's two int fields (entity id, vehicle id) to the substitution pipeline so entity filters can rewrite or drop attach packets.

AttachEntityReader extends AbstractPacketReader and implements EntityIterable: entityId() and vehicleId() read the two ints, and the SubstitutionIterator allows filters to write either field back into the packet (slot 1 rewrites the entity id, slot 2 the vehicle id). It is registered in PacketReaders as ATTACH_ENTITY.

Detects: Nothing directly: a packet reader. It is the intake point for Intave's entity substitution and filtering, which feed the entity tracker that movement checks consult.

Source: intave-intave, src/main/java/de/jpx3/intave/packet/reader/AttachEntityReader.java

Variations: Intave's EntityTracker also subscribes to the attach packet directly, and firework-rocket attach tracking in MovementMetadata is a separate 1.9+ mechanism. NCP's attach corpus hits are logger and listener bookkeeping, and Argus's CheckAttachedModules is its own client-module report channel; neither reads S1B.

Wiki Cross-Reference

Clientbound 0x1B: int entityId, int vehicleEntityId, unsigned byte leash flag.

Leash byte 0 means riding and 1 means leash; vehicle -1 or null detaches.

Sent once per mount or leash change; movement while riding uses vehicle packets.

MCP 1.8.9 S1BPacketEntityAttach implements Packet dispatching to INetHandlerPlayClient.handleEntityAttach; wire serde is readPacketData/writePacketData via readInt, readUnsignedByte.

1.8.9 callers: EntityLiving.clearLeashed sends new S1BPacketEntityAttach (line 1179) +2 more: https://github.com/Marcelektro/MavenMCP-1.8.9/blob/master/src/main/java/net/minecraft/entity/EntityLiving.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.