Skip to content

Commit

Permalink
minecraft/protocol: Update to support 1.20.70
Browse files Browse the repository at this point in the history
  • Loading branch information
TwistedAsylumMC committed Mar 14, 2024
1 parent cf7b782 commit 25a6403
Show file tree
Hide file tree
Showing 11 changed files with 30 additions and 38 deletions.
18 changes: 9 additions & 9 deletions minecraft/protocol/command.go
Expand Up @@ -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 (
Expand Down
4 changes: 2 additions & 2 deletions minecraft/protocol/info.go
Expand Up @@ -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"
)
2 changes: 1 addition & 1 deletion minecraft/protocol/packet/id.go
Expand Up @@ -71,7 +71,7 @@ const (
IDMapInfoRequest
IDRequestChunkRadius
IDChunkRadiusUpdated
IDItemFrameDropItem
_
IDGameRulesChanged
IDCamera
IDBossEvent
Expand Down
21 changes: 0 additions & 21 deletions minecraft/protocol/packet/item_frame_drop_item.go

This file was deleted.

3 changes: 0 additions & 3 deletions minecraft/protocol/packet/lectern_update.go
Expand Up @@ -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 ...
Expand All @@ -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)
}
3 changes: 3 additions & 0 deletions minecraft/protocol/packet/level_event.go
Expand Up @@ -127,6 +127,9 @@ const (
LevelEventAllPlayersSleeping = 9800
LevelEventSleepingPlayers = 9801
LevelEventJumpPrevented = 9810
LevelEventAnimationVaultActivate = 9811
LevelEventAnimationVaultDeactivate = 9812
LevelEventAnimationVaultEjectItem = 9813
LevelEventParticleLegacyEvent = 0x4000
)

Expand Down
3 changes: 3 additions & 0 deletions minecraft/protocol/packet/mob_effect.go
Expand Up @@ -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 ...
Expand All @@ -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)
}
5 changes: 5 additions & 0 deletions minecraft/protocol/packet/player_auth_input.go
Expand Up @@ -52,6 +52,8 @@ const (
InputFlagStopFlying
InputFlagClientAckServerData
InputFlagClientPredictedVehicle
InputFlagPaddlingLeft
InputFlagPaddlingRight
)

const (
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -158,6 +162,7 @@ func (pk *PlayerAuthInput) Marshal(io protocol.IO) {
}

if pk.InputData&InputFlagClientPredictedVehicle != 0 {
io.Vec2(&pk.VehicleRotation)
io.Varint64(&pk.ClientPredictedVehicle)
}

Expand Down
2 changes: 0 additions & 2 deletions minecraft/protocol/packet/pool.go
Expand Up @@ -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{} },
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions minecraft/protocol/packet/resource_packs_info.go
Expand Up @@ -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
Expand All @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions minecraft/protocol/packet/set_actor_motion.go
Expand Up @@ -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 ...
Expand All @@ -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)
}

0 comments on commit 25a6403

Please sign in to comment.