๐ Packet API
The following objects and APIs provide the basic BDS packet interface for scripts.
(Please refer to Nukkit, PokcetMine, BDS Reverse to know the packet structure) If the client crashes, it is a packet structure error, not a bug.
The documentation does not list the packet ID and its structure, please check it yourself.
็ฎๅฝ
- ๐ Packet Object API
- ๐ Binary stream object API
๐ Packet Object API
In LLSE, ใPacket Objectใ is used to get information about packets.
Get a packet object
Get from API
Call some return packet object function to get to the packet object given by BDS
See Binary Stream Objects for details
Packet Objects - Functions
Every packet object contains some member functions (member methods) that can be executed. For a particular entity object pkt
, some operations can be performed on this packet by these functions
Get packet name
pkt.getName()
- Return value๏ผpacket name
- Return value type๏ผ
String
Get packet ID
pkt.getId()
- Return value๏ผpacket id
- Return value type๏ผ
Integer
๐ Binary Stream Object API
Create a binary stream object
[JavaScript] new BinaryStream()
[Lua] BinaryStream()
- Return value: Binary stream object
- Return value type๏ผ
BinaryStream
Binary Stream Object - Functions
Every binary stream object contains some member functions (member methods) that can be executed. For a particular entity object bs
, some operations can be performed on this binary stream by these functions
Resetting binary streams
bs.reset()
- Return value: success or not
- Return value type๏ผ
Boolean
Write to binary stream
bs.writexxxx(value)
- Parameters๏ผ
-
value :
NULL
Refer to the table below -
Return value๏ผsuccess or not
- Return value type๏ผ
Boolean
Available functions | Parameter Type |
---|---|
writeBool | Boolean |
writeByte | Integer |
writeDouble | Number |
writeFloat | Float |
writeSignedBigEndianInt | Number |
writeSignedInt | Number |
writeSignedInt64 | Number |
writeSignedShort | Integer |
writeString | String |
writeUnsignedChar | Integer |
writeUnsignedInt | Number |
writeUnsignedInt64 | Number |
writeUnsignedShort | Integer |
writeUnsignedVarInt | Number |
writeUnsignedVarInt64 | Number |
writeVarInt | Number |
writeVarInt64 | Number |
writeVec3 | FloatPos |
writeCompoundTag | NbtCompound |
Building packet from binary stream
bs.createPacket(pktid)
- Parameters๏ผ
-
pktid :
Integer
Packet ID -
Return value๏ผPacket object
- Return value type๏ผ
Packet
Dome Code
Send TextPacket packets to a player
JavaScript | |
---|---|
1 2 3 4 5 6 7 8 9 10 11 12 |
|