github.com/df-mc/dragonfly@v0.9.13/server/session/controllable.go (about) 1 package session 2 3 import ( 4 "github.com/df-mc/dragonfly/server/block/cube" 5 "github.com/df-mc/dragonfly/server/cmd" 6 "github.com/df-mc/dragonfly/server/entity/effect" 7 "github.com/df-mc/dragonfly/server/item" 8 "github.com/df-mc/dragonfly/server/item/inventory" 9 "github.com/df-mc/dragonfly/server/player/chat" 10 "github.com/df-mc/dragonfly/server/player/form" 11 "github.com/df-mc/dragonfly/server/player/skin" 12 "github.com/df-mc/dragonfly/server/world" 13 "github.com/go-gl/mathgl/mgl64" 14 "github.com/google/uuid" 15 "golang.org/x/text/language" 16 ) 17 18 // Controllable represents an entity that may be controlled by a Session. Generally, Controllable is 19 // implemented in the form of a Player. 20 // Methods in Controllable will be added as Session needs them in order to handle packets. 21 type Controllable interface { 22 Name() string 23 world.Entity 24 item.User 25 form.Submitter 26 cmd.Source 27 chat.Subscriber 28 29 Locale() language.Tag 30 31 SetHeldItems(right, left item.Stack) 32 33 Move(deltaPos mgl64.Vec3, deltaYaw, deltaPitch float64) 34 Speed() float64 35 36 Chat(msg ...any) 37 ExecuteCommand(commandLine string) 38 GameMode() world.GameMode 39 SetGameMode(mode world.GameMode) 40 Effects() []effect.Effect 41 42 UseItem() 43 ReleaseItem() 44 UseItemOnBlock(pos cube.Pos, face cube.Face, clickPos mgl64.Vec3) 45 UseItemOnEntity(e world.Entity) bool 46 BreakBlock(pos cube.Pos) 47 PickBlock(pos cube.Pos) 48 AttackEntity(e world.Entity) bool 49 Drop(s item.Stack) (n int) 50 SwingArm() 51 PunchAir() 52 53 ExperienceLevel() int 54 SetExperienceLevel(level int) 55 56 EnchantmentSeed() int64 57 ResetEnchantmentSeed() 58 59 Respawn() 60 Dead() bool 61 62 StartSneaking() 63 Sneaking() bool 64 StopSneaking() 65 StartSprinting() 66 Sprinting() bool 67 StopSprinting() 68 StartSwimming() 69 Swimming() bool 70 StopSwimming() 71 StartFlying() 72 Flying() bool 73 StopFlying() 74 StartGliding() 75 Gliding() bool 76 StopGliding() 77 Jump() 78 79 StartBreaking(pos cube.Pos, face cube.Face) 80 ContinueBreaking(face cube.Face) 81 FinishBreaking() 82 AbortBreaking() 83 84 Exhaust(points float64) 85 86 OpenSign(pos cube.Pos, frontSide bool) 87 EditSign(pos cube.Pos, frontText, backText string) error 88 TurnLecternPage(pos cube.Pos, page int) error 89 90 EnderChestInventory() *inventory.Inventory 91 92 // UUID returns the UUID of the controllable. It must be unique for all controllable entities present in 93 // the server. 94 UUID() uuid.UUID 95 // XUID returns the XBOX Live User ID of the controllable. Every controllable must have one of these if 96 // they are authenticated via XBOX Live, as they must be connected to an XBOX Live account. 97 XUID() string 98 // Skin returns the skin of the controllable. Each controllable must have a skin, as it defines how the 99 // entity looks in the world. 100 Skin() skin.Skin 101 SetSkin(skin.Skin) 102 }