self

package
v0.0.0-...-9f1c46f Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 16, 2026 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ModuleName = "self"
	EyeHeight  = 1.62
)

Variables

This section is empty.

Functions

func WorldPosToYawPitch

func WorldPosToYawPitch(x, y, z, lookX, lookY, lookZ float64) (yaw, pitch float64)

WorldPosToYawPitch calculates yaw and pitch to look from (x,y,z) at (lookX,lookY,lookZ). MC yaw: 0=south(+Z), 90=west(-X), 180=north(-Z), 270=east(+X).

Types

type Attribute

type Attribute struct {
	Base      float64
	Modifiers []AttributeModifier
}

Attribute represents a tracked entity attribute.

type AttributeModifier

type AttributeModifier struct {
	ID        string // resource identifier (e.g., "minecraft:effect.speed")
	Amount    float64
	Operation int32 // 0=add_value, 1=add_multiplied_base, 2=add_multiplied_total
}

AttributeModifier represents a modifier applied to a base attribute.

type EffectInstance

type EffectInstance struct {
	ID        int32 // protocol effect ID (registries.MobEffect)
	Amplifier int32 // 0 = Level I, 1 = Level II, etc.
	Duration  int32 // ticks remaining (-1 = infinite)
}

EffectInstance represents an active potion effect on the player.

type Module

type Module struct {
	// contains filtered or unexported fields
}

func From

func From(c *client.Client) *Module

From retrieves the self module from a client.

func New

func New() *Module

func (*Module) AbilityFlags

func (m *Module) AbilityFlags() int8

func (*Module) AttributeValue

func (m *Module) AttributeValue(name string, fallback float64) float64

AttributeValue returns the effective value of the named attribute, applying all modifiers in vanilla order. Returns the fallback if not tracked.

func (*Module) AutoRespawn

func (m *Module) AutoRespawn() bool

func (*Module) DeathLocation

func (m *Module) DeathLocation() ns.PrefixedOptional[ns.GlobalPos]

func (*Module) Difficulty

func (m *Module) Difficulty() uint8

func (*Module) DifficultyLocked

func (m *Module) DifficultyLocked() bool

func (*Module) DimensionName

func (m *Module) DimensionName() string

func (*Module) DimensionNames

func (m *Module) DimensionNames() []string

func (*Module) DimensionType

func (m *Module) DimensionType() int32

func (*Module) DoLimitedCrafting

func (m *Module) DoLimitedCrafting() bool

func (*Module) Eat

func (m *Module) Eat(foodItemIDs []int32) error

Eat finds a food item from the given list, holds it, and eats it. Blocks until the food level changes or times out.

func (*Module) EffectAmplifier

func (m *Module) EffectAmplifier(effectID int32) int32

EffectAmplifier returns the amplifier of the given effect, or -1 if not active.

func (*Module) EnableRespawnScreen

func (m *Module) EnableRespawnScreen() bool

func (*Module) EnforcesSecureChat

func (m *Module) EnforcesSecureChat() bool

func (*Module) EntityID

func (m *Module) EntityID() int32

func (*Module) ExperienceBar

func (m *Module) ExperienceBar() float32

func (*Module) FOVModifier

func (m *Module) FOVModifier() float32

func (*Module) FlyingSpeed

func (m *Module) FlyingSpeed() float32

func (*Module) Food

func (m *Module) Food() int32

func (*Module) FoodSaturation

func (m *Module) FoodSaturation() float32

func (*Module) Gamemode

func (m *Module) Gamemode() uint8

func (*Module) HandlePacket

func (m *Module) HandlePacket(pkt *jp.WirePacket)

func (*Module) HasEffect

func (m *Module) HasEffect(effectID int32) bool

HasEffect returns whether the player has the given effect active.

func (*Module) HashedSeed

func (m *Module) HashedSeed() int64

func (*Module) Health

func (m *Module) Health() float32

func (*Module) Init

func (m *Module) Init(c *client.Client)

func (*Module) IsDead

func (m *Module) IsDead() bool

func (*Module) IsDebug

func (m *Module) IsDebug() bool

func (*Module) IsFlat

func (m *Module) IsFlat() bool

func (*Module) IsHardcore

func (m *Module) IsHardcore() bool

func (*Module) Level

func (m *Module) Level() int32

func (*Module) LookAt

func (m *Module) LookAt(x, y, z float64)

LookAt sets yaw/pitch to face the given world position.

func (*Module) MaxPlayers

func (m *Module) MaxPlayers() int32

func (*Module) Move

