Documentation ¶
Index ¶
- type AttackEntityHandler
- type BlockBreakHandler
- type BlockPickHandler
- type BlockPlaceHandler
- type ChangeWorldHandler
- type ChatHandler
- type CommandExecutionHandler
- type DeathHandler
- type ExperienceGainHandler
- type FoodLossHandler
- type HealHandler
- type HurtHandler
- type ItemConsumeHandler
- type ItemDamageHandler
- type ItemDropHandler
- type ItemPickupHandler
- type ItemUseHandler
- type ItemUseOnBlockHandler
- type ItemUseOnEntityHandler
- type JumpHandler
- type MoveHandler
- type MultipleHandler
- func (h *MultipleHandler) Clear()
- func (h *MultipleHandler) HandleAttackEntity(ctx *event.Context, e world.Entity, force, height *float64, critical *bool)
- func (h *MultipleHandler) HandleBlockBreak(ctx *event.Context, pos cube.Pos, drops *[]item.Stack, xp *int)
- func (h *MultipleHandler) HandleBlockPick(ctx *event.Context, pos cube.Pos, b world.Block)
- func (h *MultipleHandler) HandleBlockPlace(ctx *event.Context, pos cube.Pos, b world.Block)
- func (h *MultipleHandler) HandleChangeWorld(before, after *world.World)
- func (h *MultipleHandler) HandleChat(ctx *event.Context, message *string)
- func (h *MultipleHandler) HandleCommandExecution(ctx *event.Context, command cmd.Command, args []string)
- func (h *MultipleHandler) HandleDeath(src world.DamageSource, keepInv *bool)
- func (h *MultipleHandler) HandleExperienceGain(ctx *event.Context, amount *int)
- func (h *MultipleHandler) HandleFoodLoss(ctx *event.Context, from int, to *int)
- func (h *MultipleHandler) HandleHeal(ctx *event.Context, health *float64, src world.HealingSource)
- func (h *MultipleHandler) HandleHurt(ctx *event.Context, damage *float64, attackImmunity *time.Duration, ...)
- func (h *MultipleHandler) HandleItemConsume(ctx *event.Context, item item.Stack)
- func (h *MultipleHandler) HandleItemDamage(ctx *event.Context, i item.Stack, damage int)
- func (h *MultipleHandler) HandleItemDrop(ctx *event.Context, e *entity.Item)
- func (h *MultipleHandler) HandleItemPickup(ctx *event.Context, i item.Stack)
- func (h *MultipleHandler) HandleItemUse(ctx *event.Context)
- func (h *MultipleHandler) HandleItemUseOnBlock(ctx *event.Context, pos cube.Pos, face cube.Face, clickPos mgl64.Vec3)
- func (h *MultipleHandler) HandleItemUseOnEntity(ctx *event.Context, e world.Entity)
- func (h *MultipleHandler) HandleJump()
- func (h *MultipleHandler) HandleMove(ctx *event.Context, newPos mgl64.Vec3, newYaw, newPitch float64)
- func (h *MultipleHandler) HandlePunchAir(ctx *event.Context)
- func (h *MultipleHandler) HandleQuit()
- func (h *MultipleHandler) HandleRespawn(pos *mgl64.Vec3, w **world.World)
- func (h *MultipleHandler) HandleSignEdit(ctx *event.Context, oldText, newText string)
- func (h *MultipleHandler) HandleSkinChange(ctx *event.Context, skin *skin.Skin)
- func (h *MultipleHandler) HandleStartBreak(ctx *event.Context, pos cube.Pos)
- func (h *MultipleHandler) HandleTeleport(ctx *event.Context, pos mgl64.Vec3)
- func (h *MultipleHandler) HandleToggleSneak(ctx *event.Context, after bool)
- func (h *MultipleHandler) HandleToggleSprint(ctx *event.Context, after bool)
- func (h *MultipleHandler) HandleTransfer(ctx *event.Context, 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, 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, pos cube.Pos, drops *[]item.Stack, xp *int) }
type BlockPickHandler ¶
type BlockPlaceHandler ¶
type ChangeWorldHandler ¶
type ChatHandler ¶
type CommandExecutionHandler ¶
type DeathHandler ¶
type DeathHandler interface { // HandleDeath handles the player dying to a particular damage cause. HandleDeath(src world.DamageSource, keepInv *bool) }
type ExperienceGainHandler ¶
type FoodLossHandler ¶
type HealHandler ¶
type HealHandler interface { // HandleHeal handles the player being healed by a healing source. ctx.Cancel() may be called to cancel // the healing. // The health added may be changed by assigning to *health. HandleHeal(ctx *event.Context, health *float64, src world.HealingSource) }
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. HandleHurt(ctx *event.Context, damage *float64, 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, 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, e *entity.Item) }
type ItemPickupHandler ¶
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) }
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, 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, e world.Entity) }
type JumpHandler ¶
type JumpHandler interface {
// HandleJump handles the player jumping.
HandleJump()
}
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(before, after *world.World)
func (*MultipleHandler) HandleChat ¶
func (h *MultipleHandler) HandleChat(ctx *event.Context, message *string)
func (*MultipleHandler) HandleCommandExecution ¶
func (*MultipleHandler) HandleDeath ¶
func (h *MultipleHandler) HandleDeath(src world.DamageSource, keepInv *bool)
func (*MultipleHandler) HandleExperienceGain ¶
func (h *MultipleHandler) HandleExperienceGain(ctx *event.Context, amount *int)
func (*MultipleHandler) HandleFoodLoss ¶
func (h *MultipleHandler) HandleFoodLoss(ctx *event.Context, from int, to *int)
func (*MultipleHandler) HandleHeal ¶
func (h *MultipleHandler) HandleHeal(ctx *event.Context, health *float64, src world.HealingSource)
func (*MultipleHandler) HandleHurt ¶
func (h *MultipleHandler) HandleHurt(ctx *event.Context, damage *float64, attackImmunity *time.Duration, src world.DamageSource)
func (*MultipleHandler) HandleItemConsume ¶
func (h *MultipleHandler) HandleItemConsume(ctx *event.Context, item item.Stack)
func (*MultipleHandler) HandleItemDamage ¶
func (*MultipleHandler) HandleItemDrop ¶
func (h *MultipleHandler) HandleItemDrop(ctx *event.Context, e *entity.Item)
func (*MultipleHandler) HandleItemPickup ¶
func (h *MultipleHandler) HandleItemPickup(ctx *event.Context, i item.Stack)
func (*MultipleHandler) HandleItemUse ¶
func (h *MultipleHandler) HandleItemUse(ctx *event.Context)
func (*MultipleHandler) HandleItemUseOnBlock ¶
func (*MultipleHandler) HandleItemUseOnEntity ¶
func (h *MultipleHandler) HandleItemUseOnEntity(ctx *event.Context, e world.Entity)
func (*MultipleHandler) HandleJump ¶
func (h *MultipleHandler) HandleJump()
func (*MultipleHandler) HandleMove ¶
func (*MultipleHandler) HandlePunchAir ¶
func (h *MultipleHandler) HandlePunchAir(ctx *event.Context)
func (*MultipleHandler) HandleQuit ¶
func (h *MultipleHandler) HandleQuit()
func (*MultipleHandler) HandleRespawn ¶
func (h *MultipleHandler) HandleRespawn(pos *mgl64.Vec3, w **world.World)
func (*MultipleHandler) HandleSignEdit ¶
func (h *MultipleHandler) HandleSignEdit(ctx *event.Context, oldText, newText string)
func (*MultipleHandler) HandleSkinChange ¶
func (h *MultipleHandler) HandleSkinChange(ctx *event.Context, skin *skin.Skin)
func (*MultipleHandler) HandleStartBreak ¶
func (h *MultipleHandler) HandleStartBreak(ctx *event.Context, pos cube.Pos)
func (*MultipleHandler) HandleTeleport ¶
func (h *MultipleHandler) HandleTeleport(ctx *event.Context, pos mgl64.Vec3)
func (*MultipleHandler) HandleToggleSneak ¶
func (h *MultipleHandler) HandleToggleSneak(ctx *event.Context, after bool)
func (*MultipleHandler) HandleToggleSprint ¶
func (h *MultipleHandler) HandleToggleSprint(ctx *event.Context, after bool)
func (*MultipleHandler) HandleTransfer ¶
func (h *MultipleHandler) HandleTransfer(ctx *event.Context, addr *net.UDPAddr)
func (*MultipleHandler) Register ¶
func (h *MultipleHandler) Register(hdr any) func()
type PunchAirHandler ¶
type QuitHandler ¶
type QuitHandler interface { // HandleQuit handles the closing of a player. It is always called when the player is disconnected, // regardless of the reason. HandleQuit() }
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(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, oldText, newText string) }
type SkinChangeHandler ¶
type StartBreakHandler ¶
type TeleportHandler ¶
type ToggleSneakHandler ¶
type ToggleSprintHandler ¶
Click to show internal directories.
Click to hide internal directories.