Documentation
¶
Index ¶
- Constants
- func WorldPosToYawPitch(x, y, z, lookX, lookY, lookZ float64) (yaw, pitch float64)
- type Attribute
- type AttributeModifier
- type EffectInstance
- type Module
- func (m *Module) AbilityFlags() int8
- func (m *Module) AttributeValue(name string, fallback float64) float64
- func (m *Module) AutoRespawn() bool
- func (m *Module) DeathLocation() ns.PrefixedOptional[ns.GlobalPos]
- func (m *Module) Difficulty() uint8
- func (m *Module) DifficultyLocked() bool
- func (m *Module) DimensionName() string
- func (m *Module) DimensionNames() []string
- func (m *Module) DimensionType() int32
- func (m *Module) DoLimitedCrafting() bool
- func (m *Module) Eat(foodItemIDs []int32) error
- func (m *Module) EffectAmplifier(effectID int32) int32
- func (m *Module) EnableRespawnScreen() bool
- func (m *Module) EnforcesSecureChat() bool
- func (m *Module) EntityID() int32
- func (m *Module) ExperienceBar() float32
- func (m *Module) FOVModifier() float32
- func (m *Module) FlyingSpeed() float32
- func (m *Module) Food() int32
- func (m *Module) FoodSaturation() float32
- func (m *Module) Gamemode() uint8
- func (m *Module) HandlePacket(pkt *jp.WirePacket)
- func (m *Module) HasEffect(effectID int32) bool
- func (m *Module) HashedSeed() int64
- func (m *Module) Health() float32
- func (m *Module) Init(c *client.Client)
- func (m *Module) IsDead() bool
- func (m *Module) IsDebug() bool
- func (m *Module) IsFlat() bool
- func (m *Module) IsHardcore() bool
- func (m *Module) Level() int32
- func (m *Module) LookAt(x, y, z float64)
- func (m *Module) MaxPlayers() int32
- func (m *Module) Move(x, y, z float64, onGround, pushingAgainstWall bool) error
- func (m *Module) MoveRelative(dx, dy, dz float64, onGround, pushingAgainstWall bool) error
- func (m *Module) Name() string
- func (m *Module) OnAbilitiesChange(cb func(flags int8, flySpeed, fovMod float32))
- func (m *Module) OnAttributeUpdate(cb func(name string, value float64))
- func (m *Module) OnDeath(cb func())
- func (m *Module) OnDifficultyChange(cb func(difficulty uint8, locked bool))
- func (m *Module) OnDimensionChange(cb func(dimensionName string))
- func (m *Module) OnEffectAdded(cb func(effectID, amplifier, duration int32))
- func (m *Module) OnEffectRemoved(cb func(effectID int32))
- func (m *Module) OnExperienceChange(cb func(bar float32, level, total int32))
- func (m *Module) OnGameEvent(cb func(event uint8, value float32))
- func (m *Module) OnGamemodeChange(cb func(gamemode uint8))
- func (m *Module) OnHealthSet(cb func(health, food float32))
- func (m *Module) OnPosition(cb func(x, y, z float64))
- func (m *Module) OnRespawn(cb func())
- func (m *Module) OnSpawn(cb func())
- func (m *Module) OnTimeUpdate(cb func(worldAge, timeOfDay int64))
- func (m *Module) OpLevel() int8
- func (m *Module) PortalCooldown() int32
- func (m *Module) Position() (x, y, z float64)
- func (m *Module) PreviousGameMode() int8
- func (m *Module) ReducedDebugInfo() bool
- func (m *Module) Reset()
- func (m *Module) Respawn() error
- func (m *Module) Rotate(deltaYaw, deltaPitch float64)
- func (m *Module) Rotation() (yaw, pitch float32)
- func (m *Module) SeaLevel() int32
- func (m *Module) SetAutoRespawn(v bool)
- func (m *Module) SetPosition(x, y, z float64)
- func (m *Module) SetRotation(yaw, pitch float64)
- func (m *Module) SetSneaking(v bool)
- func (m *Module) SetSprinting(v bool)
- func (m *Module) SetSuppressPositionEcho(v bool)
- func (m *Module) SimulationDistance() int32
- func (m *Module) Sneaking() bool
- func (m *Module) SpawnPoint() (dim string, pos ns.Position, yaw, pitch float32)
- func (m *Module) Sprinting() bool
- func (m *Module) SuppressPositionEcho() bool
- func (m *Module) TickEffects()
- func (m *Module) TimeIncreasing() bool
- func (m *Module) TimeOfDay() int64
- func (m *Module) TotalExperience() int32
- func (m *Module) Use(hand int8) error
- func (m *Module) UseAt(hand int8, yaw, pitch float64) error
- func (m *Module) ViewDistance() int32
- func (m *Module) WorldAge() int64
Constants ¶
const ( ModuleName = "self" EyeHeight = 1.62 )
Variables ¶
This section is empty.
Functions ¶
func WorldPosToYawPitch ¶
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 (*Module) AbilityFlags ¶
func (*Module) AttributeValue ¶
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 (*Module) DeathLocation ¶
func (m *Module) DeathLocation() ns.PrefixedOptional[ns.GlobalPos]
func (*Module) Difficulty ¶
func (*Module) DifficultyLocked ¶
func (*Module) DimensionName ¶
func (*Module) DimensionNames ¶
func (*Module) DimensionType ¶
func (*Module) DoLimitedCrafting ¶
func (*Module) Eat ¶
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 ¶
EffectAmplifier returns the amplifier of the given effect, or -1 if not active.
func (*Module) EnableRespawnScreen ¶
func (*Module) EnforcesSecureChat ¶
func (*Module) ExperienceBar ¶
func (*Module) FOVModifier ¶
func (*Module) FlyingSpeed ¶
func (*Module) FoodSaturation ¶
func (*Module) HandlePacket ¶
func (m *Module) HandlePacket(pkt *jp.WirePacket)
func (*Module) HashedSeed ¶
func (*Module) IsHardcore ¶
func (*Module) MaxPlayers ¶
func (*Module) MoveRelative ¶
func (*Module) OnAbilitiesChange ¶
func (*Module) OnAttributeUpdate ¶
func (*Module) OnDifficultyChange ¶
func (*Module) OnDimensionChange ¶
func (*Module) OnEffectAdded ¶
func (*Module) OnEffectRemoved ¶
func (*Module) OnExperienceChange ¶
func (*Module) OnGameEvent ¶
func (*Module) OnGamemodeChange ¶
func (*Module) OnHealthSet ¶
func (*Module) OnPosition ¶
func (*Module) OnTimeUpdate ¶
func (*Module) PortalCooldown ¶
func (*Module) PreviousGameMode ¶
func (*Module) ReducedDebugInfo ¶
func (*Module) SetAutoRespawn ¶
func (*Module) SetPosition ¶
SetPosition updates the player's position directly (used by physics module).
func (*Module) SetRotation ¶
SetRotation updates yaw and pitch.
func (*Module) SetSneaking ¶
func (*Module) SetSprinting ¶
func (*Module) SetSuppressPositionEcho ¶
func (*Module) SimulationDistance ¶
func (*Module) SpawnPoint ¶
func (*Module) SuppressPositionEcho ¶
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.