github.com/df-mc/dragonfly@v0.9.13/server/item/enchantment/infinity.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 // Infinity is an enchantment to bows that prevents regular arrows from being consumed when shot. 9 type Infinity struct{} 10 11 // Name ... 12 func (Infinity) Name() string { 13 return "Infinity" 14 } 15 16 // MaxLevel ... 17 func (Infinity) MaxLevel() int { 18 return 1 19 } 20 21 // Cost ... 22 func (Infinity) Cost(int) (int, int) { 23 return 20, 50 24 } 25 26 // Rarity ... 27 func (Infinity) Rarity() item.EnchantmentRarity { 28 return item.EnchantmentRarityVeryRare 29 } 30 31 // ConsumesArrows always returns false. 32 func (Infinity) ConsumesArrows() bool { 33 return false 34 } 35 36 // CompatibleWithEnchantment ... 37 func (Infinity) CompatibleWithEnchantment(t item.EnchantmentType) bool { 38 _, mending := t.(Mending) 39 return !mending 40 } 41 42 // CompatibleWithItem ... 43 func (Infinity) CompatibleWithItem(i world.Item) bool { 44 _, ok := i.(item.Bow) 45 return ok 46 }