github.com/df-mc/dragonfly@v0.9.13/server/item/enchantment/feather_falling.go (about) 1 package enchantment 2 3 import ( 4 "github.com/df-mc/dragonfly/server/item" 5 "github.com/df-mc/dragonfly/server/world" 6 ) 7 8 // FeatherFalling is an enchantment to boots that reduces fall damage. It does not affect falling speed. 9 type FeatherFalling struct{} 10 11 // Name ... 12 func (FeatherFalling) Name() string { 13 return "Feather Falling" 14 } 15 16 // MaxLevel ... 17 func (FeatherFalling) MaxLevel() int { 18 return 4 19 } 20 21 // Cost ... 22 func (FeatherFalling) Cost(level int) (int, int) { 23 min := 5 + (level-1)*6 24 return min, min + 6 25 } 26 27 // Rarity ... 28 func (FeatherFalling) Rarity() item.EnchantmentRarity { 29 return item.EnchantmentRarityUncommon 30 } 31 32 // Modifier returns the base protection modifier for the enchantment. 33 func (FeatherFalling) Modifier() float64 { 34 return 0.12 35 } 36 37 // CompatibleWithEnchantment ... 38 func (FeatherFalling) CompatibleWithEnchantment(item.EnchantmentType) bool { 39 return true 40 } 41 42 // CompatibleWithItem ... 43 func (FeatherFalling) CompatibleWithItem(i world.Item) bool { 44 b, ok := i.(item.BootsType) 45 return ok && b.Boots() 46 }