Documentation

PacketSerializer extends BinaryStream
in package

Table of Contents

$buffer  : string
$offset  : int
$context  : PacketSerializerContext
$shieldItemRuntimeId  : int
decoder()  : self
encoder()  : self
feof()  : bool
Returns whether the offset has reached the end of the buffer.
get()  : string
getActorRuntimeId()  : int
getActorUniqueId()  : int
getAttributeList()  : array<string|int, Attribute>
Reads a list of Attributes from the stream.
getBlockPosition()  : BlockPosition
Reads a block position with unsigned Y coordinate.
getBool()  : bool
getBuffer()  : string
getByte()  : int
getCommandOriginData()  : CommandOriginData
getDouble()  : float
getEntityLink()  : EntityLink
getEntityMetadata()  : array<string|int, MetadataProperty>
Decodes entity metadata from the stream.
getFloat()  : float
getGameRules()  : array<string|int, GameRule>
Reads gamerules
getInt()  : int
getItemStack()  : ItemStack
getItemStackWithoutStackId()  : ItemStack
getLDouble()  : float
getLFloat()  : float
getLInt()  : int
getLLong()  : int
getLong()  : int
getLShort()  : int
getLTriad()  : int
getNbtCompoundRoot()  : CompoundTag
getNbtRoot()  : TreeRoot
getOffset()  : int
getRecipeIngredient()  : RecipeIngredient
getRemaining()  : string
getRotationByte()  : float
getRoundedFloat()  : float
getRoundedLFloat()  : float
getShort()  : int
getSignedBlockPosition()  : BlockPosition
Reads a block position with a signed Y coordinate.
getSignedLShort()  : int
getSignedShort()  : int
getSkin()  : SkinData
getString()  : string
getStructureEditorData()  : StructureEditorData
getStructureSettings()  : StructureSettings
getTriad()  : int
getUnsignedVarInt()  : int
Reads a 32-bit variable-length unsigned integer from the buffer and returns it.
getUnsignedVarLong()  : int
Reads a 64-bit variable-length integer from the buffer and returns it.
getUUID()  : UuidInterface
getVarInt()  : int
Reads a 32-bit zigzag-encoded variable-length integer from the buffer and returns it.
getVarLong()  : int
Reads a 64-bit zigzag-encoded variable-length integer from the buffer and returns it.
getVector3()  : Vector3
Reads a floating-point Vector3 object with coordinates rounded to 4 decimal places.
put()  : void
putActorRuntimeId()  : void
putActorUniqueId()  : void
putAttributeList()  : void
Writes a list of Attributes to the packet buffer using the standard format.
putBlockPosition()  : void
Writes a block position with unsigned Y coordinate.
putBool()  : void
putByte()  : void
putCommandOriginData()  : void
putDouble()  : void
putEntityLink()  : void
putEntityMetadata()  : void
Writes entity metadata to the packet buffer.
putFloat()  : void
putGameRules()  : void
Writes a gamerule array
putInt()  : void
putItemStack()  : void
putItemStackWithoutStackId()  : void
putLDouble()  : void
putLFloat()  : void
putLInt()  : void
putLLong()  : void
putLong()  : void
putLShort()  : void
putLTriad()  : void
putRecipeIngredient()  : void
putRotationByte()  : void
putShort()  : void
putSignedBlockPosition()  : void
Writes a block position with a signed Y coordinate.
putSkin()  : void
putString()  : void
putStructureEditorData()  : void
putStructureSettings()  : void
putTriad()  : void
putUnsignedVarInt()  : void
Writes a 32-bit variable-length unsigned integer to the end of the buffer.
putUnsignedVarLong()  : void
Writes a 64-bit variable-length integer to the end of the buffer.
putUUID()  : void
putVarInt()  : void
Writes a 32-bit zigzag-encoded variable-length integer to the end of the buffer.
putVarLong()  : void
Writes a 64-bit zigzag-encoded variable-length integer to the end of the buffer.
putVector3()  : void
Writes a floating-point Vector3 object
putVector3Nullable()  : void
Writes a floating-point Vector3 object, or 3x zero if null is given.
readGenericTypeNetworkId()  : int
rewind()  : void
Rewinds the stream pointer to the start.
setOffset()  : void
writeGenericTypeNetworkId()  : void
__construct()  : mixed
getSkinImage()  : SkinImage
putSkinImage()  : void
readGameRule()  : GameRule
readMetadataProperty()  : MetadataProperty

Properties

Methods

feof()

Returns whether the offset has reached the end of the buffer.

public feof() : bool
Return values
bool

get()

public get(int $len) : string
Parameters
$len : int
Tags
phpstan-impure
throws
BinaryDataException

if there are not enough bytes left in the buffer

Return values
string

getBuffer()

public getBuffer() : string
Return values
string

getOffset()

public getOffset() : int
Return values
int

getRoundedFloat()

public getRoundedFloat(int $accuracy) : float
Parameters
$accuracy : int
Tags
phpstan-impure
throws
BinaryDataException
Return values
float

getRoundedLFloat()

public getRoundedLFloat(int $accuracy) : float
Parameters
$accuracy : int
Tags
phpstan-impure
throws
BinaryDataException
Return values
float

getUnsignedVarInt()

Reads a 32-bit variable-length unsigned integer from the buffer and returns it.

public getUnsignedVarInt() : int
Tags
phpstan-impure
throws
BinaryDataException
Return values
int

