Skip to content

Commit

Permalink
gophertunnel: Initial support for v1.19.50.
Browse files Browse the repository at this point in the history
  • Loading branch information
JustTalDevelops committed Nov 15, 2022
1 parent 748203e commit e0d052f
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 4 deletions.
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 = 557
CurrentProtocol = 560
// CurrentVersion is the current version of Minecraft as supported by the `packet` package.
CurrentVersion = "1.19.40"
CurrentVersion = "1.19.50"
)
2 changes: 2 additions & 0 deletions minecraft/protocol/item_stack.go
Expand Up @@ -17,6 +17,8 @@ const (
FilterCauseSlashCommandChat
FilterCauseCartographyText
FilterCauseSlashCommandNonChat
FilterCauseScoreboardText
FilterCauseTickingAreaText
)

// ItemStackRequest represents a single request present in an ItemStackRequest packet sent by the client to
Expand Down
1 change: 1 addition & 0 deletions minecraft/protocol/packet/decoder.go
Expand Up @@ -77,6 +77,7 @@ const (
// Decode decodes one 'packet' from the io.Reader passed in NewDecoder(), producing a slice of packets that it
// held and an error if not successful.
func (decoder *Decoder) Decode() (packets [][]byte, err error) {

This comment has been minimized.

Copy link
@Blackjack200

Blackjack200 Nov 15, 2022

Contributor

This implementation is very good but should this be discarded?

This comment has been minimized.

Copy link
@JustTalDevelops

JustTalDevelops Nov 15, 2022

Author Collaborator

Yep, accidentally added this. Latest commit removes this change.

var data []byte
if decoder.pr == nil {
var n int
Expand Down
1 change: 1 addition & 0 deletions minecraft/protocol/packet/id.go
Expand Up @@ -196,4 +196,5 @@ const (
IDRequestNetworkSettings
IDGameTestRequest
IDGameTestResults
IDUpdateClientInputLocks
)
14 changes: 12 additions & 2 deletions minecraft/protocol/packet/level_sound_event.go
Expand Up @@ -450,11 +450,21 @@ const (
SoundEventConvertToFrog
SoundEventRecordPlaying
SoundEventEnchantingTableUse
_
_
SoundEventStepSand
SoundEventDashReady
SoundEventBundleDropContents
SoundEventBundleInsert
SoundEventBundleRemoveOne
SoundEventPressurePlateClickOff
SoundEventPressurePlateClickOn
SoundEventButtonClickOff
SoundEventButtonClickOn
SoundEventDoorOpen
SoundEventDoorClose
SoundEventTrapdoorOpen
SoundEventTrapdoorClose
SoundEventFenceGateOpen
SoundEventFenceGateClose
)

// LevelSoundEvent is sent by the server to make any kind of built-in sound heard to a player. It is sent to,
Expand Down
Expand Up @@ -8,6 +8,7 @@ const (
StructureTemplateRequestExportFromSave = iota + 1
StructureTemplateRequestExportFromLoad
StructureTemplateRequestQuerySavedStructure
StructureTemplateRequestImportFromSave
)

// StructureTemplateDataRequest is sent by the client to request data of a structure.
Expand Down
Expand Up @@ -8,6 +8,7 @@ import (
const (
StructureTemplateResponseExport = iota + 1
StructureTemplateResponseQuery
StructureTemplateResponseImport
)

// StructureTemplateDataResponse is sent by the server to send data of a structure to the client in response
Expand Down
42 changes: 42 additions & 0 deletions minecraft/protocol/packet/update_client_input_locks.go
@@ -0,0 +1,42 @@
package packet

import (
"github.com/go-gl/mathgl/mgl32"
"github.com/sandertv/gophertunnel/minecraft/protocol"
)

const (
ClientInputLockMove = 1 << (iota + 1)
ClientInputLockJump
ClientInputLockSneak
ClientInputLockMount
ClientInputLockDismount
ClientInputLockRotation
)

// UpdateClientInputLocks is sent by the server to the client to lock certain inputs the client usually has, such as
// movement, jumping, sneaking, and more.
type UpdateClientInputLocks struct {
// Locks is an encoded bitset of all locks that are currently active. The locks are defined in the constants above.
Locks uint32
// Position is the server's position of the client at the time the packet was sent. It is unclear what the exact
// purpose of this field is.
Position mgl32.Vec3
}

// ID ...
func (u UpdateClientInputLocks) ID() uint32 {
return IDUpdateClientInputLocks
}

// Marshal ...
func (u UpdateClientInputLocks) Marshal(w *protocol.Writer) {
w.Varuint32(&u.Locks)
w.Vec3(&u.Position)
}

// Unmarshal ...
func (u UpdateClientInputLocks) Unmarshal(r *protocol.Reader) {
r.Varuint32(&u.Locks)
r.Vec3(&u.Position)
}

0 comments on commit e0d052f

Please sign in to comment.