forked from Sandertv/gophertunnel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
request_ability.go
48 lines (43 loc) · 1.11 KB
/
request_ability.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
48
package packet
import (
"github.com/Adrian8115/gophertunnel-Amethyst-Protocol/minecraft/protocol"
)
const (
AbilityBuild = iota
AbilityMine
AbilityDoorsAndSwitches
AbilityOpenContainers
AbilityAttackPlayers
AbilityAttackMobs
AbilityOperatorCommands
AbilityTeleport
AbilityInvulnerable
AbilityFlying
AbilityMayFly
AbilityInstantBuild
AbilityLightning
AbilityFlySpeed
AbilityWalkSpeed
AbilityMuted
AbilityWorldBuilder
AbilityNoClip
AbilityCount
)
// RequestAbility is a packet sent by the client to the server to request permission for a specific ability from the
// server. These abilities are defined above.
type RequestAbility struct {
// Ability is the ability that the client is requesting. This is one of the constants defined in the
// protocol/ability.go file.
Ability int32
// Value represents the value of the ability. This can either be a boolean or a float32, otherwise the writer/reader
// will panic.
Value any
}
// ID ...
func (*RequestAbility) ID() uint32 {
return IDRequestAbility
}
func (pk *RequestAbility) Marshal(io protocol.IO) {
io.Varint32(&pk.Ability)
io.AbilityValue(&pk.Value)
}