getUnsignedVarLong()

Reads a 64-bit variable-length integer from the buffer and returns it.

public getUnsignedVarLong() : int
Tags
phpstan-impure
throws
BinaryDataException
Return values
int

getVarInt()

Reads a 32-bit zigzag-encoded variable-length integer from the buffer and returns it.

public getVarInt() : int
Tags
phpstan-impure
throws
BinaryDataException
Return values
int

getVarLong()

Reads a 64-bit zigzag-encoded variable-length integer from the buffer and returns it.

public getVarLong() : int
Tags
phpstan-impure
throws
BinaryDataException
Return values
int

put()

public put(string $str) : void
Parameters
$str : string
Return values
void

putActorRuntimeId()

public putActorRuntimeId(int $eid) : void
Parameters
$eid : int
Return values
void

putActorUniqueId()

public putActorUniqueId(int $eid) : void
Parameters
$eid : int
Return values
void

putAttributeList()

Writes a list of Attributes to the packet buffer using the standard format.

public putAttributeList(Attribute ...$attributes) : void
Parameters
$attributes : Attribute
Return values
void

putBool()

public putBool(bool $v) : void
Parameters
$v : bool
Return values
void

putByte()

public putByte(int $v) : void
Parameters
$v : int
Return values
void

putDouble()

public putDouble(float $v) : void
Parameters
$v : float
Return values
void

putEntityMetadata()

Writes entity metadata to the packet buffer.

public putEntityMetadata(array<string|int, MetadataProperty$metadata) : void
Parameters
$metadata : array<string|int, MetadataProperty>
Tags
phpstan-param

array<int, MetadataProperty> $metadata

Return values
void

putFloat()

public putFloat(float $v) : void
Parameters
$v : float
Return values
void

putGameRules()

Writes a gamerule array

public putGameRules(array<string|int, GameRule$rules) : void
Parameters
$rules : array<string|int, GameRule>
Tags
phpstan-param

array<string, GameRule> $rules

Return values
void

putInt()

public putInt(int $v) : void
Parameters
$v : int
Return values
void

putItemStack()

public putItemStack(ItemStack $item, Closure $writeExtraCrapInTheMiddle) : void
Parameters
$item : ItemStack
$writeExtraCrapInTheMiddle : Closure
Tags
phpstan-param

\Closure(PacketSerializer) : void $writeExtraCrapInTheMiddle

Return values
void

putLDouble()

public putLDouble(float $v) : void
Parameters
$v : float
Return values
void

putLFloat()

public putLFloat(float $v) : void
Parameters
$v : float
Return values
void

putLInt()

public putLInt(int $v) : void
Parameters
$v : int
Return values
void

putLLong()

public putLLong(int $v) : void
Parameters
$v : int
Return values
void

putLong()

public putLong(int $v) : void
Parameters
$v : int
Return values
void

putLShort()

public putLShort(int $v) : void
Parameters
$v : int
Return values
void

putLTriad()

public putLTriad(int $v) : void
Parameters
$v : int
Return values
void

putRotationByte()

public putRotationByte(float $rotation) : void
Parameters
$rotation : float
Return values
void

putShort()

public putShort(int $v) : void
Parameters
$v : int
Return values
void

putSignedBlockPosition()

Writes a block position with a signed Y coordinate.

public putSignedBlockPosition(BlockPosition $blockPosition) : void
Parameters
$blockPosition : BlockPosition
Return values
void

putString()

public putString(string $v) : void
Parameters
$v : string
Return values
void

putTriad()

public putTriad(int $v) : void
Parameters
$v : int
Return values
void

putUnsignedVarInt()

Writes a 32-bit variable-length unsigned integer to the end of the buffer.

public putUnsignedVarInt(int $v) : void
Parameters
$v : int
Return values
void

putUnsignedVarLong()

Writes a 64-bit variable-length integer to the end of the buffer.

public putUnsignedVarLong(int $v) : void
Parameters
$v : int
Return values
void

putVarInt()

Writes a 32-bit zigzag-encoded variable-length integer to the end of the buffer.

public putVarInt(int $v) : void
Parameters
$v : int
Return values
void

putVarLong()

Writes a 64-bit zigzag-encoded variable-length integer to the end of the buffer.

public putVarLong(int $v) : void
Parameters
$v : int
Return values
void

putVector3()

Writes a floating-point Vector3 object

public putVector3(Vector3 $vector) : void
Parameters
$vector : Vector3
Return values
void

putVector3Nullable()

Writes a floating-point Vector3 object, or 3x zero if null is given.

public putVector3Nullable(Vector3|null $vector) : void

Note: ONLY use this where it is reasonable to allow not specifying the vector. For all other purposes, use the non-nullable version.

Parameters
$vector : Vector3|null
Tags
see
PacketSerializer::putVector3()
Return values
void

readGenericTypeNetworkId()

public readGenericTypeNetworkId() : int
Return values
int

rewind()

Rewinds the stream pointer to the start.

public rewind() : void
Return values
void

setOffset()

public setOffset(int $offset) : void
Parameters
$offset : int
Return values
void

writeGenericTypeNetworkId()

public writeGenericTypeNetworkId(int $id) : void
Parameters
$id : int
Return values
void

readGameRule()

private readGameRule(int $type, bool $isPlayerModifiable) : GameRule
Parameters
$type : int
$isPlayerModifiable : bool
Return values
GameRule

Search results