From 25a6403c979313cda09dcab95fefaaee42de3574 Mon Sep 17 00:00:00 2001 From: TwistedAsylumMC Date: Thu, 14 Mar 2024 01:37:10 +0000 Subject: [PATCH] minecraft/protocol: Update to support 1.20.70 --- minecraft/protocol/command.go | 18 ++++++++-------- minecraft/protocol/info.go | 4 ++-- minecraft/protocol/packet/id.go | 2 +- .../protocol/packet/item_frame_drop_item.go | 21 ------------------- minecraft/protocol/packet/lectern_update.go | 3 --- minecraft/protocol/packet/level_event.go | 3 +++ minecraft/protocol/packet/mob_effect.go | 3 +++ .../protocol/packet/player_auth_input.go | 5 +++++ minecraft/protocol/packet/pool.go | 2 -- .../protocol/packet/resource_packs_info.go | 4 ++++ minecraft/protocol/packet/set_actor_motion.go | 3 +++ 11 files changed, 30 insertions(+), 38 deletions(-) delete mode 100644 minecraft/protocol/packet/item_frame_drop_item.go diff --git a/minecraft/protocol/command.go b/minecraft/protocol/command.go index 4890ab96..b07a162e 100644 --- a/minecraft/protocol/command.go +++ b/minecraft/protocol/command.go @@ -73,15 +73,15 @@ const ( CommandArgTypeWildcardTarget = 10 CommandArgTypeFilepath = 17 CommandArgTypeIntegerRange = 23 - CommandArgTypeEquipmentSlots = 43 - CommandArgTypeString = 44 - CommandArgTypeBlockPosition = 52 - CommandArgTypePosition = 53 - CommandArgTypeMessage = 55 - CommandArgTypeRawText = 58 - CommandArgTypeJSON = 62 - CommandArgTypeBlockStates = 71 - CommandArgTypeCommand = 74 + CommandArgTypeEquipmentSlots = 47 + CommandArgTypeString = 56 + CommandArgTypeBlockPosition = 64 + CommandArgTypePosition = 65 + CommandArgTypeMessage = 67 + CommandArgTypeRawText = 70 + CommandArgTypeJSON = 74 + CommandArgTypeBlockStates = 83 + CommandArgTypeCommand = 86 ) const ( diff --git a/minecraft/protocol/info.go b/minecraft/protocol/info.go index 90fdcf4f..e92e91ee 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 = 649 + CurrentProtocol = 662 // CurrentVersion is the current version of Minecraft as supported by the `packet` package. - CurrentVersion = "1.20.60" + CurrentVersion = "1.20.70" ) diff --git a/minecraft/protocol/packet/id.go b/minecraft/protocol/packet/id.go index 0548215e..77cd532c 100644 --- a/minecraft/protocol/packet/id.go +++ b/minecraft/protocol/packet/id.go @@ -71,7 +71,7 @@ const ( IDMapInfoRequest IDRequestChunkRadius IDChunkRadiusUpdated - IDItemFrameDropItem + _ IDGameRulesChanged IDCamera IDBossEvent diff --git a/minecraft/protocol/packet/item_frame_drop_item.go b/minecraft/protocol/packet/item_frame_drop_item.go deleted file mode 100644 index e7670cd0..00000000 --- a/minecraft/protocol/packet/item_frame_drop_item.go +++ /dev/null @@ -1,21 +0,0 @@ -package packet - -import ( - "github.com/sandertv/gophertunnel/minecraft/protocol" -) - -// ItemFrameDropItem is sent by the client when it takes an item out of an item frame. -type ItemFrameDropItem struct { - // Position is the position of the item frame that had its item dropped. There must be a 'block entity' - // present at this position. - Position protocol.BlockPos -} - -// ID ... -func (*ItemFrameDropItem) ID() uint32 { - return IDItemFrameDropItem -} - -func (pk *ItemFrameDropItem) Marshal(io protocol.IO) { - io.UBlockPos(&pk.Position) -} diff --git a/minecraft/protocol/packet/lectern_update.go b/minecraft/protocol/packet/lectern_update.go index 7379c9e0..9f893181 100644 --- a/minecraft/protocol/packet/lectern_update.go +++ b/minecraft/protocol/packet/lectern_update.go @@ -14,8 +14,6 @@ type LecternUpdate struct { // Position is the position of the lectern that was updated. If no lectern is at the block position, // the packet should be ignored. Position protocol.BlockPos - // DropBook specifies if the book currently set on display in the lectern should be dropped server-side. - DropBook bool } // ID ... @@ -27,5 +25,4 @@ func (pk *LecternUpdate) Marshal(io protocol.IO) { io.Uint8(&pk.Page) io.Uint8(&pk.PageCount) io.UBlockPos(&pk.Position) - io.Bool(&pk.DropBook) } diff --git a/minecraft/protocol/packet/level_event.go b/minecraft/protocol/packet/level_event.go index 53751283..7f9a6f3c 100644 --- a/minecraft/protocol/packet/level_event.go +++ b/minecraft/protocol/packet/level_event.go @@ -127,6 +127,9 @@ const ( LevelEventAllPlayersSleeping = 9800 LevelEventSleepingPlayers = 9801 LevelEventJumpPrevented = 9810 + LevelEventAnimationVaultActivate = 9811 + LevelEventAnimationVaultDeactivate = 9812 + LevelEventAnimationVaultEjectItem = 9813 LevelEventParticleLegacyEvent = 0x4000 ) diff --git a/minecraft/protocol/packet/mob_effect.go b/minecraft/protocol/packet/mob_effect.go index ce0e053c..b476c9e4 100644 --- a/minecraft/protocol/packet/mob_effect.go +++ b/minecraft/protocol/packet/mob_effect.go @@ -62,6 +62,8 @@ type MobEffect struct { // Duration is the duration of the effect in seconds. After the duration has elapsed, the effect will be // removed automatically client-side. Duration int32 + // Tick is the server tick at which the packet was sent. It is used in relation to CorrectPlayerMovePrediction. + Tick uint64 } // ID ... @@ -76,4 +78,5 @@ func (pk *MobEffect) Marshal(io protocol.IO) { io.Varint32(&pk.Amplifier) io.Bool(&pk.Particles) io.Varint32(&pk.Duration) + io.Uint64(&pk.Tick) } diff --git a/minecraft/protocol/packet/player_auth_input.go b/minecraft/protocol/packet/player_auth_input.go index 7a2576b4..16d5f055 100644 --- a/minecraft/protocol/packet/player_auth_input.go +++ b/minecraft/protocol/packet/player_auth_input.go @@ -52,6 +52,8 @@ const ( InputFlagStopFlying InputFlagClientAckServerData InputFlagClientPredictedVehicle + InputFlagPaddlingLeft + InputFlagPaddlingRight ) const ( @@ -121,6 +123,8 @@ type PlayerAuthInput struct { ItemStackRequest protocol.ItemStackRequest // BlockActions is a slice of block actions that the client has interacted with. BlockActions []protocol.PlayerBlockAction + // VehicleRotation is the rotation of the vehicle that the player is in, if any. + VehicleRotation mgl32.Vec2 // ClientPredictedVehicle is the unique ID of the vehicle that the client predicts the player to be in. ClientPredictedVehicle int64 // AnalogueMoveVector is a Vec2 that specifies the direction in which the player moved, as a combination @@ -158,6 +162,7 @@ func (pk *PlayerAuthInput) Marshal(io protocol.IO) { } if pk.InputData&InputFlagClientPredictedVehicle != 0 { + io.Vec2(&pk.VehicleRotation) io.Varint64(&pk.ClientPredictedVehicle) } diff --git a/minecraft/protocol/packet/pool.go b/minecraft/protocol/packet/pool.go index 3dbd3c11..73d94826 100644 --- a/minecraft/protocol/packet/pool.go +++ b/minecraft/protocol/packet/pool.go @@ -115,7 +115,6 @@ func init() { IDMapInfoRequest: func() Packet { return &MapInfoRequest{} }, IDRequestChunkRadius: func() Packet { return &RequestChunkRadius{} }, IDChunkRadiusUpdated: func() Packet { return &ChunkRadiusUpdated{} }, - IDItemFrameDropItem: func() Packet { return &ItemFrameDropItem{} }, IDGameRulesChanged: func() Packet { return &GameRulesChanged{} }, IDCamera: func() Packet { return &Camera{} }, IDBossEvent: func() Packet { return &BossEvent{} }, @@ -334,7 +333,6 @@ func init() { IDBlockActorData: func() Packet { return &BlockActorData{} }, IDPlayerToggleCrafterSlotRequest: func() Packet { return &PlayerToggleCrafterSlotRequest{} }, IDSetPlayerInventoryOptions: func() Packet { return &SetPlayerInventoryOptions{} }, - IDItemFrameDropItem: func() Packet { return &ItemFrameDropItem{} }, } for id, pk := range clientOriginating { RegisterPacketFromClient(id, pk) diff --git a/minecraft/protocol/packet/resource_packs_info.go b/minecraft/protocol/packet/resource_packs_info.go index 8bb0de49..65b4ed3c 100644 --- a/minecraft/protocol/packet/resource_packs_info.go +++ b/minecraft/protocol/packet/resource_packs_info.go @@ -11,6 +11,9 @@ type ResourcePacksInfo struct { // join the server. If set to true, the client gets the option to either download the resource packs and // join, or quit entirely. Behaviour packs never have to be downloaded. TexturePackRequired bool + // HasAddons specifies if any of the resource packs contain addons in them. If set to true, only clients + // that support addons will be able to download them. + HasAddons bool // HasScripts specifies if any of the resource packs contain scripts in them. If set to true, only clients // that support scripts will be able to download them. HasScripts bool @@ -35,6 +38,7 @@ func (*ResourcePacksInfo) ID() uint32 { func (pk *ResourcePacksInfo) Marshal(io protocol.IO) { io.Bool(&pk.TexturePackRequired) + io.Bool(&pk.HasAddons) io.Bool(&pk.HasScripts) io.Bool(&pk.ForcingServerPacks) protocol.SliceUint16Length(io, &pk.BehaviourPacks) diff --git a/minecraft/protocol/packet/set_actor_motion.go b/minecraft/protocol/packet/set_actor_motion.go index ee3f3376..77420024 100644 --- a/minecraft/protocol/packet/set_actor_motion.go +++ b/minecraft/protocol/packet/set_actor_motion.go @@ -14,6 +14,8 @@ type SetActorMotion struct { // Velocity is the new velocity the entity gets. This velocity will initiate the client-side movement of // the entity. Velocity mgl32.Vec3 + // Tick is the server tick at which the packet was sent. It is used in relation to CorrectPlayerMovePrediction. + Tick uint64 } // ID ... @@ -24,4 +26,5 @@ func (*SetActorMotion) ID() uint32 { func (pk *SetActorMotion) Marshal(io protocol.IO) { io.Varuint64(&pk.EntityRuntimeID) io.Vec3(&pk.Velocity) + io.Varuint64(&pk.Tick) }