entity_internal

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jan 4, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CanSolidify func(b world.Block, pos world.BlockPos, w *world.World) bool

CanSolidify is a function used to check if a block affected by gravity can solidify.

Functions

This section is empty.

Types

type HealthManager

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

HealthManager handles the health of an entity.

func NewHealthManager

func NewHealthManager() *HealthManager

NewHealthManager returns a new health manager with a default of 20 health and max health.

func (*HealthManager) AddHealth

func (m *HealthManager) AddHealth(health float64)

AddHealth adds a given amount of health points to the player. If the health added to the current health exceeds the max, health will be set to the max. If the health is instead negative and results in a health lower than 0, the final health will be 0.

func (*HealthManager) Health

func (m *HealthManager) Health() float64

Health returns the current health of an entity.

func (*HealthManager) MaxHealth

func (m *HealthManager) MaxHealth() float64

MaxHealth returns the maximum health of the entity.

func (*HealthManager) SetMaxHealth

func (m *HealthManager) SetMaxHealth(max float64)

SetMaxHealth changes the max health of an entity to the maximum passed. If the maximum is set to 0 or lower, SetMaxHealth will default to a value of 1.

Jump to

Keyboard shortcuts

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