Skip to content

Commit

Permalink
minecraft/protocol: Update to support 1.20.40 (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
TwistedAsylumMC committed Oct 25, 2023
1 parent 16a337e commit a363378
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 3 deletions.
3 changes: 3 additions & 0 deletions minecraft/protocol/entity_metadata.go
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ const (
EntityDataFlagFeelingHappy
EntityDataFlagSearching
EntityDataFlagCrawling
EntityDataFlagTimerFlag1
EntityDataFlagTimerFlag2
EntityDataFlagTimerFlag3
)

const (
Expand Down
4 changes: 2 additions & 2 deletions minecraft/protocol/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package protocol

const (
// CurrentProtocol is the current protocol version for the version below.
CurrentProtocol = 618
CurrentProtocol = 622
// CurrentVersion is the current version of Minecraft as supported by the `packet` package.
CurrentVersion = "1.20.30"
CurrentVersion = "1.20.40"
)
29 changes: 28 additions & 1 deletion minecraft/protocol/map.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,33 @@ import (
"image/color"
)

const (
MapDecorationTypeMarkerWhite = iota
MapDecorationTypeMarkerGreen
MapDecorationTypeMarkerRed
MapDecorationTypeMarkerBlue
MapDecorationTypeCrossWhite
MapDecorationTypeTriangleRed
MapDecorationTypeSquareWhite
MapDecorationTypeMarkerSign
MapDecorationTypeMarkerPink
MapDecorationTypeMarkerOrange
MapDecorationTypeMarkerYellow
MapDecorationTypeMarkerTeal
MapDecorationTypeTriangleGreen
MapDecorationTypeSmallSquareWhite
MapDecorationTypeMansion
MapDecorationTypeMonument
MapDecorationTypeNoDraw
MapDecorationTypeVillageDesert
MapDecorationTypeVillagePlains
MapDecorationTypeVillageSavanna
MapDecorationTypeVillageSnowy
MapDecorationTypeVillageTaiga
MapDecorationTypeJungleTemple
MapDecorationTypeWitchHut
)

const (
MapObjectTypeEntity = iota
MapObjectTypeBlock
Expand Down Expand Up @@ -39,7 +66,7 @@ func (x *MapTrackedObject) Marshal(r IO) {
// client-side.
type MapDecoration struct {
// Type is the type of the map decoration. The type specifies the shape (and sometimes the colour) that
// the map decoration gets.
// the map decoration gets. It is one of the MapDecorationType constants above.
Type byte
// Rotation is the rotation of the map decoration. It is byte due to the 16 fixed directions that the
// map decoration may face.
Expand Down
4 changes: 4 additions & 0 deletions minecraft/protocol/packet/disconnect.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import (
// Disconnect may be sent by the server to disconnect the client using an optional message to send as the
// disconnect screen.
type Disconnect struct {
// Reason is the reason for the disconnection. It seems as if this field has no use other than for
// telemetry reasons as it does not affect the message that gets displayed on the disconnect screen.
Reason int32
// HideDisconnectionScreen specifies if the disconnection screen should be hidden when the client is
// disconnected, meaning it will be sent directly to the main menu.
HideDisconnectionScreen bool
Expand All @@ -21,6 +24,7 @@ func (*Disconnect) ID() uint32 {
}

func (pk *Disconnect) Marshal(io protocol.IO) {
io.Varint32(&pk.Reason)
io.Bool(&pk.HideDisconnectionScreen)
if !pk.HideDisconnectionScreen {
io.String(&pk.Message)
Expand Down
2 changes: 2 additions & 0 deletions minecraft/protocol/packet/level_sound_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ const (
SoundEventHoglinZombified
SoundEventAmbientUnderwaterEnter
SoundEventAmbientUnderwaterExit
SoundEventBottleFill
SoundEventBottleEmpty
)

// LevelSoundEvent is sent by the server to make any kind of built-in sound heard to a player. It is sent to,
Expand Down
1 change: 1 addition & 0 deletions minecraft/protocol/packet/player_auth_input.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ const (
InputFlagStopCrawling
InputFlagStartFlying
InputFlagStopFlying
InputFlagClientAckServerData
)

const (
Expand Down
1 change: 1 addition & 0 deletions minecraft/protocol/player.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ const (
PlayerActionStopCrawling
PlayerActionStartFlying
PlayerActionStopFlying
PlayerActionClientAckServerData
)

const (
Expand Down

0 comments on commit a363378

Please sign in to comment.