func (m *Module) Move(x, y, z float64, onGround, pushingAgainstWall bool) error

func (*Module) MoveRelative

func (m *Module) MoveRelative(dx, dy, dz float64, onGround, pushingAgainstWall bool) error

func (*Module) Name

func (m *Module) Name() string

func (*Module) OnAbilitiesChange

func (m *Module) OnAbilitiesChange(cb func(flags int8, flySpeed, fovMod float32))

func (*Module) OnAttributeUpdate

func (m *Module) OnAttributeUpdate(cb func(name string, value float64))

func (*Module) OnDeath

func (m *Module) OnDeath(cb func())

func (*Module) OnDifficultyChange

func (m *Module) OnDifficultyChange(cb func(difficulty uint8, locked bool))

func (*Module) OnDimensionChange

func (m *Module) OnDimensionChange(cb func(dimensionName string))

func (*Module) OnEffectAdded

func (m *Module) OnEffectAdded(cb func(effectID, amplifier, duration int32))

func (*Module) OnEffectRemoved

func (m *Module) OnEffectRemoved(cb func(effectID int32))

func (*Module) OnExperienceChange

func (m *Module) OnExperienceChange(cb func(bar float32, level, total int32))

func (*Module) OnGameEvent

func (m *Module) OnGameEvent(cb func(event uint8, value float32))

func (*Module) OnGamemodeChange

func (m *Module) OnGamemodeChange(cb func(gamemode uint8))

func (*Module) OnHealthSet

func (m *Module) OnHealthSet(cb func(health, food float32))

func (*Module) OnPosition

func (m *Module) OnPosition(cb func(x, y, z float64))

func (*Module) OnRespawn

func (m *Module) OnRespawn(cb func())

func (*Module) OnSpawn

func (m *Module) OnSpawn(cb func())

func (*Module) OnTimeUpdate

func (m *Module) OnTimeUpdate(cb func(worldAge, timeOfDay int64))

func (*Module) OpLevel

func (m *Module) OpLevel() int8

func (*Module) PortalCooldown

func (m *Module) PortalCooldown() int32

func (*Module) Position

func (m *Module) Position() (x, y, z float64)

func (*Module) PreviousGameMode

func (m *Module) PreviousGameMode() int8

func (*Module) ReducedDebugInfo

func (m *Module) ReducedDebugInfo() bool

func (*Module) Reset

func (m *Module) Reset()

func (*Module) Respawn

func (m *Module) Respawn() error

func (*Module) Rotate

func (m *Module) Rotate(deltaYaw, deltaPitch float64)

func (*Module) Rotation

func (m *Module) Rotation() (yaw, pitch float32)

func (*Module) SeaLevel

func (m *Module) SeaLevel() int32

func (*Module) SetAutoRespawn

func (m *Module) SetAutoRespawn(v bool)

func (*Module) SetPosition

func (m *Module) SetPosition(x, y, z float64)

SetPosition updates the player's position directly (used by physics module).

func (*Module) SetRotation

func (m *Module) SetRotation(yaw, pitch float64)

SetRotation updates yaw and pitch.

func (*Module) SetSneaking

func (m *Module) SetSneaking(v bool)

func (*Module) SetSprinting

func (m *Module) SetSprinting(v bool)

func (*Module) SetSuppressPositionEcho

func (m *Module) SetSuppressPositionEcho(v bool)

func (*Module) SimulationDistance

func (m *Module) SimulationDistance() int32

func (*Module) Sneaking

func (m *Module) Sneaking() bool

func (*Module) SpawnPoint

func (m *Module) SpawnPoint() (dim string, pos ns.Position, yaw, pitch float32)

func (*Module) Sprinting

func (m *Module) Sprinting() bool

func (*Module) SuppressPositionEcho

func (m *Module) SuppressPositionEcho() bool

func (*Module) TickEffects

func (m *Module) TickEffects()

TickEffects decrements durations and removes expired effects. Matches vanilla MobEffectInstance.tickClient. Called once per tick by the physics module.

func (*Module) TimeIncreasing

func (m *Module) TimeIncreasing() bool

func (*Module) TimeOfDay

func (m *Module) TimeOfDay() int64

func (*Module) TotalExperience

func (m *Module) TotalExperience() int32

func (*Module) Use

func (m *Module) Use(hand int8) error

func (*Module) UseAt

func (m *Module) UseAt(hand int8, yaw, pitch float64) error

func (*Module) ViewDistance

func (m *Module) ViewDistance() int32

func (*Module) WorldAge

func (m *Module) WorldAge() int64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL