Files
mc/server/item/enchantment/silk_touch.go
T
TarnaWijaya 26ed99fda6
Build and deploy / Build (push) Has been cancelled
Build and deploy / Update Contributors (push) Has been cancelled
Build and deploy / Deploy (push) Has been cancelled
up3
2026-07-09 08:33:57 +08:00

44 lines
915 B
Go

package enchantment
import (
"github.com/df-mc/dragonfly/server/item"
"github.com/df-mc/dragonfly/server/world"
)
// SilkTouch is an enchantment that allows many blocks to drop themselves
// instead of their usual items when mined.
var SilkTouch silkTouch
type silkTouch struct{}
// Name ...
func (silkTouch) Name() string {
return "Silk Touch"
}
// MaxLevel ...
func (silkTouch) MaxLevel() int {
return 1
}
// Cost ...
func (silkTouch) Cost(int) (int, int) {
return 15, 65
}
// Rarity ...
func (silkTouch) Rarity() item.EnchantmentRarity {
return item.EnchantmentRarityVeryRare
}
// CompatibleWithEnchantment ...
func (silkTouch) CompatibleWithEnchantment(t item.EnchantmentType) bool {
return t != Fortune
}
// CompatibleWithItem ...
func (silkTouch) CompatibleWithItem(i world.Item) bool {
t, ok := i.(item.Tool)
return ok && (t.ToolType() != item.TypeSword && t.ToolType() != item.TypeNone)
}