Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Absorption absorption
Absorption is a lasting effect that increases the health of an entity over the maximum. Once this extra health is lost, it will not regenerate.
var Blindness blindness
Blindness is a lasting effect that greatly reduces the vision range of the entity affected.
var ConduitPower conduitPower
ConduitPower is a lasting effect that grants the affected entity the ability to breathe underwater and allows the entity to break faster when underwater or in the rain. (Similarly to haste.)
var Darkness darkness
Darkness is a lasting effect that causes the player's vision to dim occasionally.
var FatalPoison fatalPoison
FatalPoison is a lasting effect that causes the affected entity to lose health gradually. fatalPoison, unlike poison, can kill the entity it is applied to.
var FireResistance fireResistance
FireResistance is a lasting effect that grants immunity to fire & lava damage.
var Haste haste
Haste is a lasting effect that increases the mining speed of a player by 20% for each level of the effect.
var HealthBoost healthBoost
HealthBoost causes the affected entity to have its maximum health changed for a specific duration.
var Hunger hunger
Hunger is a lasting effect that causes an affected player to gradually lose saturation and food.
var InstantDamage instantDamage
InstantDamage is an instant effect that causes a living entity to immediately take some damage, depending on the level and the potency of the effect.
var InstantHealth instantHealth
InstantHealth is an instant effect that causes the player that it is applied to immediately regain some health. The amount of health regained depends on the effect level and potency.
var Invisibility invisibility
Invisibility is a lasting effect that causes the affected entity to turn invisible. While invisible, the entity's armour is still visible and effect particles will still be displayed.
var JumpBoost jumpBoost
JumpBoost is a lasting effect that causes the affected entity to be able to jump much higher, depending on the level of the effect.
var Levitation levitation
Levitation is a lasting effect that causes the affected entity to slowly levitate upwards. It is roughly the opposite of the slowFalling effect.
var MiningFatigue miningFatigue
MiningFatigue is a lasting effect that decreases the mining speed of a player by 10% for each level of the effect.
var Nausea nausea
Nausea is a lasting effect that causes the screen to warp, similarly to when entering a nether portal.
var NightVision nightVision
NightVision is a lasting effect that causes the affected entity to see in dark places as though they were fully lit up.
var Poison poison
Poison is a lasting effect that causes the affected entity to lose health gradually. poison cannot kill, unlike fatalPoison.
var Regeneration regeneration
Regeneration is an effect that causes the entity that it is added to slowly regenerate health. The level of the effect influences the speed with which the entity regenerates.
var Resistance resistance
Resistance is a lasting effect that reduces the damage taken from any sources except for void damage or custom damage.
var Saturation saturation
Saturation is a lasting effect that causes the affected player to regain food and saturation.
var SlowFalling slowFalling
SlowFalling is a lasting effect that causes the affected entity to fall very slowly.
var Slowness slowness
Slowness is a lasting effect that decreases the movement speed of a living entity by 15% for each level that the effect has.
var Speed speed
Speed is a lasting effect that increases the speed of an entity by 20% for each level that the effect has.
var Strength strength
Strength is a lasting effect that increases the damage dealt with melee attacks when applied to an entity.
var WaterBreathing waterBreathing
WaterBreathing is a lasting effect that allows the affected entity to breath underwater until the effect expires.
var Weakness weakness
Weakness is a lasting effect that reduces the damage dealt to other entities with melee attacks.
var Wither wither
Wither is a lasting effect that causes an entity to take continuous damage that is capable of killing an entity.
Functions ¶
func ID ¶
ID attempts to return the ID an effect was registered with. If found, the id is returned and the bool true.
Types ¶
type Effect ¶
type Effect struct {
// contains filtered or unexported fields
}
Effect is an effect that can be added to an entity. Effects are either instant (applying the effect only once) or lasting (applying the effect every tick).
func New ¶ added in v0.3.0
func New(t LastingType, lvl int, d time.Duration) Effect
New creates a new Effect using a LastingType passed. Once added to an entity, the time.Duration passed will be ticked down by the entity until it reaches a duration of 0.
func NewAmbient ¶ added in v0.3.0
func NewAmbient(t LastingType, lvl int, d time.Duration) Effect
NewAmbient creates a new ambient (reduced particles, as when using a beacon) Effect using a LastingType passed. Once added to an entity, the time.Duration passed will be ticked down by the entity until it reaches a duration of 0.
func NewInstant ¶ added in v0.3.0
NewInstant returns a new instant Effect using the Type passed. The effect will be applied to an entity once and will expire immediately after. NewInstant creates an Effect with a potency of 1.0.
func NewInstantWithPotency ¶ added in v0.10.0
NewInstantWithPotency returns a new instant Effect using the Type and level passed. The effect will be applied to an entity once and expire immediately after. The potency passed additionally influences the strength of the effect. A higher potency (> 1.0) increases the effect power, while a lower potency (< 1.0) reduces it.
func (Effect) Ambient ¶ added in v0.3.0
Ambient returns whether the Effect is an ambient effect, leading to reduced particles shown to the client. False is always returned if the Effect was created using New or NewInstant.
func (Effect) Duration ¶
Duration returns the leftover duration of the Effect. The duration returned is always 0 if NewInstant was used to create the effect.
func (Effect) ParticlesHidden ¶ added in v0.3.0
ParticlesHidden returns true if the Effect had its particles hidden by calling WithoutParticles.
func (Effect) Tick ¶ added in v0.10.0
Tick returns the current tick of the Effect. This is the number of ticks that the Effect has been applied for.
func (Effect) TickDuration ¶ added in v0.3.0
TickDuration ticks the effect duration, subtracting time.Second/20 from the leftover time and returning the resulting Effect.
func (Effect) Type ¶ added in v0.3.0
Type returns the underlying type of the Effect. It is either of the type Type or LastingType, depending on whether it was created using New or NewAmbient, or NewInstant.
func (Effect) WithoutParticles ¶ added in v0.3.0
WithoutParticles returns the same Effect with particles disabled. Adding the effect to players will not display the particles around the player.
type InstantDamageSource ¶ added in v0.8.6
type InstantDamageSource struct{}
InstantDamageSource is used for damage caused by an effect.instantDamage applied to an entity.
func (InstantDamageSource) Fire ¶ added in v0.8.6
func (InstantDamageSource) Fire() bool
func (InstantDamageSource) ReducedByArmour ¶ added in v0.8.6
func (InstantDamageSource) ReducedByArmour() bool
func (InstantDamageSource) ReducedByResistance ¶ added in v0.8.6
func (InstantDamageSource) ReducedByResistance() bool
type InstantHealingSource ¶ added in v0.8.6
type InstantHealingSource struct{}
InstantHealingSource is a healing source used when an entity regains health from an effect.instantHealth.
func (InstantHealingSource) HealingSource ¶ added in v0.8.6
func (InstantHealingSource) HealingSource()
type LastingType ¶ added in v0.3.0
type LastingType interface { Type // Start is called for lasting effects when they are initially added. Start(e world.Entity, lvl int) // End is called for lasting effects when they are removed. End(e world.Entity, lvl int) }
LastingType represents an effect type that can have a duration. An effect can be made using it by calling effect.New with the LastingType.
type PoisonDamageSource ¶ added in v0.8.6
type PoisonDamageSource struct { // Fatal specifies if the damage was caused by effect.fatalPoison and if // the damage could therefore kill the entity. Fatal bool }
PoisonDamageSource is used for damage caused by an effect.poison or effect.fatalPoison applied to an entity.
func (PoisonDamageSource) Fire ¶ added in v0.8.6
func (PoisonDamageSource) Fire() bool
func (PoisonDamageSource) ReducedByArmour ¶ added in v0.8.6
func (PoisonDamageSource) ReducedByArmour() bool
func (PoisonDamageSource) ReducedByResistance ¶ added in v0.8.6
func (PoisonDamageSource) ReducedByResistance() bool
type RegenerationHealingSource ¶ added in v0.8.6
type RegenerationHealingSource struct{}
RegenerationHealingSource is a healing source used when an entity regenerates health from an effect.regeneration.
func (RegenerationHealingSource) HealingSource ¶ added in v0.8.6
func (RegenerationHealingSource) HealingSource()
type Type ¶ added in v0.3.0
type Type interface { // RGBA returns the colour of the effect. If multiple effects are present, // the colours will be mixed together to form a new colour. RGBA() color.RGBA // Apply applies the effect to an entity. Apply is called only once for // instant effects, such as instantHealth, while it is called every tick for // lasting effects. The Effect holding the Type is passed along with the // current tick. Apply(e world.Entity, eff Effect) }
Type is an effect implementation that can be applied to an entity.
type WitherDamageSource ¶ added in v0.8.6
type WitherDamageSource struct{}
WitherDamageSource is used for damage caused by an effect.wither applied to an entity.
func (WitherDamageSource) Fire ¶ added in v0.8.6
func (WitherDamageSource) Fire() bool
func (WitherDamageSource) ReducedByArmour ¶ added in v0.8.6
func (WitherDamageSource) ReducedByArmour() bool
func (WitherDamageSource) ReducedByResistance ¶ added in v0.8.6
func (WitherDamageSource) ReducedByResistance() bool
Source Files ¶
- absorption.go
- blindness.go
- conduit_power.go
- darkness.go
- effect.go
- fatal_poison.go
- fire_resistance.go
- haste.go
- health_boost.go
- hunger.go
- instant_damage.go
- instant_health.go
- invisibility.go
- jump_boost.go
- levitation.go
- mining_fatigue.go
- nausea.go
- night_vision.go
- poison.go
- regeneration.go
- register.go
- resistance.go
- saturation.go
- slow_falling.go
- slowness.go
- speed.go
- strength.go
- water_breathing.go
- weakness.go
- wither.go