Documentation
¶
Index ¶
- type IGame
- type IParticipant
- type Impl
- type Nop
- func (g Nop) AllowBuild() bool
- func (g Nop) CheckEnd()
- func (g Nop) Create(_ IGame)
- func (g Nop) EndingTime() int
- func (g Nop) Game() IGame
- func (g Nop) GameName() string
- func (g Nop) HandleAttackEntity(ctx *player.Context, e world.Entity, force *float64, height *float64, ...)
- func (g Nop) HandleBlockBreak(ctx *player.Context, pos cube.Pos, drops *[]item.Stack, xp *int)
- func (g Nop) HandleBlockPlace(ctx *player.Context, pos cube.Pos, b world.Block)
- func (g Nop) HandleDrop(ctx *inventory.Context, slot int, stack item.Stack)
- func (g Nop) HandleFoodLoss(ctx *player.Context, from int, to *int)
- func (g Nop) HandleHeal(ctx *player.Context, health *float64, src world.HealingSource)
- func (g Nop) HandleHurt(ctx *player.Context, damage *float64, immune bool, immunity *time.Duration, ...)
- func (g Nop) HandleItemUse(ctx *player.Context)
- func (g Nop) HandleItemUseOnEntity(ctx *player.Context, e world.Entity)
- func (g Nop) HandleMove(ctx *player.Context, pos mgl64.Vec3, rot cube.Rotation)
- func (g Nop) HandlePlace(ctx *inventory.Context, slot int, stack item.Stack)
- func (g Nop) HandleTake(ctx *inventory.Context, slot int, stack item.Stack)
- func (g Nop) MaxParticipants() int
- func (g Nop) MinimumParticipants() int
- func (g Nop) OnEnd()
- func (g Nop) OnInit()
- func (g Nop) OnJoin(p *player.Player) error
- func (g Nop) OnJoined(par IParticipant, p *player.Player)
- func (g Nop) OnQuit(p *player.Player)
- func (g Nop) OnStart()
- func (g Nop) OnStop()
- func (g Nop) OnTick()
- func (g Nop) PlayingTime() int
- func (g Nop) WaitingTime() int
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type IGame ¶
type IGame interface { Join(p *player.Player) error Quit(p *player.Player) error SetCloseHook(func()) ID() string IsWaiting() bool IsPlaying() bool IsEnding() bool CurrentTick() uint64 Participants() map[string]IParticipant PlayingParticipants() map[string]IParticipant End() World() *world.World Players(tx *world.Tx) []*player.Player SetSpectator(p *player.Player) HandleBlockBreak(ctx *player.Context, pos cube.Pos, drops *[]item.Stack, xp *int) HandleBlockPlace(ctx *player.Context, pos cube.Pos, b world.Block) HandleMove(ctx *player.Context, pos mgl64.Vec3, rot cube.Rotation) HandleFoodLoss(ctx *player.Context, from int, to *int) HandleHeal(ctx *player.Context, health *float64, src world.HealingSource) HandleHurt(ctx *player.Context, damage *float64, immune bool, immunity *time.Duration, src world.DamageSource) HandleItemUse(ctx *player.Context) HandleItemUseOnEntity(ctx *player.Context, e world.Entity) HandleAttackEntity(ctx *player.Context, e world.Entity, force *float64, height *float64, critical *bool) HandleDrop(ctx *inventory.Context, slot int, stack item.Stack) HandlePlace(ctx *inventory.Context, slot int, stack item.Stack) HandleTake(ctx *inventory.Context, slot int, stack item.Stack) Load() error Messaget(translationName string, args ...any) Sound(name string) HandleItemPickup(ctx *player.Context, i *item.Stack) SetPlayAgainHook(hook func(p *player.Player) error) SetDuelRequestMode(b bool) }
type IParticipant ¶
type Impl ¶
type Impl interface { // PlayingTime returns the playing time of the game in seconds. PlayingTime() int // WaitingTime returns the waiting time of the game in seconds. WaitingTime() int // EndingTime returns the ending time of the game in seconds. EndingTime() int // MaxParticipants returns the maximum number of participants in the game. MaxParticipants() int // MinimumParticipants returns the minimum number of participants in the game. MinimumParticipants() int // GameName returns the name of the game. GameName() string // OnJoin is called when a player joins the game. Return an error to prevent the player from joining. OnJoin(p *player.Player) error // OnJoined is called when a player has successfully joined the game. OnJoined(par IParticipant, p *player.Player) // OnQuit is called when a player quits the game. OnQuit(p *player.Player) // OnInit is called when the game is initialized. OnInit() // OnStart is called when the game starts. OnStart() // OnEnd is called when the game ends. OnEnd() // OnStop is called when the game stops. OnStop() // OnTick is called every 50 milliseconds. OnTick() // CheckEnd is called when the game should check if it should end or not. CheckEnd() // Game returns the game instance. Game() IGame // Create sets the game instance. Create(g IGame) // AllowBuild returns whether the player is allowed to place or break blocks. AllowBuild() bool HandleHurt(ctx *player.Context, damage *float64, immune bool, immunity *time.Duration, src world.DamageSource) HandleHeal(ctx *player.Context, health *float64, src world.HealingSource) HandleFoodLoss(ctx *player.Context, from int, to *int) HandleBlockBreak(ctx *player.Context, pos cube.Pos, drops *[]item.Stack, xp *int) HandleBlockPlace(ctx *player.Context, pos cube.Pos, b world.Block) HandleMove(ctx *player.Context, pos mgl64.Vec3, rot cube.Rotation) HandleAttackEntity(ctx *player.Context, e world.Entity, force *float64, height *float64, critical *bool) HandleItemUse(ctx *player.Context) HandleItemUseOnEntity(ctx *player.Context, e world.Entity) HandleDrop(ctx *inventory.Context, slot int, stack item.Stack) HandlePlace(ctx *inventory.Context, slot int, stack item.Stack) HandleTake(ctx *inventory.Context, slot int, stack item.Stack) }
type Nop ¶
type Nop struct { }
func (Nop) AllowBuild ¶
func (Nop) EndingTime ¶
func (Nop) HandleAttackEntity ¶
func (Nop) HandleBlockBreak ¶
func (Nop) HandleBlockPlace ¶
func (Nop) HandleHeal ¶
func (Nop) HandleHurt ¶
func (Nop) HandleItemUse ¶
func (Nop) HandleItemUseOnEntity ¶
func (Nop) HandleMove ¶
func (Nop) HandlePlace ¶
func (Nop) MaxParticipants ¶
func (Nop) MinimumParticipants ¶
func (Nop) PlayingTime ¶
func (Nop) WaitingTime ¶
Click to show internal directories.
Click to hide internal directories.