- Contributors
- TPGamesNL
- Supported Skript Version
- 2.6
- Supported Minecraft Versions
- 1.8
- 1.9
- 1.10
- 1.11
- 1.12
- 1.13
- 1.14
- 1.15
- 1.16
- 1.17
- 1.18
- 1.19
- 1.20
Dependencies: skript-reflect
AT THE MOMENT SAMPLE-PACKETS DOESN'T WORK WITH NEW SKRIPT-REFLECT DUE TO CUSTOM EVENTS ARE BROKEN USE SKCREW INSTEAD
Firstly, it is a remake of PacketListenerNMSK by TPGamesNL which works on versions 1.8 to 1.20.4.
What does this script include:
- In, out packet listener
- Auto splitter for BundlePacket (in 1.19.4+)
- auto-detection available packets
- auto-detection of packet constructors
- auto-detection of packet decoders
- stuff to create packets and decrypt them
- method to send packets to players
- auto apply dataWatchers in 1.8
API syntax:
event: packet event
fired when packet received or sended
effect: send packet
sends packets to specified players
function: create empty buffer
returns an empty buffer to create the packet
functions: write data to the buffer
write specific type to buffer
functions: read data from the buffer
read specified type from buffer and return it
function: create packet
creates and returns packet by simplied class name with data from the buffer, buffer data defined at WIKI.VG
function: get packet name by protocol
returns packet simplied name by its STATE, BOUND and ID, defined at WIKI.VG
function: decode packet
returns buffer of received or sended packet (created packet)
expression: player's skin signature and value
returns string what contains signature or value. Can be used in player spawn packet or creating custom heads
Also its include some ready to use packets what has less differences on different versions, such as:
- PacketPlayOutEntityDestroy
- PacketPlayOutCamera
- PacketPlayOutEntityTeleport
- PacketPlayOutOpenSignEditor
- PacketPlayOutPosition
- PacketPlayOutUpdateHealth
- PacketPlayOutBlockBreakAnimation
- PacketPlayOutAnimation
- PacketPlayOutEntityHeadRotation
- PacketPlayOutEntityLook
The list will be updated in future updates.
How to create packet if not included?
1. Go to this site and select your core version
2. Find the required packet, find its id (in decimal), state and bound.
3. Get wrapped packet name with function getWrappedPacketNameByProtocol(...)
4. Create EmptyBuffer and fill it with data
5. Create packet with function CreatePacket(...)
Example, I need this packet:
I converted id to decimal, I know which State and Bound. Now I can get the packet name with function - it's PacketPlayOutCamera.
I populated a buffer based on information from the site, created a packet, and wrapped it all in a function to call it in the future. Now putting the number of the entity into the function - I can create a packet and send it to any player.
AT THE MOMENT SAMPLE-PACKETS DOESN'T WORK WITH NEW SKRIPT-REFLECT DUE TO CUSTOM EVENTS ARE BROKEN USE SKCREW INSTEAD
Firstly, it is a remake of PacketListenerNMSK by TPGamesNL which works on versions 1.8 to 1.20.4.
What does this script include:
- In, out packet listener
- Auto splitter for BundlePacket (in 1.19.4+)
- auto-detection available packets
- auto-detection of packet constructors
- auto-detection of packet decoders
- stuff to create packets and decrypt them
- method to send packets to players
- auto apply dataWatchers in 1.8
API syntax:
event: packet event
fired when packet received or sended
Code:
on packet [%packet name%]:
#what packet sended\received
[event-]packet
#can be setted to new packet for overwrite
#set event-packet to %new packet%
#can be cancelled and not sended
#cancel event
#who sended\to whom it was sent
[event-]player
effect: send packet
sends packets to specified players
Code:
send packet %packets% to %players%
function: create empty buffer
returns an empty buffer to create the packet
Code:
EmptyBuffer()
functions: write data to the buffer
write specific type to buffer
Code:
writeBytes(%buffer to%, %buffer from%)
writeBoolean(%boolean%, %buffer%)
writeByte(%number%, %buffer%)
writeShort(%number%, %buffer%)
writeFloat(%number%, %buffer%)
writeDouble(%number%, %buffer%)
writeInt(%number%, %buffer%)
writeLong(%number%, %buffer%)
writePosition(%x number%,%y number%,%z number%,%buffer%)
writeVarInt(%number%, %buffer%)
writeVarLong(%number%, %buffer%)
writeString(%text%, %buffer%)
writeUUID(%uuid object or string%, %buffer%)
writeAngle(%number%, %buffer%)
functions: read data from the buffer
read specified type from buffer and return it
Code:
readBoolean(%buffer%) :: boolean
readByte(%buffer%) :: number
readShort(%buffer%) :: number
readFloat(%buffer%) :: number
readDouble(%buffer%) :: number
readInt(%buffer%) :: number
readLong(%buffer%) :: number
readPosition(%buffer%) :: numbers list of 3
readVarInt(%buffer%) :: number
readVarLong(%buffer%) :: number
readString(%buffer%) :: text
readUUID(%buffer%) :: uuid_object
readAngle(%buffer%) :: number
function: create packet
creates and returns packet by simplied class name with data from the buffer, buffer data defined at WIKI.VG
Code:
createPacket(%packet name%,%buffer%) :: %packet%
function: get packet name by protocol
returns packet simplied name by its STATE, BOUND and ID, defined at WIKI.VG
Code:
getWrappedPacketNameByProtocol(%number id%,%text state%,%text bound%) :: text:
function: decode packet
returns buffer of received or sended packet (created packet)
Code:
decodePacket(%packet%) :: buffer:
expression: player's skin signature and value
returns string what contains signature or value. Can be used in player spawn packet or creating custom heads
Code:
%player%'s skin (signature|value)
skin (signature|value) of %player%
Also its include some ready to use packets what has less differences on different versions, such as:
- PacketPlayOutEntityDestroy
- PacketPlayOutCamera
- PacketPlayOutEntityTeleport
- PacketPlayOutOpenSignEditor
- PacketPlayOutPosition
- PacketPlayOutUpdateHealth
- PacketPlayOutBlockBreakAnimation
- PacketPlayOutAnimation
- PacketPlayOutEntityHeadRotation
- PacketPlayOutEntityLook
The list will be updated in future updates.
How to create packet if not included?
1. Go to this site and select your core version
2. Find the required packet, find its id (in decimal), state and bound.
3. Get wrapped packet name with function getWrappedPacketNameByProtocol(...)
4. Create EmptyBuffer and fill it with data
5. Create packet with function CreatePacket(...)
Example, I need this packet:
Code:
function PacketPlayOutCamera(id: number) :: object:
set {_buffer} to EmptyBuffer()
writeVarInt({_id},{_buffer})
return createPacket("PacketPlayOutCamera",{_buffer})
I populated a buffer based on information from the site, created a packet, and wrapped it all in a function to call it in the future. Now putting the number of the entity into the function - I can create a packet and send it to any player.