Documentation ¶
Index ¶
- func ProtectionFactor(src world.DamageSource, enchantments []item.Enchantment) float64
- type AffectedDamageSource
- type AquaAffinity
- type BlastProtection
- func (BlastProtection) CompatibleWithEnchantment(t item.EnchantmentType) bool
- func (BlastProtection) CompatibleWithItem(i world.Item) bool
- func (BlastProtection) Cost(level int) (int, int)
- func (BlastProtection) MaxLevel() int
- func (BlastProtection) Modifier() float64
- func (BlastProtection) Name() string
- func (BlastProtection) Rarity() item.EnchantmentRarity
- type CurseOfVanishing
- func (CurseOfVanishing) CompatibleWithEnchantment(t item.EnchantmentType) bool
- func (CurseOfVanishing) CompatibleWithItem(i world.Item) bool
- func (CurseOfVanishing) Cost(int) (int, int)
- func (CurseOfVanishing) Curse() bool
- func (CurseOfVanishing) MaxLevel() int
- func (CurseOfVanishing) Name() string
- func (CurseOfVanishing) Rarity() item.EnchantmentRarity
- func (CurseOfVanishing) Treasure() bool
- type DamageModifier
- type DepthStrider
- type Efficiency
- func (Efficiency) Addend(level int) float64
- func (Efficiency) CompatibleWithEnchantment(item.EnchantmentType) bool
- func (Efficiency) CompatibleWithItem(i world.Item) bool
- func (Efficiency) Cost(level int) (int, int)
- func (Efficiency) MaxLevel() int
- func (Efficiency) Name() string
- func (Efficiency) Rarity() item.EnchantmentRarity
- type FeatherFalling
- func (FeatherFalling) CompatibleWithEnchantment(item.EnchantmentType) bool
- func (FeatherFalling) CompatibleWithItem(i world.Item) bool
- func (FeatherFalling) Cost(level int) (int, int)
- func (FeatherFalling) MaxLevel() int
- func (FeatherFalling) Modifier() float64
- func (FeatherFalling) Name() string
- func (FeatherFalling) Rarity() item.EnchantmentRarity
- type FireAspect
- func (FireAspect) CompatibleWithEnchantment(item.EnchantmentType) bool
- func (FireAspect) CompatibleWithItem(i world.Item) bool
- func (FireAspect) Cost(level int) (int, int)
- func (FireAspect) Duration(level int) time.Duration
- func (FireAspect) MaxLevel() int
- func (FireAspect) Name() string
- func (FireAspect) Rarity() item.EnchantmentRarity
- type FireProtection
- func (FireProtection) CompatibleWithEnchantment(t item.EnchantmentType) bool
- func (FireProtection) CompatibleWithItem(i world.Item) bool
- func (FireProtection) Cost(level int) (int, int)
- func (FireProtection) MaxLevel() int
- func (FireProtection) Modifier() float64
- func (FireProtection) Name() string
- func (FireProtection) Rarity() item.EnchantmentRarity
- type Flame
- type Infinity
- func (Infinity) CompatibleWithEnchantment(t item.EnchantmentType) bool
- func (Infinity) CompatibleWithItem(i world.Item) bool
- func (Infinity) ConsumesArrows() bool
- func (Infinity) Cost(int) (int, int)
- func (Infinity) MaxLevel() int
- func (Infinity) Name() string
- func (Infinity) Rarity() item.EnchantmentRarity
- type KnockBack
- func (KnockBack) CompatibleWithEnchantment(item.EnchantmentType) bool
- func (KnockBack) CompatibleWithItem(i world.Item) bool
- func (KnockBack) Cost(level int) (int, int)
- func (KnockBack) Force(level int) float64
- func (KnockBack) MaxLevel() int
- func (KnockBack) Name() string
- func (KnockBack) Rarity() item.EnchantmentRarity
- type Mending
- func (Mending) CompatibleWithEnchantment(t item.EnchantmentType) bool
- func (Mending) CompatibleWithItem(i world.Item) bool
- func (Mending) Cost(level int) (int, int)
- func (Mending) MaxLevel() int
- func (Mending) Name() string
- func (Mending) Rarity() item.EnchantmentRarity
- func (Mending) Treasure() bool
- type Power
- func (Power) CompatibleWithEnchantment(item.EnchantmentType) bool
- func (Power) CompatibleWithItem(i world.Item) bool
- func (Power) Cost(level int) (int, int)
- func (Power) MaxLevel() int
- func (Power) Name() string
- func (Power) PowerDamage(level int) float64
- func (Power) Rarity() item.EnchantmentRarity
- type ProjectileProtection
- func (ProjectileProtection) CompatibleWithEnchantment(t item.EnchantmentType) bool
- func (ProjectileProtection) CompatibleWithItem(i world.Item) bool
- func (ProjectileProtection) Cost(level int) (int, int)
- func (ProjectileProtection) MaxLevel() int
- func (ProjectileProtection) Modifier() float64
- func (ProjectileProtection) Name() string
- func (ProjectileProtection) Rarity() item.EnchantmentRarity
- type Protection
- func (Protection) CompatibleWithEnchantment(t item.EnchantmentType) bool
- func (Protection) CompatibleWithItem(i world.Item) bool
- func (Protection) Cost(level int) (int, int)
- func (Protection) MaxLevel() int
- func (Protection) Modifier() float64
- func (Protection) Name() string
- func (Protection) Rarity() item.EnchantmentRarity
- type Punch
- type Respiration
- func (Respiration) Chance(level int) float64
- func (Respiration) CompatibleWithEnchantment(item.EnchantmentType) bool
- func (Respiration) CompatibleWithItem(i world.Item) bool
- func (Respiration) Cost(level int) (int, int)
- func (Respiration) MaxLevel() int
- func (Respiration) Name() string
- func (Respiration) Rarity() item.EnchantmentRarity
- type Sharpness
- func (Sharpness) Addend(level int) float64
- func (Sharpness) CompatibleWithEnchantment(item.EnchantmentType) bool
- func (Sharpness) CompatibleWithItem(i world.Item) bool
- func (Sharpness) Cost(level int) (int, int)
- func (Sharpness) MaxLevel() int
- func (Sharpness) Name() string
- func (Sharpness) Rarity() item.EnchantmentRarity
- type SilkTouch
- type SoulSpeed
- func (SoulSpeed) CompatibleWithEnchantment(item.EnchantmentType) bool
- func (SoulSpeed) CompatibleWithItem(i world.Item) bool
- func (SoulSpeed) Cost(level int) (int, int)
- func (SoulSpeed) MaxLevel() int
- func (SoulSpeed) Name() string
- func (SoulSpeed) Rarity() item.EnchantmentRarity
- func (SoulSpeed) Treasure() bool
- type SwiftSneak
- func (SwiftSneak) CompatibleWithEnchantment(item.EnchantmentType) bool
- func (SwiftSneak) CompatibleWithItem(i world.Item) bool
- func (SwiftSneak) Cost(level int) (int, int)
- func (SwiftSneak) MaxLevel() int
- func (SwiftSneak) Name() string
- func (SwiftSneak) Rarity() item.EnchantmentRarity
- func (SwiftSneak) Treasure() bool
- type Thorns
- type ThornsDamageSource
- type Unbreaking
- func (Unbreaking) CompatibleWithEnchantment(item.EnchantmentType) bool
- func (Unbreaking) CompatibleWithItem(i world.Item) bool
- func (Unbreaking) Cost(level int) (int, int)
- func (Unbreaking) MaxLevel() int
- func (Unbreaking) Name() string
- func (Unbreaking) Rarity() item.EnchantmentRarity
- func (Unbreaking) Reduce(it world.Item, level, amount int) int
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ProtectionFactor ¶
func ProtectionFactor(src world.DamageSource, enchantments []item.Enchantment) float64
ProtectionFactor calculates the combined protection factor for a slice of item.Enchantment. The factor depends on the world.DamageSource passed and is in a range of [0, 0.8], where 0.8 means incoming damage would be reduced by 80%.
Types ¶
type AffectedDamageSource ¶
type AffectedDamageSource interface { world.DamageSource // AffectedByEnchantment specifies if a world.DamageSource is affected by // the item.EnchantmentType passed. AffectedByEnchantment(e item.EnchantmentType) bool }
AffectedDamageSource represents a world.DamageSource whose damage may be affected by an enchantment. A world.DamageSource does not need to implement AffectedDamageSource to let Protection affect the damage. This happens depending on the (world.DamageSource).ReducedByResistance() method.
type AquaAffinity ¶
type AquaAffinity struct{}
AquaAffinity is a helmet enchantment that increases underwater mining speed.
func (AquaAffinity) CompatibleWithEnchantment ¶
func (AquaAffinity) CompatibleWithEnchantment(item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (AquaAffinity) CompatibleWithItem ¶
func (AquaAffinity) CompatibleWithItem(i world.Item) bool
CompatibleWithItem ...
type BlastProtection ¶
type BlastProtection struct{}
BlastProtection is an armour enchantment that reduces damage from explosions.
func (BlastProtection) CompatibleWithEnchantment ¶
func (BlastProtection) CompatibleWithEnchantment(t item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (BlastProtection) CompatibleWithItem ¶
func (BlastProtection) CompatibleWithItem(i world.Item) bool
CompatibleWithItem ...
func (BlastProtection) Modifier ¶
func (BlastProtection) Modifier() float64
Modifier returns the base protection modifier for the enchantment.
type CurseOfVanishing ¶
type CurseOfVanishing struct{}
CurseOfVanishing is an enchantment that causes the item to disappear on death.
func (CurseOfVanishing) CompatibleWithEnchantment ¶
func (CurseOfVanishing) CompatibleWithEnchantment(t item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (CurseOfVanishing) CompatibleWithItem ¶
func (CurseOfVanishing) CompatibleWithItem(i world.Item) bool
CompatibleWithItem ...
type DamageModifier ¶
type DamageModifier interface {
Modifier() float64
}
DamageModifier is an item.EnchantmentType that can reduce damage through a modifier if an AffectedDamageSource returns true for it.
type DepthStrider ¶
type DepthStrider struct{}
DepthStrider is a boot enchantment that increases underwater movement speed.
func (DepthStrider) CompatibleWithEnchantment ¶
func (DepthStrider) CompatibleWithEnchantment(item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (DepthStrider) CompatibleWithItem ¶
func (DepthStrider) CompatibleWithItem(i world.Item) bool
CompatibleWithItem ...
type Efficiency ¶
type Efficiency struct{}
Efficiency is an enchantment that increases mining speed.
func (Efficiency) Addend ¶
func (Efficiency) Addend(level int) float64
Addend returns the mining speed addend from efficiency.
func (Efficiency) CompatibleWithEnchantment ¶
func (Efficiency) CompatibleWithEnchantment(item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (Efficiency) CompatibleWithItem ¶
func (Efficiency) CompatibleWithItem(i world.Item) bool
CompatibleWithItem ...
type FeatherFalling ¶
type FeatherFalling struct{}
FeatherFalling is an enchantment to boots that reduces fall damage. It does not affect falling speed.
func (FeatherFalling) CompatibleWithEnchantment ¶
func (FeatherFalling) CompatibleWithEnchantment(item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (FeatherFalling) CompatibleWithItem ¶
func (FeatherFalling) CompatibleWithItem(i world.Item) bool
CompatibleWithItem ...
func (FeatherFalling) Modifier ¶
func (FeatherFalling) Modifier() float64
Modifier returns the base protection modifier for the enchantment.
type FireAspect ¶
type FireAspect struct{}
FireAspect is a sword enchantment that sets the target on fire.
func (FireAspect) CompatibleWithEnchantment ¶
func (FireAspect) CompatibleWithEnchantment(item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (FireAspect) CompatibleWithItem ¶
func (FireAspect) CompatibleWithItem(i world.Item) bool
CompatibleWithItem ...
type FireProtection ¶
type FireProtection struct{}
FireProtection is an armour enchantment that decreases fire damage.
func (FireProtection) CompatibleWithEnchantment ¶
func (FireProtection) CompatibleWithEnchantment(t item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (FireProtection) CompatibleWithItem ¶
func (FireProtection) CompatibleWithItem(i world.Item) bool
CompatibleWithItem ...
func (FireProtection) Modifier ¶
func (FireProtection) Modifier() float64
Modifier returns the base protection modifier for the enchantment.
type Flame ¶
type Flame struct{}
Flame turns your arrows into flaming arrows allowing you to set your targets on fire.
func (Flame) BurnDuration ¶
BurnDuration always returns a hundred seconds, no matter the level.
func (Flame) CompatibleWithEnchantment ¶
func (Flame) CompatibleWithEnchantment(item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (Flame) CompatibleWithItem ¶
CompatibleWithItem ...
type Infinity ¶
type Infinity struct{}
Infinity is an enchantment to bows that prevents regular arrows from being consumed when shot.
func (Infinity) CompatibleWithEnchantment ¶
func (Infinity) CompatibleWithEnchantment(t item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (Infinity) CompatibleWithItem ¶
CompatibleWithItem ...
func (Infinity) ConsumesArrows ¶
ConsumesArrows always returns false.
type KnockBack ¶
type KnockBack struct{}
KnockBack is an enchantment to a sword that increases the sword's knock-back.
func (KnockBack) CompatibleWithEnchantment ¶
func (KnockBack) CompatibleWithEnchantment(item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (KnockBack) CompatibleWithItem ¶
CompatibleWithItem ...
type Mending ¶
type Mending struct{}
Mending is an enchantment that repairs the item when experience orbs are collected.
func (Mending) CompatibleWithEnchantment ¶
func (Mending) CompatibleWithEnchantment(t item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (Mending) CompatibleWithItem ¶
CompatibleWithItem ...
type Power ¶
type Power struct{}
Power is a bow enchantment which increases arrow damage.
func (Power) CompatibleWithEnchantment ¶
func (Power) CompatibleWithEnchantment(item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (Power) CompatibleWithItem ¶
CompatibleWithItem ...
func (Power) PowerDamage ¶
PowerDamage returns the extra base damage dealt by the enchantment and level.
type ProjectileProtection ¶
type ProjectileProtection struct{}
ProjectileProtection is an armour enchantment that reduces damage from projectiles.
func (ProjectileProtection) CompatibleWithEnchantment ¶
func (ProjectileProtection) CompatibleWithEnchantment(t item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (ProjectileProtection) CompatibleWithItem ¶
func (ProjectileProtection) CompatibleWithItem(i world.Item) bool
CompatibleWithItem ...
func (ProjectileProtection) Modifier ¶
func (ProjectileProtection) Modifier() float64
Modifier returns the base protection modifier for the enchantment.
func (ProjectileProtection) Rarity ¶
func (ProjectileProtection) Rarity() item.EnchantmentRarity
Rarity ...
type Protection ¶
type Protection struct{}
Protection is an armour enchantment which increases the damage reduction.
func (Protection) CompatibleWithEnchantment ¶
func (Protection) CompatibleWithEnchantment(t item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (Protection) CompatibleWithItem ¶
func (Protection) CompatibleWithItem(i world.Item) bool
CompatibleWithItem ...
func (Protection) Modifier ¶
func (Protection) Modifier() float64
Modifier returns the base protection modifier for the enchantment.
type Punch ¶
type Punch struct{}
Punch increases the knock-back dealt when hitting a player or mob with a bow.
func (Punch) CompatibleWithEnchantment ¶
func (Punch) CompatibleWithEnchantment(item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (Punch) CompatibleWithItem ¶
CompatibleWithItem ...
func (Punch) KnockBackMultiplier ¶
KnockBackMultiplier returns the punch multiplier for the level and horizontal speed.
type Respiration ¶
type Respiration struct{}
Respiration extends underwater breathing time by +15 seconds per enchantment level in addition to the default time of 15 seconds.
func (Respiration) Chance ¶
func (Respiration) Chance(level int) float64
Chance returns the chance of the enchantment blocking the air supply from ticking.
func (Respiration) CompatibleWithEnchantment ¶
func (Respiration) CompatibleWithEnchantment(item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (Respiration) CompatibleWithItem ¶
func (Respiration) CompatibleWithItem(i world.Item) bool
CompatibleWithItem ...
type Sharpness ¶
type Sharpness struct{}
Sharpness is an enchantment applied to a sword or axe that increases melee damage.
func (Sharpness) CompatibleWithEnchantment ¶
func (Sharpness) CompatibleWithEnchantment(item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (Sharpness) CompatibleWithItem ¶
CompatibleWithItem ...
type SilkTouch ¶
type SilkTouch struct{}
SilkTouch is an enchantment that allows many blocks to drop themselves instead of their usual items when mined.
func (SilkTouch) CompatibleWithEnchantment ¶
func (SilkTouch) CompatibleWithEnchantment(item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (SilkTouch) CompatibleWithItem ¶
CompatibleWithItem ...
type SoulSpeed ¶
type SoulSpeed struct{}
SoulSpeed is an enchantment that can be applied on boots and allows the player to walk more quickly on soul sand or soul soil.
func (SoulSpeed) CompatibleWithEnchantment ¶
func (SoulSpeed) CompatibleWithEnchantment(item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (SoulSpeed) CompatibleWithItem ¶
CompatibleWithItem ...
type SwiftSneak ¶
type SwiftSneak struct{}
SwiftSneak is a non-renewable enchantment that can be applied to leggings and allows the player to walk more quickly while sneaking.
func (SwiftSneak) CompatibleWithEnchantment ¶
func (SwiftSneak) CompatibleWithEnchantment(item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (SwiftSneak) CompatibleWithItem ¶
func (SwiftSneak) CompatibleWithItem(i world.Item) bool
CompatibleWithItem ...
type Thorns ¶
type Thorns struct{}
Thorns is an enchantment that inflicts damage on attackers.
func (Thorns) CompatibleWithEnchantment ¶
func (Thorns) CompatibleWithEnchantment(item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (Thorns) CompatibleWithItem ¶
CompatibleWithItem ...
type ThornsDamageSource ¶
type ThornsDamageSource struct { // Owner is the owner of the armour with the Thorns enchantment. Owner world.Entity }
ThornsDamageSource is used for damage caused by thorns.
func (ThornsDamageSource) Fire ¶
func (ThornsDamageSource) Fire() bool
func (ThornsDamageSource) ReducedByArmour ¶
func (ThornsDamageSource) ReducedByArmour() bool
func (ThornsDamageSource) ReducedByResistance ¶
func (ThornsDamageSource) ReducedByResistance() bool
type Unbreaking ¶
type Unbreaking struct{}
Unbreaking is an enchantment that gives a chance for an item to avoid durability reduction when it is used, effectively increasing the item's durability.
func (Unbreaking) CompatibleWithEnchantment ¶
func (Unbreaking) CompatibleWithEnchantment(item.EnchantmentType) bool
CompatibleWithEnchantment ...
func (Unbreaking) CompatibleWithItem ¶
func (Unbreaking) CompatibleWithItem(i world.Item) bool
CompatibleWithItem ...
Source Files ¶
- aqua_affinity.go
- blast_protection.go
- damage.go
- depth_strider.go
- efficiency.go
- feather_falling.go
- fire_aspect.go
- fire_protection.go
- flame.go
- infinity.go
- knock_back.go
- mending.go
- power.go
- projectile_protection.go
- protection.go
- punch.go
- register.go
- respiration.go
- sharpness.go
- silk_touch.go
- soul_speed.go
- swift_sneak.go
- thorns.go
- unbreaking.go
- vanishing.go