entity

package
v0.0.0-...-ed75f63 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2025 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultAttributes = map[string]float64{
	"minecraft:generic.armor":                     0,
	"minecraft:generic.armor_toughness":           0,
	"minecraft:generic.attack_damage":             2,
	"minecraft:generic.attack_knockback":          0,
	"minecraft:generic.attack_speed":              2,
	"minecraft:generic.block_break_speed":         1,
	"minecraft:generic.block_interaction_range":   4.5,
	"minecraft:generic.entity_interaction_range":  3,
	"minecraft:generic.fall_damage_multiplier":    1,
	"minecraft:generic.flying_speed":              0.4,
	"minecraft:generic.follow_range":              32,
	"minecraft:generic.gravity":                   0.08,
	"minecraft:generic.jump_strength":             0.42,
	"minecraft:generic.knockback_resistance":      0,
	"minecraft:generic.luck":                      0,
	"minecraft:generic.max_absorption":            0,
	"minecraft:generic.max_health":                20,
	"minecraft:generic.movement_speed":            0.7,
	"minecraft:generic.safe_fall_distance":        3,
	"minecraft:generic.scale":                     1,
	"minecraft:zombie.spawn_reinforcements":       0,
	"minecraft:generic.step_height":               0.6,
	"minecraft:generic.submerged_mining_speed":    0.2,
	"minecraft:generic.sweeping_damage_ratio":     0,
	"minecraft:generic.water_movement_efficiency": 0,
}

Functions

func NewEntityId

func NewEntityId() int32

Types

type Attribute

type Attribute struct {
	Base float64 `nbt:"base"`
	Id   string  `nbt:"id"`
}

type Entity

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

Entity is the base state for entities

func New

func New(uuid uuid.UUID, typ int32, metadata metadata.Metadata, attributes []Attribute) *Entity

func (*Entity) Attribute

func (p *Entity) Attribute(id string) *Attribute

func (*Entity) Attributes

func (p *Entity) Attributes() []Attribute

Attributes returns a clone of the attributes of this state

func (*Entity) DimensionName

func (p *Entity) DimensionName() string

func (*Entity) Metadata

func (p *Entity) Metadata() metadata.Metadata

Metadata returns a clone of the metadata of this state

func (*Entity) MetadataIndex

func (p *Entity) MetadataIndex(i byte) any

func (*Entity) Motion

func (p *Entity) Motion() (vx, vy, vz float64)

func (*Entity) OnGround

func (p *Entity) OnGround() bool

func (*Entity) Position

func (p *Entity) Position() (x, y, z float64)

func (*Entity) Rotation

func (p *Entity) Rotation() (yaw, pitch float32)

func (*Entity) SetAttribute

func (p *Entity) SetAttribute(id string, base float64)

func (*Entity) SetDimensionName

func (p *Entity) SetDimensionName(v string)

func (*Entity) SetMetadata

func (p *Entity) SetMetadata(md metadata.Metadata)

func (*Entity) SetMetadataIndex

func (p *Entity) SetMetadataIndex(i byte, v any)

func (*Entity) SetMetadataIndexes

func (p *Entity) SetMetadataIndexes(md metadata.Metadata)

func (*Entity) SetMotion

func (p *Entity) SetMotion(x, y, z float64)

func (*Entity) SetOnGround

func (p *Entity) SetOnGround(v bool)

func (*Entity) SetPosition

func (p *Entity) SetPosition(x, y, z float64)

func (*Entity) SetRotation

func (p *Entity) SetRotation(yaw, pitch float32)

func (*Entity) Type

func (p *Entity) Type() int32

func (*Entity) UUID

func (p *Entity) UUID() uuid.UUID

type LevelEntity

type LevelEntity struct {
	Air int16

	CustomName        string
	CustomNameVisible bool

	FallDistance  float32
	Fire          int16
	Glowing       bool
	HasVisualFire bool

	Id string `nbt:"id"`

	Invulnerable bool

	Motion     [3]float64
	NoGravity  bool
	OnGround   bool
	Passengers []Entity

	PortalCooldown int32
	Pos            [3]float64
	Rotation       [2]float32

	Silent      bool `nbt:"Silent,omitempty"`
	Tags        []string
	TicksFrozen int32 `nbt:"TicksFrozen,omitempty"`
	UUID        uuid.UUID
}

type LivingEntity

type LivingEntity struct {
	Entity
	// contains filtered or unexported fields
}

func NewLiving

func NewLiving(e *Entity) LivingEntity

func (*LivingEntity) Food

func (l *LivingEntity) Food() (food int32, saturation, exhaustion float32)

func (*LivingEntity) Health

func (l *LivingEntity) Health() float32

func (*LivingEntity) SetFood

func (l *LivingEntity) SetFood(food int32, saturation, exhaustion float32)

func (*LivingEntity) SetHealth

func (l *LivingEntity) SetHealth(h float32)

Jump to

Keyboard shortcuts

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