-
-
Notifications
You must be signed in to change notification settings - Fork 89
/
set_hud.go
47 lines (41 loc) · 1.21 KB
/
set_hud.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
43
44
45
46
47
package packet
import (
"github.com/sandertv/gophertunnel/minecraft/protocol"
)
const (
HudElementPaperDoll = iota
HudElementArmour
HudElementToolTips
HudElementTouchControls
HudElementCrosshair
HudElementHotBar
HudElementHealth
HudElementProgressBar
HudElementHunger
HudElementAirBubbles
HudElementHorseHealth
)
const (
HudVisibilityHide = iota
HudVisibilityReset
)
// SetHud is sent by the server to set the visibility of individual HUD elements on the client. It is
// important to note that the client does not reset the state of the HUD elements after it leaves a server,
// meaning they can leak into sessions on different servers. To be safe, you should reset the visibility of
// all HUD elements when a player connects.
type SetHud struct {
// Elements is a list of HUD elements that are being modified. The values can be any of the HudElement
// constants above.
Elements []byte
// Visibility represents the new visibility of the specified Elements. It can be any of the HudVisibility
// constants above.
Visibility byte
}
// ID ...
func (*SetHud) ID() uint32 {
return IDSetHud
}
func (pk *SetHud) Marshal(io protocol.IO) {
protocol.FuncSlice(io, &pk.Elements, io.Uint8)
io.Uint8(&pk.Visibility)
}