Package net.minecraft.enchantment
Class Enchantment
java.lang.Object
net.minecraft.enchantment.Enchantment
- All Implemented Interfaces:
ToggleableFeature
- Direct Known Subclasses:
BindingCurseEnchantment,BreachEnchantment,DamageEnchantment,DensityEnchantment,DepthStriderEnchantment,FrostWalkerEnchantment,InfinityEnchantment,LuckEnchantment,MendingEnchantment,MultishotEnchantment,PiercingEnchantment,ProtectionEnchantment,RiptideEnchantment,SilkTouchEnchantment,SoulSpeedEnchantment,SwiftSneakEnchantment,ThornsEnchantment,UnbreakingEnchantment,VanishingCurseEnchantment,WindBurstEnchantment
- Mappings:
Namespace Name named net/minecraft/enchantment/Enchantmentintermediary net/minecraft/class_1887official dac
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordstatic final record -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Enchantment.Propertiesprivate final RegistryEntry.Reference<Enchantment> Fields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
FEATURE_ENABLED_REGISTRY_KEYS -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable EnchantmentbyRawId(int id) protected booleancanAccept(Enchantment other) Returns whether this enchantment can exist on an item stack with theotherenchantment.final booleancanCombine(Enchantment other) Returns whether this enchantment can exist on an item stack with theotherenchantment and theotherenchantment can exist with this enchantment.static Enchantment.CostconstantCost(int base) final intfloatgetAttackDamage(int level, @Nullable EntityType<?> entityType) getEquipment(LivingEntity entity) final intfinal intgetMaxPower(int level) final intfinal intgetMinPower(int level) getName(int level) protected StringintgetProtectionAmount(int level, DamageSource source) Deprecated.final intbooleanisAcceptableItem(ItemStack stack) booleanReturns whether this enchantment will appear in the enchanted book trade offers of librarian villagers.booleanReturns whether this enchantment will appear in the enchanting table or loots with random enchant function.booleanisCursed()final booleanisPrimaryItem(ItemStack stack) booleanstatic Enchantment.CostleveledCost(int base, int perLevel) voidonAttack(LivingEntity attacket, Entity target, int level) voidonTargetDamaged(LivingEntity user, Entity target, int level) voidonUserDamaged(LivingEntity user, Entity attacker, int level) static Enchantment.Propertiesproperties(TagKey<Item> supportedItems, int weight, int maxLevel, Enchantment.Cost minCost, Enchantment.Cost maxCost, int anvilCost, EquipmentSlot[] slots) static Enchantment.Propertiesproperties(TagKey<Item> supportedItems, int weight, int maxLevel, Enchantment.Cost minCost, Enchantment.Cost maxCost, int anvilCost, FeatureSet requiredFeatures, EquipmentSlot[] slots) static Enchantment.Propertiesproperties(TagKey<Item> supportedItems, TagKey<Item> primaryItems, int weight, int maxLevel, Enchantment.Cost minCost, Enchantment.Cost maxCost, int anvilCost, EquipmentSlot[] slots) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
isEnabled
-
Field Details
-
properties
- Mappings:
Namespace Name Mixin selector named propertiesLnet/minecraft/enchantment/Enchantment;properties:Lnet/minecraft/enchantment/Enchantment$Properties;intermediary field_50013Lnet/minecraft/class_1887;field_50013:Lnet/minecraft/class_1887$class_9427;official bLdac;b:Ldac$b;
-
translationKey
- Mappings:
Namespace Name Mixin selector named translationKeyLnet/minecraft/enchantment/Enchantment;translationKey:Ljava/lang/String;intermediary field_9084Lnet/minecraft/class_1887;field_9084:Ljava/lang/String;official aLdac;a:Ljava/lang/String;
-
registryEntry
- Mappings:
Namespace Name Mixin selector named registryEntryLnet/minecraft/enchantment/Enchantment;registryEntry:Lnet/minecraft/registry/entry/RegistryEntry$Reference;intermediary field_45769Lnet/minecraft/class_1887;field_45769:Lnet/minecraft/class_6880$class_6883;official cLdac;c:Lji$c;
-
-
Constructor Details
-
Enchantment
- Mappings:
Namespace Name Mixin selector named <init>Lnet/minecraft/enchantment/Enchantment;<init>(Lnet/minecraft/enchantment/Enchantment$Properties;)Vintermediary <init>Lnet/minecraft/class_1887;<init>(Lnet/minecraft/class_1887$class_9427;)Vofficial <init>Ldac;<init>(Ldac$b;)V
-
-
Method Details
-
constantCost
- Mappings:
Namespace Name Mixin selector named constantCostLnet/minecraft/enchantment/Enchantment;constantCost(I)Lnet/minecraft/enchantment/Enchantment$Cost;intermediary method_58440Lnet/minecraft/class_1887;method_58440(I)Lnet/minecraft/class_1887$class_9426;official aLdac;a(I)Ldac$a;
-
leveledCost
- Mappings:
Namespace Name Mixin selector named leveledCostLnet/minecraft/enchantment/Enchantment;leveledCost(II)Lnet/minecraft/enchantment/Enchantment$Cost;intermediary method_58441Lnet/minecraft/class_1887;method_58441(II)Lnet/minecraft/class_1887$class_9426;official aLdac;a(II)Ldac$a;
-
properties
public static Enchantment.Properties properties(TagKey<Item> supportedItems, TagKey<Item> primaryItems, int weight, int maxLevel, Enchantment.Cost minCost, Enchantment.Cost maxCost, int anvilCost, EquipmentSlot[] slots) - Mappings:
Namespace Name Mixin selector named propertiesLnet/minecraft/enchantment/Enchantment;properties(Lnet/minecraft/registry/tag/TagKey;Lnet/minecraft/registry/tag/TagKey;IILnet/minecraft/enchantment/Enchantment$Cost;Lnet/minecraft/enchantment/Enchantment$Cost;I[Lnet/minecraft/entity/EquipmentSlot;)Lnet/minecraft/enchantment/Enchantment$Properties;intermediary method_58443Lnet/minecraft/class_1887;method_58443(Lnet/minecraft/class_6862;Lnet/minecraft/class_6862;IILnet/minecraft/class_1887$class_9426;Lnet/minecraft/class_1887$class_9426;I[Lnet/minecraft/class_1304;)Lnet/minecraft/class_1887$class_9427;official aLdac;a(Laxf;Laxf;IILdac$a;Ldac$a;I[Lbtd;)Ldac$b;
-
properties
public static Enchantment.Properties properties(TagKey<Item> supportedItems, int weight, int maxLevel, Enchantment.Cost minCost, Enchantment.Cost maxCost, int anvilCost, EquipmentSlot[] slots) - Mappings:
Namespace Name Mixin selector named propertiesLnet/minecraft/enchantment/Enchantment;properties(Lnet/minecraft/registry/tag/TagKey;IILnet/minecraft/enchantment/Enchantment$Cost;Lnet/minecraft/enchantment/Enchantment$Cost;I[Lnet/minecraft/entity/EquipmentSlot;)Lnet/minecraft/enchantment/Enchantment$Properties;intermediary method_58442Lnet/minecraft/class_1887;method_58442(Lnet/minecraft/class_6862;IILnet/minecraft/class_1887$class_9426;Lnet/minecraft/class_1887$class_9426;I[Lnet/minecraft/class_1304;)Lnet/minecraft/class_1887$class_9427;official aLdac;a(Laxf;IILdac$a;Ldac$a;I[Lbtd;)Ldac$b;
-
properties
public static Enchantment.Properties properties(TagKey<Item> supportedItems, int weight, int maxLevel, Enchantment.Cost minCost, Enchantment.Cost maxCost, int anvilCost, FeatureSet requiredFeatures, EquipmentSlot[] slots) - Mappings:
Namespace Name Mixin selector named propertiesLnet/minecraft/enchantment/Enchantment;properties(Lnet/minecraft/registry/tag/TagKey;IILnet/minecraft/enchantment/Enchantment$Cost;Lnet/minecraft/enchantment/Enchantment$Cost;ILnet/minecraft/resource/featuretoggle/FeatureSet;[Lnet/minecraft/entity/EquipmentSlot;)Lnet/minecraft/enchantment/Enchantment$Properties;intermediary method_58674Lnet/minecraft/class_1887;method_58674(Lnet/minecraft/class_6862;IILnet/minecraft/class_1887$class_9426;Lnet/minecraft/class_1887$class_9426;ILnet/minecraft/class_7699;[Lnet/minecraft/class_1304;)Lnet/minecraft/class_1887$class_9427;official aLdac;a(Laxf;IILdac$a;Ldac$a;ILcpn;[Lbtd;)Ldac$b;
-
byRawId
- Mappings:
Namespace Name Mixin selector named byRawIdLnet/minecraft/enchantment/Enchantment;byRawId(I)Lnet/minecraft/enchantment/Enchantment;intermediary method_8191Lnet/minecraft/class_1887;method_8191(I)Lnet/minecraft/class_1887;official bLdac;b(I)Ldac;
-
getEquipment
- Mappings:
Namespace Name Mixin selector named getEquipmentLnet/minecraft/enchantment/Enchantment;getEquipment(Lnet/minecraft/entity/LivingEntity;)Ljava/util/Map;intermediary method_8185Lnet/minecraft/class_1887;method_8185(Lnet/minecraft/class_1309;)Ljava/util/Map;official aLdac;a(Lbtr;)Ljava/util/Map;
-
getApplicableItems
- Mappings:
Namespace Name Mixin selector named getApplicableItemsLnet/minecraft/enchantment/Enchantment;getApplicableItems()Lnet/minecraft/registry/tag/TagKey;intermediary method_56109Lnet/minecraft/class_1887;method_56109()Lnet/minecraft/class_6862;official cLdac;c()Laxf;
-
isPrimaryItem
- Mappings:
Namespace Name Mixin selector named isPrimaryItemLnet/minecraft/enchantment/Enchantment;isPrimaryItem(Lnet/minecraft/item/ItemStack;)Zintermediary method_58444Lnet/minecraft/class_1887;method_58444(Lnet/minecraft/class_1799;)Zofficial aLdac;a(Lcur;)Z
-
getWeight
public final int getWeight()- Mappings:
Namespace Name Mixin selector named getWeightLnet/minecraft/enchantment/Enchantment;getWeight()Iintermediary method_58445Lnet/minecraft/class_1887;method_58445()Iofficial dLdac;d()I
-
getAnvilCost
public final int getAnvilCost()- Mappings:
Namespace Name Mixin selector named getAnvilCostLnet/minecraft/enchantment/Enchantment;getAnvilCost()Iintermediary method_58446Lnet/minecraft/class_1887;method_58446()Iofficial eLdac;e()I
-
getMinLevel
public final int getMinLevel()- Mappings:
Namespace Name Mixin selector named getMinLevelLnet/minecraft/enchantment/Enchantment;getMinLevel()Iintermediary method_8187Lnet/minecraft/class_1887;method_8187()Iofficial fLdac;f()I
-
getMaxLevel
public final int getMaxLevel()- Mappings:
Namespace Name Mixin selector named getMaxLevelLnet/minecraft/enchantment/Enchantment;getMaxLevel()Iintermediary method_8183Lnet/minecraft/class_1887;method_8183()Iofficial gLdac;g()I
-
getMinPower
public final int getMinPower(int level) - Mappings:
Namespace Name Mixin selector named getMinPowerLnet/minecraft/enchantment/Enchantment;getMinPower(I)Iintermediary method_8182Lnet/minecraft/class_1887;method_8182(I)Iofficial cLdac;c(I)I
-
getMaxPower
public final int getMaxPower(int level) - Mappings:
Namespace Name Mixin selector named getMaxPowerLnet/minecraft/enchantment/Enchantment;getMaxPower(I)Iintermediary method_20742Lnet/minecraft/class_1887;method_20742(I)Iofficial dLdac;d(I)I
-
getProtectionAmount
- Mappings:
Namespace Name Mixin selector named getProtectionAmountLnet/minecraft/enchantment/Enchantment;getProtectionAmount(ILnet/minecraft/entity/damage/DamageSource;)Iintermediary method_8181Lnet/minecraft/class_1887;method_8181(ILnet/minecraft/class_1282;)Iofficial aLdac;a(ILbrp;)I
-
getAttackDamage
- Mappings:
Namespace Name Mixin selector named getAttackDamageLnet/minecraft/enchantment/Enchantment;getAttackDamage(ILnet/minecraft/entity/EntityType;)Fintermediary method_8196Lnet/minecraft/class_1887;method_8196(ILnet/minecraft/class_1299;)Fofficial aLdac;a(ILbtc;)F
-
canCombine
Returns whether this enchantment can exist on an item stack with theotherenchantment and theotherenchantment can exist with this enchantment.- Returns:
- whether this enchantment can exist on an item stack with the
otherenchantment and theotherenchantment can exist with this enchantment - Mappings:
Namespace Name Mixin selector named canCombineLnet/minecraft/enchantment/Enchantment;canCombine(Lnet/minecraft/enchantment/Enchantment;)Zintermediary method_8188Lnet/minecraft/class_1887;method_8188(Lnet/minecraft/class_1887;)Zofficial bLdac;b(Ldac;)Z
-
canAccept
Returns whether this enchantment can exist on an item stack with theotherenchantment.- Returns:
- whether this enchantment can exist on an item stack with the
otherenchantment - Mappings:
Namespace Name Mixin selector named canAcceptLnet/minecraft/enchantment/Enchantment;canAccept(Lnet/minecraft/enchantment/Enchantment;)Zintermediary method_8180Lnet/minecraft/class_1887;method_8180(Lnet/minecraft/class_1887;)Zofficial aLdac;a(Ldac;)Z
-
getOrCreateTranslationKey
- Mappings:
Namespace Name Mixin selector named getOrCreateTranslationKeyLnet/minecraft/enchantment/Enchantment;getOrCreateTranslationKey()Ljava/lang/String;intermediary method_8190Lnet/minecraft/class_1887;method_8190()Ljava/lang/String;official hLdac;h()Ljava/lang/String;
-
getTranslationKey
- Mappings:
Namespace Name Mixin selector named getTranslationKeyLnet/minecraft/enchantment/Enchantment;getTranslationKey()Ljava/lang/String;intermediary method_8184Lnet/minecraft/class_1887;method_8184()Ljava/lang/String;official jLdac;j()Ljava/lang/String;
-
getName
- Mappings:
Namespace Name Mixin selector named getNameLnet/minecraft/enchantment/Enchantment;getName(I)Lnet/minecraft/text/Text;intermediary method_8179Lnet/minecraft/class_1887;method_8179(I)Lnet/minecraft/class_2561;official eLdac;e(I)Lxp;
-
isAcceptableItem
- Mappings:
Namespace Name Mixin selector named isAcceptableItemLnet/minecraft/enchantment/Enchantment;isAcceptableItem(Lnet/minecraft/item/ItemStack;)Zintermediary method_8192Lnet/minecraft/class_1887;method_8192(Lnet/minecraft/class_1799;)Zofficial bLdac;b(Lcur;)Z
-
onTargetDamaged
- Mappings:
Namespace Name Mixin selector named onTargetDamagedLnet/minecraft/enchantment/Enchantment;onTargetDamaged(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/Entity;I)Vintermediary method_8189Lnet/minecraft/class_1887;method_8189(Lnet/minecraft/class_1309;Lnet/minecraft/class_1297;I)Vofficial aLdac;a(Lbtr;Lbsw;I)V
-
onUserDamaged
- Mappings:
Namespace Name Mixin selector named onUserDamagedLnet/minecraft/enchantment/Enchantment;onUserDamaged(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/Entity;I)Vintermediary method_8178Lnet/minecraft/class_1887;method_8178(Lnet/minecraft/class_1309;Lnet/minecraft/class_1297;I)Vofficial bLdac;b(Lbtr;Lbsw;I)V
-
onAttack
- Mappings:
Namespace Name Mixin selector named onAttackLnet/minecraft/enchantment/Enchantment;onAttack(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/Entity;I)Vintermediary method_58675Lnet/minecraft/class_1887;method_58675(Lnet/minecraft/class_1309;Lnet/minecraft/class_1297;I)Vofficial cLdac;c(Lbtr;Lbsw;I)V
-
isTreasure
public boolean isTreasure()- Mappings:
Namespace Name Mixin selector named isTreasureLnet/minecraft/enchantment/Enchantment;isTreasure()Zintermediary method_8193Lnet/minecraft/class_1887;method_8193()Zofficial aLdac;a()Z
-
isCursed
public boolean isCursed()- Mappings:
Namespace Name Mixin selector named isCursedLnet/minecraft/enchantment/Enchantment;isCursed()Zintermediary method_8195Lnet/minecraft/class_1887;method_8195()Zofficial bLdac;b()Z
-
isAvailableForEnchantedBookOffer
public boolean isAvailableForEnchantedBookOffer()Returns whether this enchantment will appear in the enchanted book trade offers of librarian villagers.- Returns:
- whether this enchantment will appear in the enchanted book trade offers of librarian villagers
- Mappings:
Namespace Name Mixin selector named isAvailableForEnchantedBookOfferLnet/minecraft/enchantment/Enchantment;isAvailableForEnchantedBookOffer()Zintermediary method_25949Lnet/minecraft/class_1887;method_25949()Zofficial kLdac;k()Z
-
isAvailableForRandomSelection
public boolean isAvailableForRandomSelection()Returns whether this enchantment will appear in the enchanting table or loots with random enchant function.- Returns:
- whether this enchantment will appear in the enchanting table or loots with random enchant function
- Mappings:
Namespace Name Mixin selector named isAvailableForRandomSelectionLnet/minecraft/enchantment/Enchantment;isAvailableForRandomSelection()Zintermediary method_25950Lnet/minecraft/class_1887;method_25950()Zofficial lLdac;l()Z
-
getRegistryEntry
Deprecated.- Mappings:
Namespace Name Mixin selector named getRegistryEntryLnet/minecraft/enchantment/Enchantment;getRegistryEntry()Lnet/minecraft/registry/entry/RegistryEntry$Reference;intermediary method_53216Lnet/minecraft/class_1887;method_53216()Lnet/minecraft/class_6880$class_6883;official mLdac;m()Lji$c;
-
getRequiredFeatures
- Specified by:
getRequiredFeaturesin interfaceToggleableFeature- Mappings:
Namespace Name Mixin selector named getRequiredFeaturesLnet/minecraft/resource/featuretoggle/ToggleableFeature;getRequiredFeatures()Lnet/minecraft/resource/featuretoggle/FeatureSet;intermediary method_45322Lnet/minecraft/class_7695;method_45322()Lnet/minecraft/class_7699;official iLcpk;i()Lcpn;
-