From 1b33f00de7089519c9adbede276be3b36a046221 Mon Sep 17 00:00:00 2001 From: TwistedAsylumMC Date: Tue, 9 Jul 2024 20:43:50 +0100 Subject: [PATCH] minecraft/protocol: Support 1.21.2 --- minecraft/protocol/info.go | 4 ++-- .../protocol/packet/client_bound_close_form.go | 16 ++++++++++++++++ minecraft/protocol/packet/id.go | 1 + minecraft/protocol/packet/pool.go | 1 + 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 minecraft/protocol/packet/client_bound_close_form.go diff --git a/minecraft/protocol/info.go b/minecraft/protocol/info.go index 522f99ab..932d16c6 100644 --- a/minecraft/protocol/info.go +++ b/minecraft/protocol/info.go @@ -2,7 +2,7 @@ package protocol const ( // CurrentProtocol is the current protocol version for the version below. - CurrentProtocol = 685 + CurrentProtocol = 686 // CurrentVersion is the current version of Minecraft as supported by the `packet` package. - CurrentVersion = "1.21.0" + CurrentVersion = "1.21.2" ) diff --git a/minecraft/protocol/packet/client_bound_close_form.go b/minecraft/protocol/packet/client_bound_close_form.go new file mode 100644 index 00000000..eb3e6a90 --- /dev/null +++ b/minecraft/protocol/packet/client_bound_close_form.go @@ -0,0 +1,16 @@ +package packet + +import ( + "github.com/sandertv/gophertunnel/minecraft/protocol" +) + +// ClientBoundCloseForm is sent by the server to clear the entire form stack of the client. This means that all +// forms that are currently open will be closed. This does not affect inventories and other containers. +type ClientBoundCloseForm struct{} + +// ID ... +func (*ClientBoundCloseForm) ID() uint32 { + return IDClientBoundCloseForm +} + +func (pk *ClientBoundCloseForm) Marshal(protocol.IO) {} diff --git a/minecraft/protocol/packet/id.go b/minecraft/protocol/packet/id.go index 9468e2da..9e0011d1 100644 --- a/minecraft/protocol/packet/id.go +++ b/minecraft/protocol/packet/id.go @@ -210,4 +210,5 @@ const ( IDSetPlayerInventoryOptions IDSetHud IDAwardAchievement + IDClientBoundCloseForm ) diff --git a/minecraft/protocol/packet/pool.go b/minecraft/protocol/packet/pool.go index 464918bc..916067fd 100644 --- a/minecraft/protocol/packet/pool.go +++ b/minecraft/protocol/packet/pool.go @@ -251,6 +251,7 @@ func init() { IDSetPlayerInventoryOptions: func() Packet { return &SetPlayerInventoryOptions{} }, IDSetHud: func() Packet { return &SetHud{} }, IDAwardAchievement: func() Packet { return &AwardAchievement{} }, + IDClientBoundCloseForm: func() Packet { return &ClientBoundCloseForm{} }, } for id, pk := range serverOriginating { RegisterPacketFromServer(id, pk)