github.com/df-mc/dragonfly@v0.9.13/server/item/enchantment/swift_sneak.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 // SwiftSneak is a non-renewable enchantment that can be applied to leggings and allows the player to walk more quickly 9 // while sneaking. 10 type SwiftSneak struct{} 11 12 // Name ... 13 func (SwiftSneak) Name() string { 14 return "Swift Sneak" 15 } 16 17 // MaxLevel ... 18 func (SwiftSneak) MaxLevel() int { 19 return 3 20 } 21 22 // Cost ... 23 func (SwiftSneak) Cost(level int) (int, int) { 24 min := level * 25 25 return min, min + 50 26 } 27 28 // Rarity ... 29 func (SwiftSneak) Rarity() item.EnchantmentRarity { 30 return item.EnchantmentRarityVeryRare 31 } 32 33 // CompatibleWithEnchantment ... 34 func (SwiftSneak) CompatibleWithEnchantment(item.EnchantmentType) bool { 35 return true 36 } 37 38 // Treasure ... 39 func (SwiftSneak) Treasure() bool { 40 return true 41 } 42 43 // CompatibleWithItem ... 44 func (SwiftSneak) CompatibleWithItem(i world.Item) bool { 45 b, ok := i.(item.LeggingsType) 46 return ok && b.Leggings() 47 }