damage

package
v0.8.5 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2022 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Source

type Source interface {
	// ReducedByArmour checks if the source of damage may be reduced if the receiver of the damage is wearing
	// armour.
	ReducedByArmour() bool
	// ReducedByResistance specifies if the Source is affected by the resistance effect. If false, damage dealt
	// to an entity with this source will not be lowered if the entity has the resistance effect.
	ReducedByResistance() bool
	// Fire specifies if the Source is fire related and should be ignored when an entity has the fire resistance
	// effect.
	Fire() bool
}

Source represents the source of the damage dealt to an entity. This source may be passed to the Hurt() method of an entity in order to deal damage to an entity with a specific source.

type SourceBlock added in v0.7.3

type SourceBlock struct {
	// Block is the block that caused the damage.
	Block world.Block
}

SourceBlock is used for damage caused by a block, such as an anvil.

func (SourceBlock) Fire added in v0.8.4

func (SourceBlock) Fire() bool

func (SourceBlock) ReducedByArmour added in v0.7.3

func (SourceBlock) ReducedByArmour() bool

func (SourceBlock) ReducedByResistance added in v0.7.3

func (SourceBlock) ReducedByResistance() bool

type SourceDrowning added in v0.7.3

type SourceDrowning struct{}

SourceDrowning is used for damage caused by an entity drowning in water.

func (SourceDrowning) Fire added in v0.8.4

func (SourceDrowning) Fire() bool

func (SourceDrowning) ReducedByArmour added in v0.7.3

func (SourceDrowning) ReducedByArmour() bool

func (SourceDrowning) ReducedByResistance added in v0.7.3

func (SourceDrowning) ReducedByResistance() bool

type SourceEntityAttack

type SourceEntityAttack struct {
	// Attacker holds the attacking entity. The entity may be a player or any other entity.
	Attacker world.Entity
}

SourceEntityAttack is used for damage caused by other entities, for example when a player attacks another player.

func (SourceEntityAttack) Fire added in v0.8.4

func (SourceEntityAttack) Fire() bool

func (SourceEntityAttack) ReducedByArmour

func (SourceEntityAttack) ReducedByArmour() bool

func (SourceEntityAttack) ReducedByResistance added in v0.7.0

func (SourceEntityAttack) ReducedByResistance() bool

type SourceExplosion added in v0.8.0

type SourceExplosion struct{}

SourceExplosion is used for damage caused by an explosion.

func (SourceExplosion) Fire added in v0.8.4

func (SourceExplosion) Fire() bool

func (SourceExplosion) ReducedByArmour added in v0.8.0

func (SourceExplosion) ReducedByArmour() bool

func (SourceExplosion) ReducedByResistance added in v0.8.0

func (SourceExplosion) ReducedByResistance() bool

type SourceFall

type SourceFall struct{}

SourceFall is used for damage caused by falling.

func (SourceFall) Fire added in v0.8.4

func (SourceFall) Fire() bool

func (SourceFall) ReducedByArmour

func (SourceFall) ReducedByArmour() bool

func (SourceFall) ReducedByResistance added in v0.7.0

func (SourceFall) ReducedByResistance() bool

type SourceFire

type SourceFire struct{}

SourceFire is used for damage caused by being in fire.

func (SourceFire) Fire added in v0.8.4

func (SourceFire) Fire() bool

func (SourceFire) ReducedByArmour

func (SourceFire) ReducedByArmour() bool

func (SourceFire) ReducedByResistance added in v0.7.0

func (SourceFire) ReducedByResistance() bool

type SourceGlide added in v0.8.0

type SourceGlide struct{}

SourceGlide is used for damage caused by gliding into a block.

func (SourceGlide) Fire added in v0.8.4

func (SourceGlide) Fire() bool

func (SourceGlide) ReducedByArmour added in v0.8.0

func (SourceGlide) ReducedByArmour() bool

func (SourceGlide) ReducedByResistance added in v0.8.0

func (SourceGlide) ReducedByResistance() bool

type SourceInstantDamageEffect

type SourceInstantDamageEffect struct{}

SourceInstantDamageEffect is used for damage caused by an effect.InstantDamage applied to an entity.

func (SourceInstantDamageEffect) Fire added in v0.8.4

func (SourceInstantDamageEffect) ReducedByArmour

func (SourceInstantDamageEffect) ReducedByArmour() bool

func (SourceInstantDamageEffect) ReducedByResistance added in v0.7.0

func (SourceInstantDamageEffect) ReducedByResistance() bool

type SourceLava

