Interface EnchantmentType
- All Superinterfaces:
ComponentLike
,DefaultedRegistryValue
@CatalogedBy(EnchantmentTypes.class)
public interface EnchantmentType
extends DefaultedRegistryValue, ComponentLike
Represents a modifier on an item that has various effects.
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canBeAppliedByTable
(ItemStack stack) Test if this enchantment type can be applied to anItemStack
by theEnchantmentTable
.boolean
canBeAppliedToStack
(ItemStack stack) Test if this enchantment type can be applied to anItemStack
.boolean
isCompatibleWith
(EnchantmentType enchantmentType) Test if this enchantment type can be applied along with another enchantment type.boolean
isCurse()
Gets whether or not this enchantment type is considered a "curse" enchantment.boolean
Gets whether or not this enchantment type is considered a "treasure" enchantment.int
maximumEnchantabilityForLevel
(int level) Gets the maximum item enchantability for this level to be normally added by enchanting tables.int
Gets the maximum level of this enchantment type normally allowed.int
minimumEnchantabilityForLevel
(int level) Gets the minimum item enchantability for this level to be normally added by enchanting tables.int
Gets the minimum level of this enchantment type allowed where it is present.int
weight()
Gets the weight of this enchantment type.Methods inherited from interface net.kyori.adventure.text.ComponentLike
asComponent
Methods inherited from interface org.spongepowered.api.registry.DefaultedRegistryValue
asDefaultedReference, findKey, key
-
Method Details
-
weight
int weight()Gets the weight of this enchantment type.Higher values are more common. This value is also used in the repair cost calculation.
- Returns:
- The weight of this enchantment type
-
minimumLevel
int minimumLevel()Gets the minimum level of this enchantment type allowed where it is present.- Returns:
- The minimum level
-
maximumLevel
int maximumLevel()Gets the maximum level of this enchantment type normally allowed.- Returns:
- The maximum level
-
minimumEnchantabilityForLevel
int minimumEnchantabilityForLevel(int level) Gets the minimum item enchantability for this level to be normally added by enchanting tables.- Parameters:
level
- The enchantment type level- Returns:
- The minimum enchantability
-
maximumEnchantabilityForLevel
int maximumEnchantabilityForLevel(int level) Gets the maximum item enchantability for this level to be normally added by enchanting tables.- Parameters:
level
- The enchantment type level- Returns:
- The maximum enchantability
-
canBeAppliedToStack
Test if this enchantment type can be applied to anItemStack
.- Parameters:
stack
- The item stack to check- Returns:
- Whether this enchantment type can be applied
-
canBeAppliedByTable
Test if this enchantment type can be applied to anItemStack
by theEnchantmentTable
.- Parameters:
stack
- Te item stack to check- Returns:
- Whether this enchantment type can be applied by the enchantment table
-
isCompatibleWith
Test if this enchantment type can be applied along with another enchantment type.- Parameters:
enchantmentType
- The enchantment type to test compatibility with- Returns:
- Whether these enchantment types are compatible
-
isTreasure
boolean isTreasure()Gets whether or not this enchantment type is considered a "treasure" enchantment.These do not occur naturally in enchantment tables.
- Returns:
- Whether this enchantment type is a treasure enchantment type
-
isCurse
boolean isCurse()Gets whether or not this enchantment type is considered a "curse" enchantment.- Returns:
- Whether this enchantment type is a curse enchantment type
-