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
Modifier and TypeClassDescriptionstatic final record
static final record
-
Field Summary
Modifier and TypeFieldDescriptionprivate final Holder.Reference
<Enchantment> private final Enchantment.EnchantmentDefinition
protected String
Fields inherited from interface net.minecraft.world.flag.FeatureElement
FILTERED_REGISTRIES
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionDeprecated.static Enchantment
byId
(int p_44698_) boolean
This applies specifically to applying at the enchanting table.boolean
canEnchant
(ItemStack p_44689_) protected boolean
checkCompatibility
(Enchantment p_44690_) static Enchantment.Cost
constantCost
(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_) void
doPostAttack
(LivingEntity p_44686_, Entity p_44687_, int p_44688_) void
doPostHurt
(LivingEntity p_44692_, Entity p_44693_, int p_44694_) void
doPostItemStackHurt
(LivingEntity p_338405_, Entity p_338648_, int p_338725_) static Enchantment.Cost
dynamicCost
(int p_336066_, int p_336018_) final int
float
getDamageBonus
(int p_44682_, EntityType<?> p_320800_) Deprecated.int
getDamageProtection
(int p_44680_, DamageSource p_44681_) getFullname
(int p_44701_) final int
getMaxCost
(int p_44691_) final int
final int
getMinCost
(int p_44679_) final int
protected String
getSlotItems
(LivingEntity p_44685_) final int
boolean
Is this enchantment allowed to be enchanted on books via Enchantment Tablefinal boolean
isCompatibleWith
(Enchantment p_44696_) boolean
isCurse()
boolean
final boolean
isPrimaryItem
(ItemStack p_336088_) boolean
boolean
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minecraft.world.flag.FeatureElement
isEnabled
Methods 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:
requiredFeatures
in interfaceFeatureElement
-