/
camera.go
36 lines (31 loc) · 1.04 KB
/
camera.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
package packet
import (
"bytes"
"github.com/sandertv/gophertunnel/minecraft/protocol"
)
// Camera is sent by the server to use an Education Edition camera on a player. It produces an image
// client-side.
type Camera struct {
// CameraEntityUniqueID is the unique ID of the camera entity from which the picture was taken.
CameraEntityUniqueID int64
// TargetPlayerUniqueID is the unique ID of the target player. The unique ID is a value that remains
// consistent across different sessions of the same world, but most servers simply fill the runtime ID of
// the player out for this field.
TargetPlayerUniqueID int64
}
// ID ...
func (*Camera) ID() uint32 {
return IDCamera
}
// Marshal ...
func (pk *Camera) Marshal(buf *bytes.Buffer) {
_ = protocol.WriteVarint64(buf, pk.CameraEntityUniqueID)
_ = protocol.WriteVarint64(buf, pk.TargetPlayerUniqueID)
}
// Unmarshal ...
func (pk *Camera) Unmarshal(buf *bytes.Buffer) error {
return chainErr(
protocol.Varint64(buf, &pk.CameraEntityUniqueID),
protocol.Varint64(buf, &pk.TargetPlayerUniqueID),
)
}