Implement generator and type for packet IDs

This commit is contained in:
Tom
2020-09-12 13:38:45 -07:00
parent 0ec82d90a7
commit 358fb7b659
12 changed files with 406 additions and 187 deletions

View File

@ -1,156 +1,173 @@
package data
// Clientbound packet IDs
//go:generate bash -c "go run gen_packetIDs.go > packetIDs.go"
// This file is automatically generated by gen_packetIDs.go. DO NOT EDIT.
// PktID represents a packet ID used in the minecraft protocol.
type PktID int32
// Valid PktID values.
const (
SpawnObject int32 = iota //0x00
SpawnExperienceOrb
SpawnLivingEntity
SpawnPainting
SpawnPlayer
EntityAnimationClientbound
Statistics
AcknowledgePlayerDigging
BlockBreakAnimation
BlockEntityData
BlockAction
BlockChange
BossBar
ServerDifficulty
ChatMessageClientbound
TabComplete
// Clientbound packets for connections in the login state.
EncryptionBeginClientbound PktID = 0x01
Success PktID = 0x02
Compress PktID = 0x03
LoginPluginRequest PktID = 0x04
Disconnect PktID = 0x00
// Serverbound packets for connections in the login state.
EncryptionBeginServerbound PktID = 0x01
LoginPluginResponse PktID = 0x02
LoginStart PktID = 0x00
DeclareCommands //0x10
WindowConfirmationClientbound
CloseWindowClientbound
WindowItems
WindowProperty
SetSlot
SetCooldown
PluginMessageClientbound
NamedSoundEffect
DisconnectPlay
EntityStatus
Explosion
UnloadChunk
ChangeGameState
OpenHorseWindow
KeepAliveClientbound
// Clientbound packets for connections in the play state.
EntityMetadata PktID = 0x44
Teams PktID = 0x4c
BossBar PktID = 0x0c
Map PktID = 0x25
Difficulty PktID = 0x0d
Camera PktID = 0x3e
WindowItems PktID = 0x13
ScoreboardObjective PktID = 0x4a
RelEntityMove PktID = 0x27
DeclareCommands PktID = 0x10
CombatEvent PktID = 0x31
SpawnEntityPainting PktID = 0x03
EntityMoveLook PktID = 0x28
ScoreboardScore PktID = 0x4d
Title PktID = 0x4f
CraftProgressBar PktID = 0x14
NamedEntitySpawn PktID = 0x04
ScoreboardDisplayObjective PktID = 0x43
WorldParticles PktID = 0x22
OpenWindow PktID = 0x2d
MultiBlockChange PktID = 0x3b
EntitySoundEffect PktID = 0x50
Tags PktID = 0x5b
EntityUpdateAttributes PktID = 0x58
NamedSoundEffect PktID = 0x18
GameStateChange PktID = 0x1d
PlayerInfo PktID = 0x32
Advancements PktID = 0x57
Explosion PktID = 0x1b
KeepAliveClientbound PktID = 0x1f
MapChunk PktID = 0x20
AttachEntity PktID = 0x45
TradeList PktID = 0x26
Respawn PktID = 0x39
EntityDestroy PktID = 0x36
Experience PktID = 0x48
EntityLook PktID = 0x29
OpenBook PktID = 0x2c
WorldEvent PktID = 0x21
DeclareRecipes PktID = 0x5a
UnlockRecipes PktID = 0x35
EntityEquipment PktID = 0x47
EntityVelocity PktID = 0x46
Animation PktID = 0x05
UpdateViewDistance PktID = 0x41
HeldItemSlotClientbound PktID = 0x3f
NbtQueryResponse PktID = 0x54
Entity PktID = 0x2a
UpdateViewPosition PktID = 0x40
AbilitiesClientbound PktID = 0x30
OpenSignEntity PktID = 0x2e
SetSlot PktID = 0x15
PlayerlistHeader PktID = 0x53
ResourcePackSend PktID = 0x38
SpawnEntityExperienceOrb PktID = 0x01
Collect PktID = 0x55
Statistics PktID = 0x06
TileEntityData PktID = 0x09
ChatClientbound PktID = 0x0e
WorldBorder PktID = 0x3d
UnloadChunk PktID = 0x1c
UpdateLight PktID = 0x23
UpdateHealth PktID = 0x49
RemoveEntityEffect PktID = 0x37
KickDisconnect PktID = 0x19
CustomPayloadClientbound PktID = 0x17
SpawnPosition PktID = 0x42
EntityStatus PktID = 0x1a
SpawnEntity PktID = 0x00
SetPassengers PktID = 0x4b
FacePlayer PktID = 0x33
TransactionClientbound PktID = 0x11
BlockAction PktID = 0x0a
BlockBreakAnimation PktID = 0x08
BlockChange PktID = 0x0b
Login PktID = 0x24
VehicleMoveClientbound PktID = 0x2b
CraftRecipeResponse PktID = 0x2f
SetCooldown PktID = 0x16
StopSound PktID = 0x52
EntityEffect PktID = 0x59
CloseWindowClientbound PktID = 0x12
AcknowledgePlayerDigging PktID = 0x07
SelectAdvancementTab PktID = 0x3c
EntityHeadRotation PktID = 0x3a
TabCompleteClientbound PktID = 0x0f
PositionClientbound PktID = 0x34
OpenHorseWindow PktID = 0x1e
UpdateTime PktID = 0x4e
SpawnEntityLiving PktID = 0x02
EntityTeleport PktID = 0x56
SoundEffect PktID = 0x51
// Serverbound packets for connections in the play state.
SetBeaconEffect PktID = 0x24
UpdateStructureBlock PktID = 0x2a
EnchantItem PktID = 0x08
Spectate PktID = 0x2d
ArmAnimation PktID = 0x2c
QueryEntityNbt PktID = 0x0d
Flying PktID = 0x15
ResourcePackReceive PktID = 0x21
BlockDig PktID = 0x1b
AbilitiesServerbound PktID = 0x1a
SelectTrade PktID = 0x23
UpdateJigsawBlock PktID = 0x29
SteerVehicle PktID = 0x1d
Settings PktID = 0x05
SteerBoat PktID = 0x17
UseItem PktID = 0x2f
TeleportConfirm PktID = 0x00
PickItem PktID = 0x18
CraftRecipeRequest PktID = 0x19
Look PktID = 0x14
TabCompleteServerbound PktID = 0x06
AdvancementTab PktID = 0x22
ClientCommand PktID = 0x04
EntityAction PktID = 0x1c
PositionServerbound PktID = 0x12
TransactionServerbound PktID = 0x07
UpdateSign PktID = 0x2b
QueryBlockNbt PktID = 0x01
PositionLook PktID = 0x13
HeldItemSlotServerbound PktID = 0x25
EditBook PktID = 0x0c
UpdateCommandBlock PktID = 0x26
UseEntity PktID = 0x0e
GenerateStructure PktID = 0x0f
NameItem PktID = 0x20
RecipeBook PktID = 0x1f
KeepAliveServerbound PktID = 0x10
CustomPayloadServerbound PktID = 0x0b
VehicleMoveServerbound PktID = 0x16
CloseWindowServerbound PktID = 0x0a
UpdateCommandBlockMinecart PktID = 0x27
WindowClick PktID = 0x09
ChatServerbound PktID = 0x03
SetCreativeSlot PktID = 0x28
DisplayedRecipe PktID = 0x1e
BlockPlace PktID = 0x2e
LockDifficulty PktID = 0x11
SetDifficulty PktID = 0x02
ChunkData //0x20
Effect
Particle
UpdateLight
JoinGame
MapData
TradeList
EntityRelativeMove
EntityLookAndRelativeMove
EntityLook
Entity
VehicleMoveClientbound
OpenBook
OpenWindow
OpenSignEditor
CraftRecipeResponse
// Clientbound packets used to respond to ping/status requests.
ServerInfo PktID = 0x00
PingClientbound PktID = 0x01
// Serverbound packets used to ping or read server status.
PingStart PktID = 0x00
PingServerbound PktID = 0x01
PlayerAbilitiesClientbound //0x30
CombatEvent
PlayerInfo
FacePlayer
PlayerPositionAndLookClientbound
UnlockRecipes
DestroyEntities
RemoveEntityEffect
ResourcePackSend
Respawn
EntityHeadLook
MultiBlockChange
SelectAdvancementTab
WorldBorder
Camera
HeldItemChangeClientbound
UpdateViewPosition //0x40
UpdateViewDistance
SpawnPosition
DisplayScoreboard
EntityMetadata
AttachEntity
EntityVelocity
EntityEquipment
SetExperience
UpdateHealth
ScoreboardObjective
SetPassengers
Teams
UpdateScore
TimeUpdate
Title
EntitySoundEffect //0x50
SoundEffect
StopSound
PlayerListHeaderAndFooter
NBTQueryResponse
CollectItem
EntityTeleport
Advancements
EntityProperties
EntityEffect
DeclareRecipes
Tags //0x5B
)
// Serverbound packet IDs
const (
TeleportConfirm int32 = iota //0x00
QueryBlockNBT
SetDifficulty
ChatMessageServerbound
ClientStatus
ClientSettings
TabCompleteServerbound
ConfirmTransactionServerbound
ClickWindowButton
ClickWindow
CloseWindowServerbound
PluginMessageServerbound
EditBook
QueryEntityNBT
UseEntity
GenerateStructure
KeepAliveServerbound //0x10
LockDifficulty
PlayerPosition
PlayerPositionAndLookServerbound
PlayerLook
Player
VehicleMoveServerbound
SteerBoat
PickItem
CraftRecipeRequest
PlayerAbilitiesServerbound
PlayerDigging
EntityAction
SteerVehicle
DisplayedRecipe
RecipeBookData
NameItem //0x20
ResourcePackStatus
AdvancementTab
SelectTrade
SetBeaconEffect
HeldItemChangeServerbound
UpdateCommandBlock
UpdateCommandBlockMinecart
CreativeInventoryAction
UpdateJigsawBlock
UpdateStructureBlock
UpdateSign
AnimationServerbound
Spectate
PlayerBlockPlacement
UseItem //0x2F
)