Documentation
¶
Index ¶
- type AttackEntityHandler
- type BlockBreakHandler
- type BlockPickHandler
- type BlockPlaceHandler
- type ChangeWorldHandler
- type ChatHandler
- type CommandExecutionHandler
- type DeathHandler
- type DiagnosticsHandler
- type ExperienceGainHandler
- type FireExtinguishHandler
- type FoodLossHandler
- type HealHandler
- type HeldSlotChangeHandler
- type HurtHandler
- type ItemConsumeHandler
- type ItemDamageHandler
- type ItemDropHandler
- type ItemPickupHandler
- type ItemReleaseHandler
- type ItemUseHandler
- type ItemUseOnBlockHandler
- type ItemUseOnEntityHandler
- type JumpHandler
- type LecternPageTurnHandler
- type MoveHandler
- type MultipleHandler
- func (h *MultipleHandler) Clear()
- func (h *MultipleHandler) HandleAttackEntity(ctx *event.Context[*player.Player], e world.Entity, force, height *float64, ...)
- func (h *MultipleHandler) HandleBlockBreak(ctx *event.Context[*player.Player], pos cube.Pos, drops *[]item.Stack, xp *int)
- func (h *MultipleHandler) HandleBlockPick(ctx *event.Context[*player.Player], pos cube.Pos, b world.Block)
- func (h *MultipleHandler) HandleBlockPlace(ctx *event.Context[*player.Player], pos cube.Pos, b world.Block)
- func (h *MultipleHandler) HandleChangeWorld(p *player.Player, before, after *world.World)
- func (h *MultipleHandler) HandleChat(ctx *event.Context[*player.Player], message *string)
- func (h *MultipleHandler) HandleCommandExecution(ctx *event.Context[*player.Player], command cmd.Command, args []string)
- func (h *MultipleHandler) HandleDeath(p *player.Player, src world.DamageSource, keepInv *bool)
- func (h *MultipleHandler) HandleDiagnostics(p *player.Player, d session.Diagnostics)
- func (h *MultipleHandler) HandleExperienceGain(ctx *event.Context[*player.Player], amount *int)
- func (h *MultipleHandler) HandleFireExtinguish(ctx *event.Context[*player.Player], pos cube.Pos)
- func (h *MultipleHandler) HandleFoodLoss(ctx *event.Context[*player.Player], from int, to *int)
- func (h *MultipleHandler) HandleHeal(ctx *event.Context[*player.Player], health *float64, src world.HealingSource)
- func (h *MultipleHandler) HandleHeldSlotChange(ctx *event.Context[*player.Player], from, to int)
- func (h *MultipleHandler) HandleHurt(ctx *event.Context[*player.Player], damage *float64, immune bool, ...)
- func (h *MultipleHandler) HandleItemConsume(ctx *event.Context[*player.Player], item item.Stack)
- func (h *MultipleHandler) HandleItemDamage(ctx *event.Context[*player.Player], i item.Stack, damage int)
- func (h *MultipleHandler) HandleItemDrop(ctx *event.Context[*player.Player], s item.Stack)
- func (h *MultipleHandler) HandleItemPickup(ctx *event.Context[*player.Player], i *item.Stack)
- func (h *MultipleHandler) HandleItemRelease(ctx *event.Context[*player.Player], item item.Stack, dur time.Duration)
- func (h *MultipleHandler) HandleItemUse(ctx *event.Context[*player.Player])
- func (h *MultipleHandler) HandleItemUseOnBlock(ctx *event.Context[*player.Player], pos cube.Pos, face cube.Face, ...)
- func (h *MultipleHandler) HandleItemUseOnEntity(ctx *event.Context[*player.Player], e world.Entity)
- func (h *MultipleHandler) HandleJump(p *player.Player)
- func (h *MultipleHandler) HandleLecternPageTurn(ctx *event.Context[*player.Player], pos cube.Pos, oldPage int, newPage *int)
- func (h *MultipleHandler) HandleMove(ctx *event.Context[*player.Player], newPos mgl64.Vec3, newRot cube.Rotation)
- func (h *MultipleHandler) HandlePunchAir(ctx *event.Context[*player.Player])
- func (h *MultipleHandler) HandleQuit(p *player.Player)
- func (h *MultipleHandler) HandleRespawn(p *player.Player, pos *mgl64.Vec3, w **world.World)
- func (h *MultipleHandler) HandleSignEdit(ctx *event.Context[*player.Player], pos cube.Pos, frontSide bool, ...)
- func (h *MultipleHandler) HandleSkinChange(ctx *event.Context[*player.Player], skin *skin.Skin)
- func (h *MultipleHandler) HandleStartBreak(ctx *event.Context[*player.Player], pos cube.Pos)
- func (h *MultipleHandler) HandleTeleport(ctx *event.Context[*player.Player], pos mgl64.Vec3)
- func (h *MultipleHandler) HandleToggleSneak(ctx *event.Context[*player.Player], after bool)
- func (h *MultipleHandler) HandleToggleSprint(ctx *event.Context[*player.Player], after bool)
- func (h *MultipleHandler) HandleTransfer(ctx *event.Context[*player.Player], addr *net.UDPAddr)
- func (h *MultipleHandler) Register(hdr any) func()
- type PunchAirHandler
- type QuitHandler
- type RespawnHandler
- type SignEditHandler
- type SkinChangeHandler
- type StartBreakHandler
- type TeleportHandler
- type ToggleSneakHandler
- type ToggleSprintHandler
- type TransferHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AttackEntityHandler ¶
type AttackEntityHandler interface {
// HandleAttackEntity handles the player attacking an entity using the item held in its hand. ctx.Cancel()
// may be called to cancel the attack, which will cancel damage dealt to the target and will stop the
// entity from being knocked back.
// The entity attacked may not be alive (implements entity.Living), in which case no damage will be dealt
// and the target won't be knocked back.
// The entity attacked may also be immune when this method is called, in which case no damage and knock-
// back will be dealt.
// The knock back force and height is also provided which can be modified.
// The attack can be a critical attack, which would increase damage by a factor of 1.5 and
// spawn critical hit particles around the target entity. These particles will not be displayed
// if no damage is dealt.
HandleAttackEntity(ctx *event.Context[*player.Player], e world.Entity, force, height *float64, critical *bool)
}
type BlockBreakHandler ¶
type BlockBreakHandler interface {
// HandleBlockBreak handles a block that is being broken by a player. ctx.Cancel() may be called to cancel
// the block being broken. A pointer to a slice of the block's drops is passed, and may be altered
// to change what items will actually be dropped.
HandleBlockBreak(ctx *event.Context[*player.Player], pos cube.Pos, drops *[]item.Stack, xp *int)
}
type BlockPickHandler ¶
type BlockPlaceHandler ¶
type ChangeWorldHandler ¶
type ChatHandler ¶
type CommandExecutionHandler ¶
type CommandExecutionHandler interface {
// HandleCommandExecution handles the command execution of a player, who wrote a command in the chat.
// ctx.Cancel() may be called to cancel the command execution.
HandleCommandExecution(ctx *event.Context[*player.Player], command cmd.Command, args []string)
}
type DeathHandler ¶
type DeathHandler interface {
// HandleDeath handles the player dying to a particular damage cause.
HandleDeath(p *player.Player, src world.DamageSource, keepInv *bool)
}
type DiagnosticsHandler ¶
type DiagnosticsHandler interface {
// HandleDiagnostics handles the latest diagnostics data that the player has sent to the server. This is
// not sent by every client however, only those with the "Creator > Enable Client Diagnostics" setting
// enabled.
HandleDiagnostics(p *player.Player, d session.Diagnostics)
}
type ExperienceGainHandler ¶
type FireExtinguishHandler ¶
type FireExtinguishHandler interface {
// HandleFireExtinguish handles the player extinguishing a fire at a specific position. ctx.Cancel() may
// be called to cancel the fire being extinguished.
// cube.Pos can be used to see where was the fire extinguished, may be used to cancel this on specific positions.
HandleFireExtinguish(ctx *event.Context[*player.Player], pos cube.Pos)
}
type FoodLossHandler ¶
type FoodLossHandler interface {
// HandleFoodLoss handles the food bar of a player depleting naturally, for example because the player was
// sprinting and jumping. ctx.Cancel() may be called to cancel the food points being lost.
HandleFoodLoss(ctx *event.Context[*player.Player], from int, to *int)
}
type HealHandler ¶
type HeldSlotChangeHandler ¶
type HurtHandler ¶
type HurtHandler interface {
// HandleHurt handles the player being hurt by any damage source. ctx.Cancel() may be called to cancel the
// damage being dealt to the player.
// The damage dealt to the player may be changed by assigning to *damage.
// *damage is the final damage dealt to the player. Immune is set to true
// if the player was hurt during an immunity frame with higher damage than
// the original cause of the immunity frame. In this case, the damage is
// reduced but the player is still knocked back.
HandleHurt(ctx *event.Context[*player.Player], damage *float64, immune bool, attackImmunity *time.Duration, src world.DamageSource)
}
type ItemConsumeHandler ¶
type ItemDamageHandler ¶
type ItemDamageHandler interface {
// HandleItemDamage handles the event wherein the item either held by the player or as armour takes
// damage through usage.
// The type of the item may be checked to determine whether it was armour or a tool used. The damage to
// the item is passed.
HandleItemDamage(ctx *event.Context[*player.Player], i item.Stack, damage int)
}
type ItemDropHandler ¶
type ItemDropHandler interface {
// HandleItemDrop handles the player dropping an item on the ground. The dropped item entity is passed.
// ctx.Cancel() may be called to prevent the player from dropping the entity.Item passed on the ground.
// e.Item() may be called to obtain the item stack dropped.
HandleItemDrop(ctx *event.Context[*player.Player], s item.Stack)
}
type ItemPickupHandler ¶
type ItemPickupHandler interface {
// HandleItemPickup handles the player picking up an item from the ground. The item stack laying on the
// ground is passed. ctx.Cancel() may be called to prevent the player from picking up the item.
HandleItemPickup(ctx *event.Context[*player.Player], i *item.Stack)
}
type ItemReleaseHandler ¶
type ItemUseHandler ¶
type ItemUseHandler interface {
// HandleItemUse handles the player using an item in the air. It is called for each item, although most
// will not actually do anything. Items such as snowballs may be thrown if HandleItemUse does not cancel
// the context using ctx.Cancel(). It is not called if the player is holding no item.
HandleItemUse(ctx *event.Context[*player.Player])
}
type ItemUseOnBlockHandler ¶
type ItemUseOnBlockHandler interface {
// HandleItemUseOnBlock handles the player using the item held in its main hand on a block at the block
// position passed. The face of the block clicked is also passed, along with the relative click position.
// The click position has X, Y and Z values which are all in the range 0.0-1.0. It is also called if the
// player is holding no item.
HandleItemUseOnBlock(ctx *event.Context[*player.Player], pos cube.Pos, face cube.Face, clickPos mgl64.Vec3)
}
type ItemUseOnEntityHandler ¶
type ItemUseOnEntityHandler interface {
// HandleItemUseOnEntity handles the player using the item held in its main hand on an entity passed to
// the method.
// HandleItemUseOnEntity is always called when a player uses an item on an entity, regardless of whether
// the item actually does anything when used on an entity. It is also called if the player is holding no
// item.
HandleItemUseOnEntity(ctx *event.Context[*player.Player], e world.Entity)
}
type JumpHandler ¶
type LecternPageTurnHandler ¶
type LecternPageTurnHandler interface {
// HandleLecternPageTurn handles the player turning a page in a lectern. ctx.Cancel() may be called to cancel the
// page turn. The page number may be changed by assigning to *page.
HandleLecternPageTurn(ctx *event.Context[*player.Player], pos cube.Pos, oldPage int, newPage *int)
}
type MoveHandler ¶
type MultipleHandler ¶
type MultipleHandler struct {
// contains filtered or unexported fields
}
func New ¶
func New() *MultipleHandler
func (*MultipleHandler) Clear ¶
func (h *MultipleHandler) Clear()
func (*MultipleHandler) HandleAttackEntity ¶
func (*MultipleHandler) HandleBlockBreak ¶
func (*MultipleHandler) HandleBlockPick ¶
func (*MultipleHandler) HandleBlockPlace ¶
func (*MultipleHandler) HandleChangeWorld ¶
func (h *MultipleHandler) HandleChangeWorld(p *player.Player, before, after *world.World)
func (*MultipleHandler) HandleChat ¶
func (*MultipleHandler) HandleCommandExecution ¶
func (*MultipleHandler) HandleDeath ¶
func (h *MultipleHandler) HandleDeath(p *player.Player, src world.DamageSource, keepInv *bool)
func (*MultipleHandler) HandleDiagnostics ¶
func (h *MultipleHandler) HandleDiagnostics(p *player.Player, d session.Diagnostics)
func (*MultipleHandler) HandleExperienceGain ¶
func (*MultipleHandler) HandleFireExtinguish ¶
func (*MultipleHandler) HandleFoodLoss ¶
func (*MultipleHandler) HandleHeal ¶
func (h *MultipleHandler) HandleHeal(ctx *event.Context[*player.Player], health *float64, src world.HealingSource)
func (*MultipleHandler) HandleHeldSlotChange ¶
func (*MultipleHandler) HandleHurt ¶
func (*MultipleHandler) HandleItemConsume ¶
func (*MultipleHandler) HandleItemDamage ¶
func (*MultipleHandler) HandleItemDrop ¶
func (*MultipleHandler) HandleItemPickup ¶
func (*MultipleHandler) HandleItemRelease ¶
func (*MultipleHandler) HandleItemUse ¶
func (h *MultipleHandler) HandleItemUse(ctx *event.Context[*player.Player])
func (*MultipleHandler) HandleItemUseOnBlock ¶
func (*MultipleHandler) HandleItemUseOnEntity ¶
func (*MultipleHandler) HandleJump ¶
func (h *MultipleHandler) HandleJump(p *player.Player)
func (*MultipleHandler) HandleLecternPageTurn ¶
func (*MultipleHandler) HandleMove ¶
func (*MultipleHandler) HandlePunchAir ¶
func (h *MultipleHandler) HandlePunchAir(ctx *event.Context[*player.Player])
func (*MultipleHandler) HandleQuit ¶
func (h *MultipleHandler) HandleQuit(p *player.Player)
func (*MultipleHandler) HandleRespawn ¶
func (*MultipleHandler) HandleSignEdit ¶
func (*MultipleHandler) HandleSkinChange ¶
func (*MultipleHandler) HandleStartBreak ¶
func (*MultipleHandler) HandleTeleport ¶
func (*MultipleHandler) HandleToggleSneak ¶
func (*MultipleHandler) HandleToggleSprint ¶
func (*MultipleHandler) HandleTransfer ¶
func (*MultipleHandler) Register ¶
func (h *MultipleHandler) Register(hdr any) func()
type PunchAirHandler ¶
type QuitHandler ¶
type RespawnHandler ¶
type RespawnHandler interface {
// HandleRespawn handles the respawning of the player in the world. The spawn position passed may be
// changed by assigning to *pos. The world.World in which the Player is respawned may be modifying by assigning to
// *w. This world may be the world the Player died in, but it might also point to a different world (the overworld)
// if the Player died in the nether or end.
HandleRespawn(p *player.Player, pos *mgl64.Vec3, w **world.World)
}
type SignEditHandler ¶
type SignEditHandler interface {
// HandleSignEdit handles the player editing a sign. It is called for every keystroke while editing a sign and
// has both the old text passed and the text after the edit. This typically only has a change of one character.
HandleSignEdit(ctx *event.Context[*player.Player], pos cube.Pos, frontSide bool, oldText, newText string)
}
type SkinChangeHandler ¶
type StartBreakHandler ¶
type TeleportHandler ¶
type ToggleSneakHandler ¶
type ToggleSprintHandler ¶
Click to show internal directories.
Click to hide internal directories.