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/Enchantment
intermediary net/minecraft/class_1887
official dab
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic final record
static final record
-
Field Summary
Modifier and TypeFieldDescriptionprivate final Enchantment.Properties
private final RegistryEntry.Reference
<Enchantment> Fields inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
FEATURE_ENABLED_REGISTRY_KEYS
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic @Nullable Enchantment
byRawId
(int id) protected boolean
canAccept
(Enchantment other) Returns whether this enchantment can exist on an item stack with theother
enchantment.final boolean
canCombine
(Enchantment other) Returns whether this enchantment can exist on an item stack with theother
enchantment and theother
enchantment can exist with this enchantment.static Enchantment.Cost
constantCost
(int base) final int
float
getAttackDamage
(int level, @Nullable EntityType<?> entityType) getEquipment
(LivingEntity entity) final int
final int
getMaxPower
(int level) final int
final int
getMinPower
(int level) getName
(int level) protected String
int
getProtectionAmount
(int level, DamageSource source) Deprecated.final int
boolean
isAcceptableItem
(ItemStack stack) boolean
Returns whether this enchantment will appear in the enchanted book trade offers of librarian villagers.boolean
Returns whether this enchantment will appear in the enchanting table or loots with random enchant function.boolean
isCursed()
final boolean
isPrimaryItem
(ItemStack stack) boolean
static Enchantment.Cost
leveledCost
(int base, int perLevel) void
onAttack
(LivingEntity attacket, Entity target, int level) void
onTargetDamaged
(LivingEntity user, Entity target, int level) void
onUserDamaged
(LivingEntity user, Entity attacker, int level) static Enchantment.Properties
properties
(TagKey<Item> supportedItems, int weight, int maxLevel, Enchantment.Cost minCost, Enchantment.Cost maxCost, int anvilCost, EquipmentSlot[] slots) static Enchantment.Properties
properties
(TagKey<Item> supportedItems, int weight, int maxLevel, Enchantment.Cost minCost, Enchantment.Cost maxCost, int anvilCost, FeatureSet requiredFeatures, EquipmentSlot[] slots) static Enchantment.Properties
properties
(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, wait
Methods inherited from interface net.minecraft.resource.featuretoggle.ToggleableFeature
isEnabled
-
Field Details
-
properties
- Mappings:
Namespace Name Mixin selector named properties
Lnet/minecraft/enchantment/Enchantment;properties:Lnet/minecraft/enchantment/Enchantment$Properties;
intermediary field_50013
Lnet/minecraft/class_1887;field_50013:Lnet/minecraft/class_1887$class_9427;
official b
Ldab;b:Ldab$b;
-
translationKey
- Mappings:
Namespace Name Mixin selector named translationKey
Lnet/minecraft/enchantment/Enchantment;translationKey:Ljava/lang/String;
intermediary field_9084
Lnet/minecraft/class_1887;field_9084:Ljava/lang/String;
official a
Ldab;a:Ljava/lang/String;
-
registryEntry
- Mappings:
Namespace Name Mixin selector named registryEntry
Lnet/minecraft/enchantment/Enchantment;registryEntry:Lnet/minecraft/registry/entry/RegistryEntry$Reference;
intermediary field_45769
Lnet/minecraft/class_1887;field_45769:Lnet/minecraft/class_6880$class_6883;
official c
Ldab;c:Lji$c;
-
-
Constructor Details
-
Enchantment
- Mappings:
Namespace Name Mixin selector named <init>
Lnet/minecraft/enchantment/Enchantment;<init>(Lnet/minecraft/enchantment/Enchantment$Properties;)V
intermediary <init>
Lnet/minecraft/class_1887;<init>(Lnet/minecraft/class_1887$class_9427;)V
official <init>
Ldab;<init>(Ldab$b;)V
-
-
Method Details
-
constantCost
- Mappings:
Namespace Name Mixin selector named constantCost
Lnet/minecraft/enchantment/Enchantment;constantCost(I)Lnet/minecraft/enchantment/Enchantment$Cost;
intermediary method_58440
Lnet/minecraft/class_1887;method_58440(I)Lnet/minecraft/class_1887$class_9426;
official a
Ldab;a(I)Ldab$a;
-
leveledCost
- Mappings:
Namespace Name Mixin selector named leveledCost
Lnet/minecraft/enchantment/Enchantment;leveledCost(II)Lnet/minecraft/enchantment/Enchantment$Cost;
intermediary method_58441
Lnet/minecraft/class_1887;method_58441(II)Lnet/minecraft/class_1887$class_9426;
official a
Ldab;a(II)Ldab$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 properties
Lnet/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_58443
Lnet/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 a
Ldab;a(Laxf;Laxf;IILdab$a;Ldab$a;I[Lbtc;)Ldab$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 properties
Lnet/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_58442
Lnet/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 a
Ldab;a(Laxf;IILdab$a;Ldab$a;I[Lbtc;)Ldab$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 properties
Lnet/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_58674
Lnet/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 a
Ldab;a(Laxf;IILdab$a;Ldab$a;ILcpm;[Lbtc;)Ldab$b;
-
byRawId
- Mappings:
Namespace Name Mixin selector named byRawId
Lnet/minecraft/enchantment/Enchantment;byRawId(I)Lnet/minecraft/enchantment/Enchantment;
intermediary method_8191
Lnet/minecraft/class_1887;method_8191(I)Lnet/minecraft/class_1887;
official b
Ldab;b(I)Ldab;
-
getEquipment
- Mappings:
Namespace Name Mixin selector named getEquipment
Lnet/minecraft/enchantment/Enchantment;getEquipment(Lnet/minecraft/entity/LivingEntity;)Ljava/util/Map;
intermediary method_8185
Lnet/minecraft/class_1887;method_8185(Lnet/minecraft/class_1309;)Ljava/util/Map;
official a
Ldab;a(Lbtq;)Ljava/util/Map;
-
getApplicableItems
- Mappings:
Namespace Name Mixin selector named getApplicableItems
Lnet/minecraft/enchantment/Enchantment;getApplicableItems()Lnet/minecraft/registry/tag/TagKey;
intermediary method_56109
Lnet/minecraft/class_1887;method_56109()Lnet/minecraft/class_6862;
official c
Ldab;c()Laxf;
-
isPrimaryItem
- Mappings:
Namespace Name Mixin selector named isPrimaryItem
Lnet/minecraft/enchantment/Enchantment;isPrimaryItem(Lnet/minecraft/item/ItemStack;)Z
intermediary method_58444
Lnet/minecraft/class_1887;method_58444(Lnet/minecraft/class_1799;)Z
official a
Ldab;a(Lcuq;)Z
-
getWeight
public final int getWeight()- Mappings:
Namespace Name Mixin selector named getWeight
Lnet/minecraft/enchantment/Enchantment;getWeight()I
intermediary method_58445
Lnet/minecraft/class_1887;method_58445()I
official d
Ldab;d()I
-
getAnvilCost
public final int getAnvilCost()- Mappings:
Namespace Name Mixin selector named getAnvilCost
Lnet/minecraft/enchantment/Enchantment;getAnvilCost()I
intermediary method_58446
Lnet/minecraft/class_1887;method_58446()I
official e
Ldab;e()I
-
getMinLevel
public final int getMinLevel()- Mappings:
Namespace Name Mixin selector named getMinLevel
Lnet/minecraft/enchantment/Enchantment;getMinLevel()I
intermediary method_8187
Lnet/minecraft/class_1887;method_8187()I
official f
Ldab;f()I
-
getMaxLevel
public final int getMaxLevel()- Mappings:
Namespace Name Mixin selector named getMaxLevel
Lnet/minecraft/enchantment/Enchantment;getMaxLevel()I
intermediary method_8183
Lnet/minecraft/class_1887;method_8183()I
official g
Ldab;g()I
-
getMinPower
public final int getMinPower(int level) - Mappings:
Namespace Name Mixin selector named getMinPower
Lnet/minecraft/enchantment/Enchantment;getMinPower(I)I
intermediary method_8182
Lnet/minecraft/class_1887;method_8182(I)I
official c
Ldab;c(I)I
-
getMaxPower
public final int getMaxPower(int level) - Mappings:
Namespace Name Mixin selector named getMaxPower
Lnet/minecraft/enchantment/Enchantment;getMaxPower(I)I
intermediary method_20742
Lnet/minecraft/class_1887;method_20742(I)I
official d
Ldab;d(I)I
-
getProtectionAmount
- Mappings:
Namespace Name Mixin selector named getProtectionAmount
Lnet/minecraft/enchantment/Enchantment;getProtectionAmount(ILnet/minecraft/entity/damage/DamageSource;)I
intermediary method_8181
Lnet/minecraft/class_1887;method_8181(ILnet/minecraft/class_1282;)I
official a
Ldab;a(ILbro;)I
-
getAttackDamage
- Mappings:
Namespace Name Mixin selector named getAttackDamage
Lnet/minecraft/enchantment/Enchantment;getAttackDamage(ILnet/minecraft/entity/EntityType;)F
intermediary method_8196
Lnet/minecraft/class_1887;method_8196(ILnet/minecraft/class_1299;)F
official a
Ldab;a(ILbtb;)F
-
canCombine
Returns whether this enchantment can exist on an item stack with theother
enchantment and theother
enchantment can exist with this enchantment.- Returns:
- whether this enchantment can exist on an item stack with the
other
enchantment and theother
enchantment can exist with this enchantment - Mappings:
Namespace Name Mixin selector named canCombine
Lnet/minecraft/enchantment/Enchantment;canCombine(Lnet/minecraft/enchantment/Enchantment;)Z
intermediary method_8188
Lnet/minecraft/class_1887;method_8188(Lnet/minecraft/class_1887;)Z
official b
Ldab;b(Ldab;)Z
-
canAccept
Returns whether this enchantment can exist on an item stack with theother
enchantment.- Returns:
- whether this enchantment can exist on an item stack with the
other
enchantment - Mappings:
Namespace Name Mixin selector named canAccept
Lnet/minecraft/enchantment/Enchantment;canAccept(Lnet/minecraft/enchantment/Enchantment;)Z
intermediary method_8180
Lnet/minecraft/class_1887;method_8180(Lnet/minecraft/class_1887;)Z
official a
Ldab;a(Ldab;)Z
-
getOrCreateTranslationKey
- Mappings:
Namespace Name Mixin selector named getOrCreateTranslationKey
Lnet/minecraft/enchantment/Enchantment;getOrCreateTranslationKey()Ljava/lang/String;
intermediary method_8190
Lnet/minecraft/class_1887;method_8190()Ljava/lang/String;
official h
Ldab;h()Ljava/lang/String;
-
getTranslationKey
- Mappings:
Namespace Name Mixin selector named getTranslationKey
Lnet/minecraft/enchantment/Enchantment;getTranslationKey()Ljava/lang/String;
intermediary method_8184
Lnet/minecraft/class_1887;method_8184()Ljava/lang/String;
official j
Ldab;j()Ljava/lang/String;
-
getName
- Mappings:
Namespace Name Mixin selector named getName
Lnet/minecraft/enchantment/Enchantment;getName(I)Lnet/minecraft/text/Text;
intermediary method_8179
Lnet/minecraft/class_1887;method_8179(I)Lnet/minecraft/class_2561;
official e
Ldab;e(I)Lxp;
-
isAcceptableItem
- Mappings:
Namespace Name Mixin selector named isAcceptableItem
Lnet/minecraft/enchantment/Enchantment;isAcceptableItem(Lnet/minecraft/item/ItemStack;)Z
intermediary method_8192
Lnet/minecraft/class_1887;method_8192(Lnet/minecraft/class_1799;)Z
official b
Ldab;b(Lcuq;)Z
-
onTargetDamaged
- Mappings:
Namespace Name Mixin selector named onTargetDamaged
Lnet/minecraft/enchantment/Enchantment;onTargetDamaged(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/Entity;I)V
intermediary method_8189
Lnet/minecraft/class_1887;method_8189(Lnet/minecraft/class_1309;Lnet/minecraft/class_1297;I)V
official a
Ldab;a(Lbtq;Lbsv;I)V
-
onUserDamaged
- Mappings:
Namespace Name Mixin selector named onUserDamaged
Lnet/minecraft/enchantment/Enchantment;onUserDamaged(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/Entity;I)V
intermediary method_8178
Lnet/minecraft/class_1887;method_8178(Lnet/minecraft/class_1309;Lnet/minecraft/class_1297;I)V
official b
Ldab;b(Lbtq;Lbsv;I)V
-
onAttack
- Mappings:
Namespace Name Mixin selector named onAttack
Lnet/minecraft/enchantment/Enchantment;onAttack(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/Entity;I)V
intermediary method_58675
Lnet/minecraft/class_1887;method_58675(Lnet/minecraft/class_1309;Lnet/minecraft/class_1297;I)V
official c
Ldab;c(Lbtq;Lbsv;I)V
-
isTreasure
public boolean isTreasure()- Mappings:
Namespace Name Mixin selector named isTreasure
Lnet/minecraft/enchantment/Enchantment;isTreasure()Z
intermediary method_8193
Lnet/minecraft/class_1887;method_8193()Z
official a
Ldab;a()Z
-
isCursed
public boolean isCursed()- Mappings:
Namespace Name Mixin selector named isCursed
Lnet/minecraft/enchantment/Enchantment;isCursed()Z
intermediary method_8195
Lnet/minecraft/class_1887;method_8195()Z
official b
Ldab;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 isAvailableForEnchantedBookOffer
Lnet/minecraft/enchantment/Enchantment;isAvailableForEnchantedBookOffer()Z
intermediary method_25949
Lnet/minecraft/class_1887;method_25949()Z
official k
Ldab;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 isAvailableForRandomSelection
Lnet/minecraft/enchantment/Enchantment;isAvailableForRandomSelection()Z
intermediary method_25950
Lnet/minecraft/class_1887;method_25950()Z
official l
Ldab;l()Z
-
getRegistryEntry
Deprecated.- Mappings:
Namespace Name Mixin selector named getRegistryEntry
Lnet/minecraft/enchantment/Enchantment;getRegistryEntry()Lnet/minecraft/registry/entry/RegistryEntry$Reference;
intermediary method_53216
Lnet/minecraft/class_1887;method_53216()Lnet/minecraft/class_6880$class_6883;
official m
Ldab;m()Lji$c;
-
getRequiredFeatures
- Specified by:
getRequiredFeatures
in interfaceToggleableFeature
- Mappings:
Namespace Name Mixin selector named getRequiredFeatures
Lnet/minecraft/resource/featuretoggle/ToggleableFeature;getRequiredFeatures()Lnet/minecraft/resource/featuretoggle/FeatureSet;
intermediary method_45322
Lnet/minecraft/class_7695;method_45322()Lnet/minecraft/class_7699;
official i
Lcpj;i()Lcpm;
-