Interface FastPacketSender
Every method bypasses native-object listeners and the vanilla packet encoder while retaining compression, encryption, and socket processing. Exact documented client-native paths may also bypass protocol translation; all other connections retain it.
-
Method Summary
Modifier and TypeMethodDescriptionvoidbatch(Object platformPlayer, Consumer<FastPacketBatch> batch) Runs connection-scoped primitive writes on one Netty event-loop task and flushes once.voidsendArmorStandPose(Object platformPlayer, int entityId, EntityMetadataField<MetadataRotation> pose, float x, float y, float z) Sends one ArmorStand body-part pose directly as entity metadata and flushes immediately.default voidsendDisplayRotation(Object platformPlayer, int entityId, EntityMetadataField<NativeValue> rotation, float xDegrees, float yDegrees, float zDegrees) Converts XYZ Euler angles in degrees directly to a quaternion and sends it.voidsendDisplayRotation(Object platformPlayer, int entityId, EntityMetadataField<NativeValue> rotation, float x, float y, float z, float w) Sends one Display quaternion rotation directly as entity metadata and flushes immediately.voidsendDisplayScale(Object platformPlayer, int entityId, float x, float y, float z) Sends one Display scale vector directly as entity metadata and flushes immediately.voidsendDisplayScaleAndRotation(Object platformPlayer, int entityId, float scaleX, float scaleY, float scaleZ, EntityMetadataField<NativeValue> rotation, float rotationX, float rotationY, float rotationZ, float rotationW) Sends Display scale and one quaternion rotation together in one entity-metadata packet and flushes immediately.voidsendDisplayTranslation(Object platformPlayer, int entityId, float x, float y, float z) Sends one Display translation vector directly as entity metadata and flushes immediately.voidsendDisplayTranslationAndRotation(Object platformPlayer, int entityId, float translationX, float translationY, float translationZ, EntityMetadataField<NativeValue> rotation, float rotationX, float rotationY, float rotationZ, float rotationW) Sends Display translation and one quaternion rotation together in one entity-metadata packet and flushes immediately.voidsendDisplayTranslationAndScale(Object platformPlayer, int entityId, float translationX, float translationY, float translationZ, float scaleX, float scaleY, float scaleZ) Sends Display translation and scale together in one entity-metadata packet and flushes immediately.voidsendDisplayTranslationAndScaleAndRotation(Object platformPlayer, int entityId, float translationX, float translationY, float translationZ, float scaleX, float scaleY, float scaleZ, EntityMetadataField<NativeValue> rotation, float rotationX, float rotationY, float rotationZ, float rotationW) Sends Display translation, scale, and one quaternion rotation together in one entity-metadata packet and flushes immediately.voidsendEntityHeadRotation(Object platformPlayer, int entityId, float yaw) Sends one clientbound entity head rotation and flushes immediately.voidsendEntityRotation(Object platformPlayer, int entityId, float yaw, float pitch, boolean onGround) Sends one clientbound entity body rotation and flushes immediately.voidsendEntityTeleport(Object platformPlayer, int entityId, double x, double y, double z, float yaw, float pitch, boolean onGround) Encodes and sends one absolute clientbound entity teleport directly from primitives.voidwriteArmorStandPose(Object platformPlayer, int entityId, EntityMetadataField<MetadataRotation> pose, float x, float y, float z) Writes an ArmorStand pose without requesting an immediate flush.default voidwriteDisplayRotation(Object platformPlayer, int entityId, EntityMetadataField<NativeValue> rotation, float xDegrees, float yDegrees, float zDegrees) Converts XYZ Euler angles in degrees and writes without requesting an immediate flush.voidwriteDisplayRotation(Object platformPlayer, int entityId, EntityMetadataField<NativeValue> rotation, float x, float y, float z, float w) Writes a Display rotation without requesting an immediate flush.voidwriteDisplayScale(Object platformPlayer, int entityId, float x, float y, float z) Writes one Display scale vector without requesting an immediate flush.voidwriteDisplayScaleAndRotation(Object platformPlayer, int entityId, float scaleX, float scaleY, float scaleZ, EntityMetadataField<NativeValue> rotation, float rotationX, float rotationY, float rotationZ, float rotationW) Writes Display scale and one quaternion rotation together in one entity-metadata packet without requesting an immediate flush.voidwriteDisplayTranslation(Object platformPlayer, int entityId, float x, float y, float z) Writes one Display translation vector without requesting an immediate flush.voidwriteDisplayTranslationAndRotation(Object platformPlayer, int entityId, float translationX, float translationY, float translationZ, EntityMetadataField<NativeValue> rotation, float rotationX, float rotationY, float rotationZ, float rotationW) Writes Display translation and one quaternion rotation together in one entity-metadata packet without requesting an immediate flush.voidwriteDisplayTranslationAndScale(Object platformPlayer, int entityId, float translationX, float translationY, float translationZ, float scaleX, float scaleY, float scaleZ) Writes Display translation and scale together in one entity-metadata packet without requesting an immediate flush.voidwriteDisplayTranslationAndScaleAndRotation(Object platformPlayer, int entityId, float translationX, float translationY, float translationZ, float scaleX, float scaleY, float scaleZ, EntityMetadataField<NativeValue> rotation, float rotationX, float rotationY, float rotationZ, float rotationW) Writes Display translation, scale, and one quaternion rotation together in one entity-metadata packet without requesting an immediate flush.voidwriteEntityHeadRotation(Object platformPlayer, int entityId, float yaw) Writes one clientbound entity head rotation without requesting an immediate flush.voidwriteEntityRotation(Object platformPlayer, int entityId, float yaw, float pitch, boolean onGround) Writes one clientbound entity body rotation without requesting an immediate flush.voidwriteEntityTeleport(Object platformPlayer, int entityId, double x, double y, double z, float yaw, float pitch, boolean onGround) Writes one absolute clientbound entity teleport without requesting an immediate flush.
-
Method Details
-
batch
Runs connection-scoped primitive writes on one Netty event-loop task and flushes once.The player connection is resolved once before scheduling. The callback runs inline when already on that connection's event loop, or asynchronously through exactly one event-loop submission otherwise. It must use only captured thread-safe snapshots and must not access Bukkit entity, world, chunk, or inventory state.
The supplied writer is valid only during the callback and must not be retained. Pending writes are flushed when the callback finishes, including when it throws.
- Parameters:
platformPlayer- platform player that should receive the batchbatch- batch callback executed on the player's Netty event loop
-
sendEntityTeleport
void sendEntityTeleport(Object platformPlayer, int entityId, double x, double y, double z, float yaw, float pitch, boolean onGround) Encodes and sends one absolute clientbound entity teleport directly from primitives.This path bypasses native-object listeners and the vanilla packet encoder. Exact client-native paths also bypass protocol translation; other connections retain it. It requests a flush immediately after the write; use
writeEntityTeleport(Object, int, double, double, double, float, float, boolean)to batch multiple outbound writes before one flush.- Parameters:
platformPlayer- platform player owned by this serverentityId- client-visible entity IDx- absolute X positiony- absolute Y positionz- absolute Z positionyaw- entity yaw in degreespitch- entity pitch in degreesonGround- whether the entity is on the ground
-
writeEntityTeleport
void writeEntityTeleport(Object platformPlayer, int entityId, double x, double y, double z, float yaw, float pitch, boolean onGround) Writes one absolute clientbound entity teleport without requesting an immediate flush.The packet is still encoded and submitted to the player's Netty event loop, but pending outbound data is not explicitly pushed toward the socket by this call. This allows several packets to be written and then released together with
ConnectionHandle.flush(), reducing flush/syscall pressure at the cost of waiting until that flush occurs. Any other operation that flushes the same connection may also release the pending packet, so this method does not guarantee a transmission delay.For example, batch calls to this method and finish with
api.connection(platformPlayer).flush(). UsesendEntityTeleport(Object, int, double, double, double, float, float, boolean)when this packet should request an immediate flush.- Parameters:
platformPlayer- platform player owned by this serverentityId- client-visible entity IDx- absolute X positiony- absolute Y positionz- absolute Z positionyaw- entity yaw in degreespitch- entity pitch in degreesonGround- whether the entity is on the ground
-
sendEntityRotation
void sendEntityRotation(Object platformPlayer, int entityId, float yaw, float pitch, boolean onGround) Sends one clientbound entity body rotation and flushes immediately. -
writeEntityRotation
void writeEntityRotation(Object platformPlayer, int entityId, float yaw, float pitch, boolean onGround) Writes one clientbound entity body rotation without requesting an immediate flush. -
sendEntityHeadRotation
Sends one clientbound entity head rotation and flushes immediately. -
writeEntityHeadRotation
Writes one clientbound entity head rotation without requesting an immediate flush. -
sendArmorStandPose
void sendArmorStandPose(Object platformPlayer, int entityId, EntityMetadataField<MetadataRotation> pose, float x, float y, float z) Sends one ArmorStand body-part pose directly as entity metadata and flushes immediately.Accepted fields are
EntityMetadataFields.ArmorStand.HEAD_POSE,EntityMetadataFields.ArmorStand.BODY_POSE,EntityMetadataFields.ArmorStand.LEFT_ARM_POSE,EntityMetadataFields.ArmorStand.RIGHT_ARM_POSE,EntityMetadataFields.ArmorStand.LEFT_LEG_POSE, andEntityMetadataFields.ArmorStand.RIGHT_LEG_POSE.- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible ArmorStand entity IDpose- one of the six pose fields inEntityMetadataFields.ArmorStandx- X rotation in degreesy- Y rotation in degreesz- Z rotation in degrees
-
writeArmorStandPose
void writeArmorStandPose(Object platformPlayer, int entityId, EntityMetadataField<MetadataRotation> pose, float x, float y, float z) Writes an ArmorStand pose without requesting an immediate flush. Batching semantics are the same aswriteEntityTeleport(Object, int, double, double, double, float, float, boolean).- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible ArmorStand entity IDpose- one of the six pose fields documented by the flushing overloadx- X rotation in degreesy- Y rotation in degreesz- Z rotation in degrees
-
sendDisplayTranslation
Sends one Display translation vector directly as entity metadata and flushes immediately.This field belongs to the base Display entity and therefore works with item, block, and text displays.
- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible Display entity IDx- translation X componenty- translation Y componentz- translation Z component
-
writeDisplayTranslation
Writes one Display translation vector without requesting an immediate flush. Batching semantics are the same aswriteEntityTeleport(Object, int, double, double, double, float, float, boolean).- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible Display entity IDx- translation X componenty- translation Y componentz- translation Z component
-
sendDisplayScale
Sends one Display scale vector directly as entity metadata and flushes immediately.This field belongs to the base Display entity and therefore works with item, block, and text displays.
- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible Display entity IDx- scale X componenty- scale Y componentz- scale Z component
-
writeDisplayScale
Writes one Display scale vector without requesting an immediate flush. Batching semantics are the same aswriteEntityTeleport(Object, int, double, double, double, float, float, boolean).- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible Display entity IDx- scale X componenty- scale Y componentz- scale Z component
-
sendDisplayRotation
void sendDisplayRotation(Object platformPlayer, int entityId, EntityMetadataField<NativeValue> rotation, float x, float y, float z, float w) Sends one Display quaternion rotation directly as entity metadata and flushes immediately.The field may be
EntityMetadataFields.Display.LEFT_ROTATIONorEntityMetadataFields.Display.RIGHT_ROTATION. Both fields belong to the base Display entity and therefore work with item, block, and text displays.- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible Display entity IDrotation- left or right Display quaternion fieldx- quaternion X componenty- quaternion Y componentz- quaternion Z componentw- quaternion W component
-
sendDisplayRotation
default void sendDisplayRotation(Object platformPlayer, int entityId, EntityMetadataField<NativeValue> rotation, float xDegrees, float yDegrees, float zDegrees) Converts XYZ Euler angles in degrees directly to a quaternion and sends it.The conversion uses only scalar primitives and allocates no quaternion, vector, array, or wrapper. The four-component overload remains cheaper when a quaternion is already available because Euler conversion requires six trigonometric operations.
Gimbal-lock warning: XYZ Euler angles have singularities and can lose one rotational degree of freedom. Converting them to a quaternion does not undo that loss. For gimbal-lock-free animation, calculate or accumulate a quaternion directly and call the four-component overload.
- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible Display entity IDrotation- left or right Display quaternion fieldxDegrees- rotation around X in degreesyDegrees- rotation around Y in degreeszDegrees- rotation around Z in degrees
-
writeDisplayRotation
void writeDisplayRotation(Object platformPlayer, int entityId, EntityMetadataField<NativeValue> rotation, float x, float y, float z, float w) Writes a Display rotation without requesting an immediate flush. Batching semantics are the same aswriteEntityTeleport(Object, int, double, double, double, float, float, boolean).- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible Display entity IDrotation-EntityMetadataFields.Display.LEFT_ROTATIONorEntityMetadataFields.Display.RIGHT_ROTATIONx- quaternion X componenty- quaternion Y componentz- quaternion Z componentw- quaternion W component
-
sendDisplayTranslationAndScale
void sendDisplayTranslationAndScale(Object platformPlayer, int entityId, float translationX, float translationY, float translationZ, float scaleX, float scaleY, float scaleZ) Sends Display translation and scale together in one entity-metadata packet and flushes immediately.Both fields belong to the base Display entity and therefore work with item, block, and text displays. Combining them avoids a second packet, buffer, and metadata terminator.
- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible Display entity IDtranslationX- translation X componenttranslationY- translation Y componenttranslationZ- translation Z componentscaleX- scale X componentscaleY- scale Y componentscaleZ- scale Z component
-
writeDisplayTranslationAndScale
void writeDisplayTranslationAndScale(Object platformPlayer, int entityId, float translationX, float translationY, float translationZ, float scaleX, float scaleY, float scaleZ) Writes Display translation and scale together in one entity-metadata packet without requesting an immediate flush. Batching semantics are the same aswriteEntityTeleport(Object, int, double, double, double, float, float, boolean).- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible Display entity IDtranslationX- translation X componenttranslationY- translation Y componenttranslationZ- translation Z componentscaleX- scale X componentscaleY- scale Y componentscaleZ- scale Z component
-
sendDisplayTranslationAndRotation
void sendDisplayTranslationAndRotation(Object platformPlayer, int entityId, float translationX, float translationY, float translationZ, EntityMetadataField<NativeValue> rotation, float rotationX, float rotationY, float rotationZ, float rotationW) Sends Display translation and one quaternion rotation together in one entity-metadata packet and flushes immediately.The rotation field may be
EntityMetadataFields.Display.LEFT_ROTATIONorEntityMetadataFields.Display.RIGHT_ROTATION. Both fields belong to the base Display entity and therefore work with item, block, and text displays.- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible Display entity IDtranslationX- translation X componenttranslationY- translation Y componenttranslationZ- translation Z componentrotation- left or right Display quaternion fieldrotationX- quaternion X componentrotationY- quaternion Y componentrotationZ- quaternion Z componentrotationW- quaternion W component
-
writeDisplayTranslationAndRotation
void writeDisplayTranslationAndRotation(Object platformPlayer, int entityId, float translationX, float translationY, float translationZ, EntityMetadataField<NativeValue> rotation, float rotationX, float rotationY, float rotationZ, float rotationW) Writes Display translation and one quaternion rotation together in one entity-metadata packet without requesting an immediate flush. Batching semantics are the same aswriteEntityTeleport(Object, int, double, double, double, float, float, boolean).- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible Display entity IDtranslationX- translation X componenttranslationY- translation Y componenttranslationZ- translation Z componentrotation-EntityMetadataFields.Display.LEFT_ROTATIONorEntityMetadataFields.Display.RIGHT_ROTATIONrotationX- quaternion X componentrotationY- quaternion Y componentrotationZ- quaternion Z componentrotationW- quaternion W component
-
sendDisplayScaleAndRotation
void sendDisplayScaleAndRotation(Object platformPlayer, int entityId, float scaleX, float scaleY, float scaleZ, EntityMetadataField<NativeValue> rotation, float rotationX, float rotationY, float rotationZ, float rotationW) Sends Display scale and one quaternion rotation together in one entity-metadata packet and flushes immediately.The rotation field may be
EntityMetadataFields.Display.LEFT_ROTATIONorEntityMetadataFields.Display.RIGHT_ROTATION. Both fields belong to the base Display entity and therefore work with item, block, and text displays.- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible Display entity IDscaleX- scale X componentscaleY- scale Y componentscaleZ- scale Z componentrotation- left or right Display quaternion fieldrotationX- quaternion X componentrotationY- quaternion Y componentrotationZ- quaternion Z componentrotationW- quaternion W component
-
writeDisplayScaleAndRotation
void writeDisplayScaleAndRotation(Object platformPlayer, int entityId, float scaleX, float scaleY, float scaleZ, EntityMetadataField<NativeValue> rotation, float rotationX, float rotationY, float rotationZ, float rotationW) Writes Display scale and one quaternion rotation together in one entity-metadata packet without requesting an immediate flush. Batching semantics are the same aswriteEntityTeleport(Object, int, double, double, double, float, float, boolean).- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible Display entity IDscaleX- scale X componentscaleY- scale Y componentscaleZ- scale Z componentrotation-EntityMetadataFields.Display.LEFT_ROTATIONorEntityMetadataFields.Display.RIGHT_ROTATIONrotationX- quaternion X componentrotationY- quaternion Y componentrotationZ- quaternion Z componentrotationW- quaternion W component
-
sendDisplayTranslationAndScaleAndRotation
void sendDisplayTranslationAndScaleAndRotation(Object platformPlayer, int entityId, float translationX, float translationY, float translationZ, float scaleX, float scaleY, float scaleZ, EntityMetadataField<NativeValue> rotation, float rotationX, float rotationY, float rotationZ, float rotationW) Sends Display translation, scale, and one quaternion rotation together in one entity-metadata packet and flushes immediately.The rotation field may be
EntityMetadataFields.Display.LEFT_ROTATIONorEntityMetadataFields.Display.RIGHT_ROTATION. All three fields belong to the base Display entity and therefore work with item, block, and text displays. Combining them avoids two additional packets, buffers, and metadata terminators.- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible Display entity IDtranslationX- translation X componenttranslationY- translation Y componenttranslationZ- translation Z componentscaleX- scale X componentscaleY- scale Y componentscaleZ- scale Z componentrotation- left or right Display quaternion fieldrotationX- quaternion X componentrotationY- quaternion Y componentrotationZ- quaternion Z componentrotationW- quaternion W component
-
writeDisplayTranslationAndScaleAndRotation
void writeDisplayTranslationAndScaleAndRotation(Object platformPlayer, int entityId, float translationX, float translationY, float translationZ, float scaleX, float scaleY, float scaleZ, EntityMetadataField<NativeValue> rotation, float rotationX, float rotationY, float rotationZ, float rotationW) Writes Display translation, scale, and one quaternion rotation together in one entity-metadata packet without requesting an immediate flush. Batching semantics are the same aswriteEntityTeleport(Object, int, double, double, double, float, float, boolean).- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible Display entity IDtranslationX- translation X componenttranslationY- translation Y componenttranslationZ- translation Z componentscaleX- scale X componentscaleY- scale Y componentscaleZ- scale Z componentrotation-EntityMetadataFields.Display.LEFT_ROTATIONorEntityMetadataFields.Display.RIGHT_ROTATIONrotationX- quaternion X componentrotationY- quaternion Y componentrotationZ- quaternion Z componentrotationW- quaternion W component
-
writeDisplayRotation
default void writeDisplayRotation(Object platformPlayer, int entityId, EntityMetadataField<NativeValue> rotation, float xDegrees, float yDegrees, float zDegrees) Converts XYZ Euler angles in degrees and writes without requesting an immediate flush. This overload has the same gimbal-lock limitation documented by the flushing overload.- Parameters:
platformPlayer- platform player that should receive the updateentityId- client-visible Display entity IDrotation-EntityMetadataFields.Display.LEFT_ROTATIONorEntityMetadataFields.Display.RIGHT_ROTATIONxDegrees- rotation around X in degreesyDegrees- rotation around Y in degreeszDegrees- rotation around Z in degrees
-