Fix ClientMovementPredictionSync packet

This commit is contained in:
AkmalFairuz
2025-12-11 08:58:27 +07:00
parent 151816f18d
commit 6700cb7f9b
3 changed files with 17 additions and 6 deletions

View File

@@ -6,7 +6,10 @@ import (
"github.com/sandertv/gophertunnel/minecraft/protocol/packet" "github.com/sandertv/gophertunnel/minecraft/protocol/packet"
) )
const ClientMovementPredictionSyncBitsetSize = 123 const (
ClientMovementPredictionSyncBitsetSize786 = 123
ClientMovementPredictionSyncBitsetSize898 = 124
)
// ClientMovementPredictionSync is sent by the client to the server periodically if the client has received // ClientMovementPredictionSync is sent by the client to the server periodically if the client has received
// movement corrections from the server, containing information about client-predictions that are relevant // movement corrections from the server, containing information about client-predictions that are relevant
@@ -45,11 +48,19 @@ func (*ClientMovementPredictionSync) ID() uint32 {
} }
func (pk *ClientMovementPredictionSync) Marshal(io protocol.IO) { func (pk *ClientMovementPredictionSync) Marshal(io protocol.IO) {
if proto.IsProtoGTE(io, proto.ID786) { var bitsetSize int
io.Bitset(&pk.ActorFlags, ClientMovementPredictionSyncBitsetSize) if proto.IsProtoGTE(io, proto.ID898) {
bitsetSize = 127
} else if proto.IsProtoGTE(io, proto.ID844) {
bitsetSize = 126
} else if proto.IsProtoGTE(io, proto.ID818) {
bitsetSize = 125
} else if proto.IsProtoGTE(io, proto.ID786) {
bitsetSize = 123
} else { } else {
io.Bitset(&pk.ActorFlags, 120) bitsetSize = 120
} }
io.Bitset(&pk.ActorFlags, bitsetSize)
io.Float32(&pk.BoundingBoxScale) io.Float32(&pk.BoundingBoxScale)
io.Float32(&pk.BoundingBoxWidth) io.Float32(&pk.BoundingBoxWidth)
io.Float32(&pk.BoundingBoxHeight) io.Float32(&pk.BoundingBoxHeight)

View File

@@ -39,7 +39,7 @@ func (c *Command) Marshal(r protocol.IO) {
if IsProtoGTE(r, ID898) { if IsProtoGTE(r, ID898) {
r.String(&c.PermissionLevel) r.String(&c.PermissionLevel)
} else { } else {
permLevel := uint8(0) permLevel := byte(0)
r.Uint8(&permLevel) r.Uint8(&permLevel)
c.PermissionLevel = "any" c.PermissionLevel = "any"
} }