type SourceLava struct{}

SourceLava is used for damage caused by being in lava.

func (SourceLava) Fire added in v0.8.4

func (SourceLava) Fire() bool

func (SourceLava) ReducedByArmour

func (SourceLava) ReducedByArmour() bool

func (SourceLava) ReducedByResistance added in v0.7.0

func (SourceLava) ReducedByResistance() bool

type SourceLightning added in v0.3.0

type SourceLightning struct{}

SourceLightning is used for damage caused by being struck by lightning.

func (SourceLightning) Fire added in v0.8.4

func (SourceLightning) Fire() bool

func (SourceLightning) ReducedByArmour added in v0.3.0

func (SourceLightning) ReducedByArmour() bool

func (SourceLightning) ReducedByResistance added in v0.7.0

func (SourceLightning) ReducedByResistance() bool

type SourcePoisonEffect

type SourcePoisonEffect struct {
	// Fatal specifies if the damage was caused by effect.FatalPoison or not.
	Fatal bool
}

SourcePoisonEffect is used for damage caused by an effect.Poison or effect.FatalPoison applied to an entity.

func (SourcePoisonEffect) Fire added in v0.8.4

func (SourcePoisonEffect) Fire() bool

func (SourcePoisonEffect) ReducedByArmour

func (SourcePoisonEffect) ReducedByArmour() bool

func (SourcePoisonEffect) ReducedByResistance added in v0.7.0

func (SourcePoisonEffect) ReducedByResistance() bool

type SourceProjectile added in v0.6.0

type SourceProjectile struct {
	// Projectile and Owner are the world.Entity that dealt the damage and the one that fired the projectile
	// respectively.
	Projectile, Owner world.Entity
}

SourceProjectile is used for damage caused by a projectile.

func (SourceProjectile) Fire added in v0.8.4

func (SourceProjectile) Fire() bool

func (SourceProjectile) ReducedByArmour added in v0.6.0

func (SourceProjectile) ReducedByArmour() bool

func (SourceProjectile) ReducedByResistance added in v0.7.0

func (SourceProjectile) ReducedByResistance() bool

type SourceStarvation

type SourceStarvation struct{}

SourceStarvation is used for damage caused by a completely depleted food bar.

func (SourceStarvation) Fire added in v0.8.4

func (SourceStarvation) Fire() bool

func (SourceStarvation) ReducedByArmour

func (SourceStarvation) ReducedByArmour() bool

func (SourceStarvation) ReducedByResistance added in v0.7.0

func (SourceStarvation) ReducedByResistance() bool

type SourceSuffocation added in v0.7.3

type SourceSuffocation struct{}

SourceSuffocation is used for damage caused by an entity suffocating in a block.

func (SourceSuffocation) Fire added in v0.8.4

func (SourceSuffocation) Fire() bool

func (SourceSuffocation) ReducedByArmour added in v0.7.3

func (SourceSuffocation) ReducedByArmour() bool

func (SourceSuffocation) ReducedByResistance added in v0.7.3

func (SourceSuffocation) ReducedByResistance() bool

type SourceThorns added in v0.8.0

type SourceThorns struct {
	// Owner holds the entity wearing the thorns armour.
	Owner world.Entity
}

SourceThorns is used for damage caused by thorns.

func (SourceThorns) Fire added in v0.8.4

func (SourceThorns) Fire() bool

func (SourceThorns) ReducedByArmour added in v0.8.0

func (SourceThorns) ReducedByArmour() bool

func (SourceThorns) ReducedByResistance added in v0.8.0

func (SourceThorns) ReducedByResistance() bool

type SourceVoid

type SourceVoid struct{}

SourceVoid is used for damage caused by an entity being in the void.

func (SourceVoid) Fire added in v0.8.4

func (SourceVoid) Fire() bool

func (SourceVoid) ReducedByArmour

func (SourceVoid) ReducedByArmour() bool

func (SourceVoid) ReducedByResistance added in v0.7.0

func (SourceVoid) ReducedByResistance() bool

type SourceWitherEffect

type SourceWitherEffect struct{}

SourceWitherEffect is used for damage caused by an effect.Wither applied to an entity.

func (SourceWitherEffect) Fire added in v0.8.4

func (SourceWitherEffect) Fire() bool

func (SourceWitherEffect) ReducedByArmour

func (SourceWitherEffect) ReducedByArmour() bool

func (SourceWitherEffect) ReducedByResistance added in v0.7.0

func (SourceWitherEffect) ReducedByResistance() bool

Jump to

Keyboard shortcuts

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