update entity_teleport packet on 1.21.3+#1154
Conversation
update entity_teleport packet on 1.21.3
|
Do you have link to relevant vanilla source code for this? |
|
Re: the vanilla source — here's the relevant code, decompiled from the server jar ( public record ClientboundTeleportEntityPacket(int id, PositionMoveRotation change, Set<Relative> relatives, boolean onGround) {
public static final StreamCodec<FriendlyByteBuf, ClientboundTeleportEntityPacket> STREAM_CODEC = StreamCodec.composite(
ByteBufCodecs.VAR_INT, ClientboundTeleportEntityPacket::id,
PositionMoveRotation.STREAM_CODEC, ClientboundTeleportEntityPacket::change,
Relative.SET_STREAM_CODEC, ClientboundTeleportEntityPacket::relatives,
ByteBufCodecs.BOOL, ClientboundTeleportEntityPacket::onGround,
ClientboundTeleportEntityPacket::new);
}
public record PositionMoveRotation(Vec3 position, Vec3 deltaMovement, float yRot, float xRot) { /* Vec3, Vec3, FLOAT, FLOAT */ }So the wire layout is Two things worth fixing: 1. public enum Relative { X(0), Y(1), Z(2), Y_ROT(3), X_ROT(4), DELTA_X(5), DELTA_Y(6), DELTA_Z(7), ROTATE_DELTA(8); }
public static final StreamCodec<ByteBuf, Set<Relative>> SET_STREAM_CODEC = ByteBufCodecs.INT.map(Relative::unpack, Relative::pack);— a 4-byte int with bits 0–8. The inline "PositionUpdateRelatives": ["bitflags", { "type": "u32", "flags": ["x","y","z","yaw","pitch","dx","dy","dz","yawDelta"] }]So 2. This affects every 1.21.2+ version, not only 1.21.3. |
|
Is this ready to be merged? My console is again full of this spam :D |
|
@copilot Please correct the changes made per atiweb comment with |
Updated teleport_entity packet according to https://minecraft.wiki/w/Java_Edition_protocol/Packets#Synchronize_Vehicle_Position
Should fix partial packet errors for this packet.