forked from Sandertv/gophertunnel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
event.go
30 lines (26 loc) · 854 Bytes
/
event.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
package packet
import (
"github.com/Adrian8115/gophertunnel-Amethyst-Protocol/minecraft/protocol"
)
// Event is sent by the server to send an event with additional data. It is typically sent to the client for
// telemetry reasons, much like the SimpleEvent packet.
type Event struct {
// EntityRuntimeID is the runtime ID of the player. The runtime ID is unique for each world session, and
// entities are generally identified in packets using this runtime ID.
EntityRuntimeID uint64
// UsePlayerID ...
// TODO: Figure out what UsePlayerID is for.
UsePlayerID byte
// Event is the event that is transmitted.
Event protocol.Event
}
// ID ...
func (*Event) ID() uint32 {
return IDEvent
}
func (pk *Event) Marshal(io protocol.IO) {
io.Varuint64(&pk.EntityRuntimeID)
io.EventType(&pk.Event)
io.Uint8(&pk.UsePlayerID)
pk.Event.Marshal(io)
}