github.com/df-mc/dragonfly@v0.9.13/server/item/enchantment/vanishing.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  // CurseOfVanishing is an enchantment that causes the item to disappear on death.
     9  type CurseOfVanishing struct{}
    10  
    11  // Name ...
    12  func (CurseOfVanishing) Name() string {
    13  	return "Curse of Vanishing"
    14  }
    15  
    16  // MaxLevel ...
    17  func (CurseOfVanishing) MaxLevel() int {
    18  	return 1
    19  }
    20  
    21  // Cost ...
    22  func (CurseOfVanishing) Cost(int) (int, int) {
    23  	return 25, 50
    24  }
    25  
    26  // Rarity ...
    27  func (CurseOfVanishing) Rarity() item.EnchantmentRarity {
    28  	return item.EnchantmentRarityVeryRare
    29  }
    30  
    31  // CompatibleWithEnchantment ...
    32  func (CurseOfVanishing) CompatibleWithEnchantment(t item.EnchantmentType) bool {
    33  	return true
    34  }
    35  
    36  // CompatibleWithItem ...
    37  func (CurseOfVanishing) CompatibleWithItem(i world.Item) bool {
    38  	_, arm := i.(item.Armour)
    39  	_, com := i.(item.Compass)
    40  	_, dur := i.(item.Durable)
    41  	_, rec := i.(item.RecoveryCompass)
    42  	// TODO: Carrot on a Stick
    43  	// TODO: Warped Fungus on a Stick
    44  	return arm || com || dur || rec
    45  }
    46  
    47  // Treasure ...
    48  func (CurseOfVanishing) Treasure() bool {
    49  	return true
    50  }
    51  
    52  // Curse ...
    53  func (CurseOfVanishing) Curse() bool {
    54  	return true
    55  }