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
$buffer
protected
string
$buffer
$offset
protected
int
$offset
$context
private
PacketSerializerContext
$context
$shieldItemRuntimeId
private
int
$shieldItemRuntimeId
Methods
decoder()
public
static decoder(string $buffer, int $offset, PacketSerializerContext $context) : self
Parameters
- $buffer : string
- $offset : int
- $context : PacketSerializerContext
Return values
self —encoder()
public
static encoder(PacketSerializerContext $context) : self
Parameters
- $context : PacketSerializerContext
Return values
self —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
Return values
string —getActorRuntimeId()
public
final getActorRuntimeId() : int
Tags
Return values
int —getActorUniqueId()
public
final getActorUniqueId() : int
Tags
Return values
int —getAttributeList()
Reads a list of Attributes from the stream.
public
getAttributeList() : array<string|int, Attribute>
Tags
Return values
array<string|int, Attribute> —getBlockPosition()
Reads a block position with unsigned Y coordinate.
public
getBlockPosition() : BlockPosition
Tags
Return values
BlockPosition —getBool()
public
getBool() : bool
Tags
Return values
bool —getBuffer()
public
getBuffer() : string
Return values
string —getByte()
public
getByte() : int
Tags
Return values
int —getCommandOriginData()
public
getCommandOriginData() : CommandOriginData
Tags
Return values
CommandOriginData —getDouble()
public
getDouble() : float
Tags
Return values
float —getEntityLink()
public
getEntityLink() : EntityLink
Tags
Return values
EntityLink —getEntityMetadata()
Decodes entity metadata from the stream.
public
getEntityMetadata() : array<string|int, MetadataProperty>
Tags
Return values
array<string|int, MetadataProperty> —getFloat()
public
getFloat() : float
Tags
Return values
float —getGameRules()
Reads gamerules
public
getGameRules() : array<string|int, GameRule>
Tags
Return values
array<string|int, GameRule> —game rule name => value
getInt()
public
getInt() : int
Tags
Return values
int —getItemStack()
public
getItemStack(Closure $readExtraCrapInTheMiddle) : ItemStack
Parameters
- $readExtraCrapInTheMiddle : Closure
Tags
Return values
ItemStack —getItemStackWithoutStackId()
public
getItemStackWithoutStackId() : ItemStack
Tags
Return values
ItemStack —getLDouble()
public
getLDouble() : float
Tags
Return values
float —getLFloat()
public
getLFloat() : float
Tags
Return values
float —getLInt()
public
getLInt() : int
Tags
Return values
int —getLLong()
public
getLLong() : int
Tags
Return values
int —getLong()
public
getLong() : int
Tags
Return values
int —getLShort()
public
getLShort() : int
Tags
Return values
int —getLTriad()
public
getLTriad() : int
Tags
Return values
int —getNbtCompoundRoot()
public
getNbtCompoundRoot() : CompoundTag
Return values
CompoundTag —getNbtRoot()
public
getNbtRoot() : TreeRoot
Return values
TreeRoot —getOffset()
public
getOffset() : int
Return values
int —getRecipeIngredient()
public
getRecipeIngredient() : RecipeIngredient
Return values
RecipeIngredient —getRemaining()
public
getRemaining() : string
Tags
Return values
string —getRotationByte()
public
getRotationByte() : float
Tags
Return values
float —getRoundedFloat()
public
getRoundedFloat(int $accuracy) : float
Parameters
- $accuracy : int
Tags
Return values
float —getRoundedLFloat()
public
getRoundedLFloat(int $accuracy) : float
Parameters
- $accuracy : int
Tags
Return values
float —getShort()
public
getShort() : int
Tags
Return values
int —getSignedBlockPosition()
Reads a block position with a signed Y coordinate.
public
getSignedBlockPosition() : BlockPosition
Tags
Return values
BlockPosition —getSignedLShort()
public
getSignedLShort() : int
Tags
Return values
int —getSignedShort()
public
getSignedShort() : int
Tags
Return values
int —getSkin()
public
getSkin() : SkinData
Return values
SkinData —getString()
public
getString() : string
Tags
Return values
string —getStructureEditorData()
public
getStructureEditorData() : StructureEditorData
Return values
StructureEditorData —getStructureSettings()
public
getStructureSettings() : StructureSettings
Return values
StructureSettings —getTriad()
public
getTriad() : int
Tags
Return values
int —getUnsignedVarInt()
Reads a 32-bit variable-length unsigned integer from the buffer and returns it.
public
getUnsignedVarInt() : int
Tags
Return values
int —getUnsignedVarLong()
Reads a 64-bit variable-length integer from the buffer and returns it.
public
getUnsignedVarLong() : int
Tags
Return values
int —getUUID()
public
getUUID() : UuidInterface
Tags
Return values
UuidInterface —getVarInt()
Reads a 32-bit zigzag-encoded variable-length integer from the buffer and returns it.
public
getVarInt() : int
Tags
Return values
int —getVarLong()
Reads a 64-bit zigzag-encoded variable-length integer from the buffer and returns it.
public
getVarLong() : int
Tags
Return values
int —getVector3()
Reads a floating-point Vector3 object with coordinates rounded to 4 decimal places.
public
getVector3() : Vector3
Tags
Return values
Vector3 —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 —putBlockPosition()
Writes a block position with unsigned Y coordinate.
public
putBlockPosition(BlockPosition $blockPosition) : void
Parameters
- $blockPosition : BlockPosition
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 —putCommandOriginData()
public
putCommandOriginData(CommandOriginData $data) : void
Parameters
- $data : CommandOriginData
Return values
void —putDouble()
public
putDouble(float $v) : void
Parameters
- $v : float
Return values
void —putEntityLink()
public
putEntityLink(EntityLink $link) : void
Parameters
- $link : EntityLink
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
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
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
Return values
void —putItemStackWithoutStackId()
public
putItemStackWithoutStackId(ItemStack $item) : void
Parameters
- $item : ItemStack
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 —putRecipeIngredient()
public
putRecipeIngredient(RecipeIngredient $ingredient) : void
Parameters
- $ingredient : RecipeIngredient
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 —putSkin()
public
putSkin(SkinData $skin) : void
Parameters
- $skin : SkinData
Return values
void —putString()
public
putString(string $v) : void
Parameters
- $v : string
Return values
void —putStructureEditorData()
public
putStructureEditorData(StructureEditorData $structureEditorData) : void
Parameters
- $structureEditorData : StructureEditorData
Return values
void —putStructureSettings()
public
putStructureSettings(StructureSettings $structureSettings) : void
Parameters
- $structureSettings : StructureSettings
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 —putUUID()
public
putUUID(UuidInterface $uuid) : void
Parameters
- $uuid : UuidInterface
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
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 —__construct()
protected
__construct(PacketSerializerContext $context[, string $buffer = "" ][, int $offset = 0 ]) : mixed
Parameters
- $context : PacketSerializerContext
- $buffer : string = ""
- $offset : int = 0
Return values
mixed —getSkinImage()
private
getSkinImage() : SkinImage
Return values
SkinImage —putSkinImage()
private
putSkinImage(SkinImage $image) : void
Parameters
- $image : SkinImage
Return values
void —readGameRule()
private
readGameRule(int $type, bool $isPlayerModifiable) : GameRule
Parameters
- $type : int
- $isPlayerModifiable : bool
Return values
GameRule —readMetadataProperty()
private
readMetadataProperty(int $type) : MetadataProperty
Parameters
- $type : int