-
Notifications
You must be signed in to change notification settings - Fork 141
/
controllable.go
91 lines (77 loc) · 2.34 KB
/
controllable.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package session
import (
"github.com/df-mc/dragonfly/server/block/cube"
"github.com/df-mc/dragonfly/server/cmd"
"github.com/df-mc/dragonfly/server/entity/effect"
"github.com/df-mc/dragonfly/server/item"
"github.com/df-mc/dragonfly/server/player/chat"
"github.com/df-mc/dragonfly/server/player/form"
"github.com/df-mc/dragonfly/server/player/skin"
"github.com/df-mc/dragonfly/server/world"
"github.com/go-gl/mathgl/mgl64"
"github.com/google/uuid"
"golang.org/x/text/language"
)
// Controllable represents an entity that may be controlled by a Session. Generally, Controllable is
// implemented in the form of a Player.
// Methods in Controllable will be added as Session needs them in order to handle packets.
type Controllable interface {
world.Entity
item.Carrier
form.Submitter
cmd.Source
chat.Subscriber
Locale() language.Tag
SetHeldItems(right, left item.Stack)
Move(deltaPos mgl64.Vec3, deltaYaw, deltaPitch float64)
Speed() float64
Facing() cube.Direction
Chat(msg ...any)
ExecuteCommand(commandLine string)
GameMode() world.GameMode
SetGameMode(mode world.GameMode)
Effects() []effect.Effect
UseItem()
ReleaseItem()
UseItemOnBlock(pos cube.Pos, face cube.Face, clickPos mgl64.Vec3)
UseItemOnEntity(e world.Entity)
BreakBlock(pos cube.Pos)
PickBlock(pos cube.Pos)
AttackEntity(e world.Entity)
Drop(s item.Stack) (n int)
SwingArm()
PunchAir()
ExperienceLevel() int
SetExperienceLevel(level int)
Respawn()
Dead() bool
StartSneaking()
Sneaking() bool
StopSneaking()
StartSprinting()
Sprinting() bool
StopSprinting()
StartSwimming()
Swimming() bool
StopSwimming()
StartFlying()
Flying() bool
StopFlying()
Jump()
StartBreaking(pos cube.Pos, face cube.Face)
ContinueBreaking(face cube.Face)
FinishBreaking()
AbortBreaking()
Exhaust(points float64)
EditSign(pos cube.Pos, text string) error
// UUID returns the UUID of the controllable. It must be unique for all controllable entities present in
// the server.
UUID() uuid.UUID
// XUID returns the XBOX Live User ID of the controllable. Every controllable must have one of these if
// they are authenticated via XBOX Live, as they must be connected to an XBOX Live account.
XUID() string
// Skin returns the skin of the controllable. Each controllable must have a skin, as it defines how the
// entity looks in the world.
Skin() skin.Skin
SetSkin(skin.Skin)
}