Documentation ¶
Index ¶
Constants ¶
const ( Protection byte = iota FireProtection FeatherFalling BlastProtection ProjectileProtection Thorns Respiration DepthStrider AquaAffinity Sharpness Smite BaneOfArthropods Knockback FireAspect Looting Efficiency SilkTouch Unbreaking Fortune Power Punch Flame Infinity LuckOfTheSea Lure FrostWalker Mending )
Variables ¶
var DefaultManager = NewManager()
DefaultManager is the default enchantment manager. The init function registers the default enchantments.
Functions ¶
This section is empty.
Types ¶
type Enchantable ¶
type Enchantable struct { }
type Instance ¶
type Instance struct { Type // Level is the enchantment level. // This value indicates the strength of the // enchantment. Level byte }
Instance is an enchantment instance. It holds an enchantment type, and contains the leftover duration of an enchantment, and the value of it.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides helper functions for managing enchantments, such as registering, deregistering and checks for those.
func NewManager ¶
func NewManager() *Manager
NewManager returns a new enchantment manager. Maps are allocated, but no default enchantments are registered yet.
func (*Manager) RegisterDefaults ¶
func (manager *Manager) RegisterDefaults()
RegisterDefaults registers all default enchantments. This function should be called whenever a new manager is made, in order to have all default enchantments registered.
type Type ¶
type Type struct {
// contains filtered or unexported fields
}
Type holds the data of the enchantment. It is an immutable type, which is used to identify an enchantment.
func (Type) GetId ¶
GetId returns the enchantment ID of a type. It is used mainly to identify an enchantment.
func (Type) GetStringId ¶
GetStringId returns the string ID of a type. This string ID may be used to identify enchantments by user output.