Documentation
¶
Index ¶
- func DirectionVector(e world.Entity) mgl64.Vec3
- func EyePosition(e world.Entity) mgl64.Vec3
- func Facing(e world.Entity) world.Direction
- func TargetBlock(e world.Entity, maxDistance float64) world.BlockPos
- type Eyed
- type Item
- func (it *Item) AABB() physics.AABB
- func (it *Item) Close() error
- func (it *Item) Item() item.Stack
- func (c Item) OnGround() bool
- func (it *Item) Pitch() float64
- func (it *Item) Position() mgl64.Vec3
- func (it *Item) SetVelocity(v mgl64.Vec3)
- func (it *Item) State() []state.State
- func (it *Item) Tick()
- func (it *Item) Velocity() mgl64.Vec3
- func (it *Item) World() *world.World
- func (it *Item) Yaw() float64
- type Living
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirectionVector ¶
DirectionVector returns a vector that describes the direction of the entity passed. The length of the Vec3 returned is always 1.
func EyePosition ¶
EyePosition returns the position of the eyes of the entity if the entity implements entity.Eyed, or the actual position if it doesn't.
func TargetBlock ¶
TargetBlock finds the target block of the entity passed. The block position returned will be at most maxDistance away from the entity. If no block can be found there, the block position returned will be that of an air block.
Types ¶
type Eyed ¶
type Eyed interface {
// EyeHeight returns the offset from their base position that the eyes of an entity are found at.
EyeHeight() float64
}
Eyed represents an entity that has eyes.
type Item ¶
type Item struct {
// contains filtered or unexported fields
}
Item represents an item entity which may be added to the world. Players and several humanoid entities such as zombies are able to pick up these entities so that the items are added to their inventory.
func NewItem ¶
NewItem creates a new item entity using the item stack passed. The item entity will be positioned at the position passed. If the stack's count exceeds its max count, the count of the stack will be changed to the maximum.
func (Item) OnGround ¶
func (c Item) OnGround() bool
OnGround checks if the entity that this computer calculates is currently on the ground.
func (*Item) SetVelocity ¶
SetVelocity sets the velocity of the item entity. The values in the Vec3 passed represent the speed on that axis in blocks/tick.
func (*Item) Velocity ¶
Velocity returns the current velocity of the item. The values in the Vec3 returned represent the speed on that axis in blocks/tick.
type Living ¶
type Living interface {
// Health returns the health of the entity.
Health() float64
// AttackImmune checks if the entity is currently immune to entity attacks. Entities typically turn
// immune for half a second after being attacked.
AttackImmune() bool
// Hurt hurts the entity for a given amount of damage. The source passed represents the cause of the
// damage, for example damage.SourceEntityAttack if the entity is attacked by another entity.
// If the final damage exceeds the health that the player currently has, the entity is killed.
Hurt(damage float64, source damage.Source)
// KnockBack knocks the entity back with a given force and height. A source is passed which indicates the
// source of the velocity, typically the position of an attacking entity. The source is used to calculate
// the direction which the entity should be knocked back in.
KnockBack(src mgl64.Vec3, force, height float64)
}
Living represents an entity that is alive and that has health. It is able to take damage and will die upon taking fatal damage.