-
-
Notifications
You must be signed in to change notification settings - Fork 88
/
correct_player_move_prediction.go
42 lines (37 loc) · 1.39 KB
/
correct_player_move_prediction.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package packet
import (
"github.com/go-gl/mathgl/mgl32"
"github.com/sandertv/gophertunnel/minecraft/protocol"
)
const (
PredictionTypePlayer = iota
PredictionTypeVehicle
)
// CorrectPlayerMovePrediction is sent by the server if and only if StartGame.ServerAuthoritativeMovementMode
// is set to AuthoritativeMovementModeServerWithRewind. The packet is used to correct movement at a specific
// point in time.
type CorrectPlayerMovePrediction struct {
// Position is the position that the player is supposed to be at the tick written in the field below.
// The client will change its current position based on movement after that tick starting from the
// Position.
Position mgl32.Vec3
// Delta is the change in position compared to what the client sent as its position at that specific tick.
Delta mgl32.Vec3
// OnGround specifies if the player was on the ground at the time of the tick below.
OnGround bool
// Tick is the tick of the movement which was corrected by this packet.
Tick uint64
// PredictionType is the type of prediction that was corrected. It is one of the constants above.
PredictionType byte
}
// ID ...
func (*CorrectPlayerMovePrediction) ID() uint32 {
return IDCorrectPlayerMovePrediction
}
func (pk *CorrectPlayerMovePrediction) Marshal(io protocol.IO) {
io.Vec3(&pk.Position)
io.Vec3(&pk.Delta)
io.Bool(&pk.OnGround)
io.Varuint64(&pk.Tick)
io.Uint8(&pk.PredictionType)
}