API reference / @jsprismarine/protocol / CameraInstruction
Class: CameraInstruction
Defined in: protocol/src/structure/CameraInstruction.ts:217
The instruction set CameraInstructionPacket carries: up to nine parts the client applies in order.
Protocol 2193 wire order, each part a presence byte then its value: Set (preset uint32 LE, then the optional ease as a uint8 type and a float LE time, pos Vec3, rot Vec2, facing Vec3, view_offset Vec2, entity_offset Vec3 and default boolean, then removeIgnoreStartingValuesComponent as a plain boolean); Clear boolean; Fade (optional Time as three float LE, optional Color as three float LE); Target (optional Target Center Offset Vec3, then Target Actor ID int64 LE); RemoveTarget boolean; FieldOfView (Field of View and FOV Ease Time float LE, FOV Ease Type string, Field of View Clear boolean); Spline (totalTime float LE, type uint8, curve as a varuint32 count of Vec3, progressKeyFrames and rotationOption as varuint32 counts of entries, optional splineIdentifier string, optional loadFromJson boolean); AttachToEntity int64 LE; DetachFromEntity boolean.
The 1.26.51 schema lists the nine parts as required, but the client reads a presence byte before each (gophertunnel and PocketMine agree), and the 1.26.60 preview schema marks them optional. https://mojang.github.io/bedrock-protocol-docs/1.26.51/types/camera-instruction/
Extends
Constructors
Constructor
new CameraInstruction(
data?):CameraInstruction
Defined in: protocol/src/structure/CameraInstruction.ts:223
Creates an instruction. The default has no part, so the static deserialize can construct an instance before reading the stream.
Parameters
data?
The parts to send.
Returns
CameraInstruction
Overrides
Properties
data
data:
CameraInstructionData={}
Defined in: protocol/src/structure/CameraInstruction.ts:223
The parts to send.
Methods
deserialize()
deserialize(
stream):void
Defined in: protocol/src/structure/CameraInstruction.ts:382
Reads the nine parts in wire order. An absent part is left undefined.
Parameters
stream
Returns
void
Throws
Error when an easing_function string is not one of the docs' names.
Overrides
serialize()
serialize(
stream):void
Defined in: protocol/src/structure/CameraInstruction.ts:357
Writes the nine parts in wire order, a presence byte before each.
Parameters
stream
Returns
void
Overrides
deserialize()
staticdeserialize<T>(this,stream):T
Defined in: protocol/src/NetworkStructure.ts:28
Deserializes the network structure from a binary stream. The constructor runs with no arguments before the stream is read, so the class must tolerate that.
Type Parameters
T
T extends NetworkStructure
Parameters
this
Constructor<T>
stream
The binary stream to deserialize from.
Returns
T
An instance of the class T.