Class Enchantment
java.lang.Object
net.minecraft.world.item.enchantment.Enchantment
- All Implemented Interfaces:
FeatureElement,IEnchantmentExtension
- Direct Known Subclasses:
ArrowInfiniteEnchantment,ArrowPiercingEnchantment,BindingCurseEnchantment,BreachEnchantment,DamageEnchantment,DensityEnchantment,DigDurabilityEnchantment,FrostWalkerEnchantment,LootBonusEnchantment,MendingEnchantment,MultiShotEnchantment,ProtectionEnchantment,SoulSpeedEnchantment,SwiftSneakEnchantment,ThornsEnchantment,TridentRiptideEnchantment,UntouchingEnchantment,VanishingCurseEnchantment,WaterWalkerEnchantment,WindBurstEnchantment
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Holder.Reference<Enchantment> private final Enchantment.EnchantmentDefinitionprotected StringFields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionDeprecated.static EnchantmentbyId(int p_44698_) booleanThis applies specifically to applying at the enchanting table.booleancanEnchant(ItemStack p_44689_) protected booleancheckCompatibility(Enchantment p_44690_) static Enchantment.CostconstantCost(int p_336195_) definition(TagKey<Item> p_335812_, int p_335506_, int p_335598_, Enchantment.Cost p_336185_, Enchantment.Cost p_335768_, int p_335409_, EquipmentSlot... p_335583_) definition(TagKey<Item> p_338699_, int p_338488_, int p_338497_, Enchantment.Cost p_338563_, Enchantment.Cost p_338689_, int p_338253_, FeatureFlagSet p_338531_, EquipmentSlot... p_338705_) definition(TagKey<Item> p_335552_, TagKey<Item> p_336174_, int p_335557_, int p_336051_, Enchantment.Cost p_336176_, Enchantment.Cost p_335380_, int p_335569_, EquipmentSlot... p_335470_) voiddoPostAttack(LivingEntity p_44686_, Entity p_44687_, int p_44688_) voiddoPostHurt(LivingEntity p_44692_, Entity p_44693_, int p_44694_) voiddoPostItemStackHurt(LivingEntity p_338405_, Entity p_338648_, int p_338725_) static Enchantment.CostdynamicCost(int p_336066_, int p_336018_) final intfloatgetDamageBonus(int p_44682_, EntityType<?> p_320800_) Deprecated.intgetDamageProtection(int p_44680_, DamageSource p_44681_) getFullname(int p_44701_) final intgetMaxCost(int p_44691_) final intfinal intgetMinCost(int p_44679_) final intprotected StringgetSlotItems(LivingEntity p_44685_) final intbooleanIs this enchantment allowed to be enchanted on books via Enchantment Tablefinal booleanisCompatibleWith(Enchantment p_44696_) booleanisCurse()booleanfinal booleanisPrimaryItem(ItemStack p_336088_) booleanbooleanMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabledMethods inherited from interface net.neoforged.neoforge.common.extensions.IEnchantmentExtension
allowedInCreativeTab, getDamageBonus
-
Field Details
-
definition
-
descriptionId
-
builtInRegistryHolder
-
-
Constructor Details
-
Enchantment
-
-
Method Details
-
constantCost
-
dynamicCost
-
definition
public static Enchantment.EnchantmentDefinition definition(TagKey<Item> p_335552_, TagKey<Item> p_336174_, int p_335557_, int p_336051_, Enchantment.Cost p_336176_, Enchantment.Cost p_335380_, int p_335569_, EquipmentSlot... p_335470_) -
definition
public static Enchantment.EnchantmentDefinition definition(TagKey<Item> p_335812_, int p_335506_, int p_335598_, Enchantment.Cost p_336185_, Enchantment.Cost p_335768_, int p_335409_, EquipmentSlot... p_335583_) -
definition
public static Enchantment.EnchantmentDefinition definition(TagKey<Item> p_338699_, int p_338488_, int p_338497_, Enchantment.Cost p_338563_, Enchantment.Cost p_338689_, int p_338253_, FeatureFlagSet p_338531_, EquipmentSlot... p_338705_) -
byId
-
getSlotItems
-
getSupportedItems
-
isPrimaryItem
-
getWeight
public final int getWeight() -
getAnvilCost
public final int getAnvilCost() -
getMinLevel
public final int getMinLevel() -
getMaxLevel
public final int getMaxLevel() -
getMinCost
public final int getMinCost(int p_44679_) -
getMaxCost
public final int getMaxCost(int p_44691_) -
getDamageProtection
-
getDamageBonus
Deprecated. -
isCompatibleWith
-
checkCompatibility
-
getOrCreateDescriptionId
-
getDescriptionId
-
getFullname
-
canEnchant
-
doPostAttack
-
doPostHurt
-
doPostItemStackHurt
-
isTreasureOnly
public boolean isTreasureOnly() -
isCurse
public boolean isCurse() -
isTradeable
public boolean isTradeable() -
isDiscoverable
public boolean isDiscoverable() -
canApplyAtEnchantingTable
This applies specifically to applying at the enchanting table. The other methodcanEnchant(ItemStack)applies for all possible enchantments.- Parameters:
stack-- Returns:
-
isAllowedOnBooks
public boolean isAllowedOnBooks()Is this enchantment allowed to be enchanted on books via Enchantment Table- Returns:
- false to disable the vanilla feature
-
builtInRegistryHolder
Deprecated. -
requiredFeatures
- Specified by:
requiredFeaturesin interfaceFeatureElement
-