Package net.minecraft.enchantment
Class EnchantmentHelper
java.lang.Object
net.minecraft.enchantment.EnchantmentHelper
public class EnchantmentHelper extends Object
- Mappings:
Namespace Name official brr
intermediary net/minecraft/class_1890
named net/minecraft/enchantment/EnchantmentHelper
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static interface
EnchantmentHelper.Consumer
-
Constructor Summary
Constructors Constructor Description EnchantmentHelper()
-
Method Summary
Modifier and Type Method Description static int
calculateRequiredExperienceLevel(Random random, int slotIndex, int bookshelfCount, ItemStack stack)
Returns the required experience level for an enchanting option in the enchanting table's screen, or the enchantment screen.static Map.Entry<EquipmentSlot,ItemStack>
chooseEquipmentWith(Enchantment enchantment, LivingEntity entity)
Returns a pair of an equipment slot and the item stack in the supplied entity's slot, indicating the item stack has the enchantment supplied.static Map.Entry<EquipmentSlot,ItemStack>
chooseEquipmentWith(Enchantment enchantment, LivingEntity entity, Predicate<ItemStack> condition)
Returns a pair of an equipment slot and the item stack in the supplied entity's slot, indicating the item stack has the enchantment supplied and fulfills the extra condition.static ItemStack
enchant(Random random, ItemStack target, int level, boolean treasureAllowed)
Enchants thetarget
item stack and returns it.private static void
forEachEnchantment(EnchantmentHelper.Consumer consumer, Iterable<ItemStack> stacks)
private static void
forEachEnchantment(EnchantmentHelper.Consumer consumer, ItemStack stack)
static Map<Enchantment,Integer>
fromTag(ListTag tag)
Loads enchantments from an NBT list.static List<EnchantmentLevelEntry>
generateEnchantments(Random random, ItemStack stack, int level, boolean treasureAllowed)
Generate the enchantments for enchanting thestack
.static Map<Enchantment,Integer>
get(ItemStack stack)
Gets the enchantments on an item stack.static float
getAttackDamage(ItemStack stack, EntityGroup group)
static int
getDepthStrider(LivingEntity entity)
static int
getEfficiency(LivingEntity entity)
static int
getEquipmentLevel(Enchantment enchantment, LivingEntity entity)
Returns the highest level of the passed enchantment in the enchantment's applicable equipment slots' item stacks.static int
getFireAspect(LivingEntity entity)
static int
getKnockback(LivingEntity entity)
static int
getLevel(Enchantment enchantment, ItemStack stack)
Gets the level of an enchantment on an item stack.static int
getLooting(LivingEntity entity)
static int
getLoyalty(ItemStack stack)
static int
getLuckOfTheSea(ItemStack stack)
static int
getLure(ItemStack stack)
static List<EnchantmentLevelEntry>
getPossibleEntries(int power, ItemStack stack, boolean treasureAllowed)
Gets all the possible entries for enchanting thestack
at the givenpower
.static int
getProtectionAmount(Iterable<ItemStack> equipment, DamageSource source)
static int
getRespiration(LivingEntity entity)
static int
getRiptide(ItemStack stack)
static float
getSweepingMultiplier(LivingEntity entity)
static boolean
hasAquaAffinity(LivingEntity entity)
static boolean
hasBindingCurse(ItemStack stack)
static boolean
hasChanneling(ItemStack stack)
static boolean
hasFrostWalker(LivingEntity entity)
static boolean
hasSoulSpeed(LivingEntity entity)
static boolean
hasVanishingCurse(ItemStack stack)
static boolean
isCompatible(Collection<Enchantment> existing, Enchantment candidate)
Returns whether thecandidate
enchantment is compatible with theexisting
enchantments.static void
onTargetDamaged(LivingEntity user, Entity target)
static void
onUserDamaged(LivingEntity user, Entity attacker)
static void
removeConflicts(List<EnchantmentLevelEntry> possibleEntries, EnchantmentLevelEntry pickedEntry)
Remove entries conflicting with the picked entry from the possible entries.static void
set(Map<Enchantment,Integer> enchantments, ItemStack stack)
Sets the enchantments on an item stack.
-
Constructor Details
-
EnchantmentHelper
public EnchantmentHelper()
-
-
Method Details
-
getLevel
Gets the level of an enchantment on an item stack.- Mappings:
Namespace Name Mixin selector official a
Lbrr;a(Lbrp;Lbnv;)I
intermediary method_8225
Lnet/minecraft/class_1890;method_8225(Lnet/minecraft/class_1887;Lnet/minecraft/class_1799;)I
named getLevel
Lnet/minecraft/enchantment/EnchantmentHelper;getLevel(Lnet/minecraft/enchantment/Enchantment;Lnet/minecraft/item/ItemStack;)I
-
get
Gets the enchantments on an item stack.For enchanted books, it retrieves from the item stack's stored than regular enchantments.
- See Also:
ItemStack.getEnchantments()
,EnchantedBookItem.getEnchantmentTag(net.minecraft.item.ItemStack)
- Mappings:
Namespace Name Mixin selector official a
Lbrr;a(Lbnv;)Ljava/util/Map;
intermediary method_8222
Lnet/minecraft/class_1890;method_8222(Lnet/minecraft/class_1799;)Ljava/util/Map;
named get
Lnet/minecraft/enchantment/EnchantmentHelper;get(Lnet/minecraft/item/ItemStack;)Ljava/util/Map;
-
fromTag
Loads enchantments from an NBT list.- Mappings:
Namespace Name Mixin selector official a
Lbrr;a(Lmw;)Ljava/util/Map;
intermediary method_22445
Lnet/minecraft/class_1890;method_22445(Lnet/minecraft/class_2499;)Ljava/util/Map;
named fromTag
Lnet/minecraft/enchantment/EnchantmentHelper;fromTag(Lnet/minecraft/nbt/ListTag;)Ljava/util/Map;
-
set
Sets the enchantments on an item stack.For enchanted books, it sets the enchantments to the item stack's stored enchantments than regular enchantments.
- See Also:
ItemStack.getEnchantments()
,EnchantedBookItem.getEnchantmentTag(net.minecraft.item.ItemStack)
- Mappings:
Namespace Name Mixin selector official a
Lbrr;a(Ljava/util/Map;Lbnv;)V
intermediary method_8214
Lnet/minecraft/class_1890;method_8214(Ljava/util/Map;Lnet/minecraft/class_1799;)V
named set
Lnet/minecraft/enchantment/EnchantmentHelper;set(Ljava/util/Map;Lnet/minecraft/item/ItemStack;)V
-
forEachEnchantment
- Mappings:
Namespace Name Mixin selector official a
Lbrr;a(Lbrr$a;Lbnv;)V
intermediary method_8220
Lnet/minecraft/class_1890;method_8220(Lnet/minecraft/class_1890$class_1891;Lnet/minecraft/class_1799;)V
named forEachEnchantment
Lnet/minecraft/enchantment/EnchantmentHelper;forEachEnchantment(Lnet/minecraft/enchantment/EnchantmentHelper$Consumer;Lnet/minecraft/item/ItemStack;)V
-
forEachEnchantment
private static void forEachEnchantment(EnchantmentHelper.Consumer consumer, Iterable<ItemStack> stacks)- Mappings:
Namespace Name Mixin selector official a
Lbrr;a(Lbrr$a;Ljava/lang/Iterable;)V
intermediary method_8209
Lnet/minecraft/class_1890;method_8209(Lnet/minecraft/class_1890$class_1891;Ljava/lang/Iterable;)V
named forEachEnchantment
Lnet/minecraft/enchantment/EnchantmentHelper;forEachEnchantment(Lnet/minecraft/enchantment/EnchantmentHelper$Consumer;Ljava/lang/Iterable;)V
-
getProtectionAmount
- Mappings:
Namespace Name Mixin selector official a
Lbrr;a(Ljava/lang/Iterable;Laqf;)I
intermediary method_8219
Lnet/minecraft/class_1890;method_8219(Ljava/lang/Iterable;Lnet/minecraft/class_1282;)I
named getProtectionAmount
Lnet/minecraft/enchantment/EnchantmentHelper;getProtectionAmount(Ljava/lang/Iterable;Lnet/minecraft/entity/damage/DamageSource;)I
-
getAttackDamage
- Mappings:
Namespace Name Mixin selector official a
Lbrr;a(Lbnv;Larm;)F
intermediary method_8218
Lnet/minecraft/class_1890;method_8218(Lnet/minecraft/class_1799;Lnet/minecraft/class_1310;)F
named getAttackDamage
Lnet/minecraft/enchantment/EnchantmentHelper;getAttackDamage(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/EntityGroup;)F
-
getSweepingMultiplier
- Mappings:
Namespace Name Mixin selector official a
Lbrr;a(Lari;)F
intermediary method_8217
Lnet/minecraft/class_1890;method_8217(Lnet/minecraft/class_1309;)F
named getSweepingMultiplier
Lnet/minecraft/enchantment/EnchantmentHelper;getSweepingMultiplier(Lnet/minecraft/entity/LivingEntity;)F
-
onUserDamaged
- Mappings:
Namespace Name Mixin selector official a
Lbrr;a(Lari;Laqv;)V
intermediary method_8210
Lnet/minecraft/class_1890;method_8210(Lnet/minecraft/class_1309;Lnet/minecraft/class_1297;)V
named onUserDamaged
Lnet/minecraft/enchantment/EnchantmentHelper;onUserDamaged(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/Entity;)V
-
onTargetDamaged
- Mappings:
Namespace Name Mixin selector official b
Lbrr;b(Lari;Laqv;)V
intermediary method_8213
Lnet/minecraft/class_1890;method_8213(Lnet/minecraft/class_1309;Lnet/minecraft/class_1297;)V
named onTargetDamaged
Lnet/minecraft/enchantment/EnchantmentHelper;onTargetDamaged(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/Entity;)V
-
getEquipmentLevel
Returns the highest level of the passed enchantment in the enchantment's applicable equipment slots' item stacks.- Parameters:
enchantment
- the enchantmententity
- the entity whose equipment slots are checked- Mappings:
Namespace Name Mixin selector official a
Lbrr;a(Lbrp;Lari;)I
intermediary method_8203
Lnet/minecraft/class_1890;method_8203(Lnet/minecraft/class_1887;Lnet/minecraft/class_1309;)I
named getEquipmentLevel
Lnet/minecraft/enchantment/EnchantmentHelper;getEquipmentLevel(Lnet/minecraft/enchantment/Enchantment;Lnet/minecraft/entity/LivingEntity;)I
-
getKnockback
- Mappings:
Namespace Name Mixin selector official b
Lbrr;b(Lari;)I
intermediary method_8205
Lnet/minecraft/class_1890;method_8205(Lnet/minecraft/class_1309;)I
named getKnockback
Lnet/minecraft/enchantment/EnchantmentHelper;getKnockback(Lnet/minecraft/entity/LivingEntity;)I
-
getFireAspect
- Mappings:
Namespace Name Mixin selector official c
Lbrr;c(Lari;)I
intermediary method_8199
Lnet/minecraft/class_1890;method_8199(Lnet/minecraft/class_1309;)I
named getFireAspect
Lnet/minecraft/enchantment/EnchantmentHelper;getFireAspect(Lnet/minecraft/entity/LivingEntity;)I
-
getRespiration
- Mappings:
Namespace Name Mixin selector official d
Lbrr;d(Lari;)I
intermediary method_8211
Lnet/minecraft/class_1890;method_8211(Lnet/minecraft/class_1309;)I
named getRespiration
Lnet/minecraft/enchantment/EnchantmentHelper;getRespiration(Lnet/minecraft/entity/LivingEntity;)I
-
getDepthStrider
- Mappings:
Namespace Name Mixin selector official e
Lbrr;e(Lari;)I
intermediary method_8232
Lnet/minecraft/class_1890;method_8232(Lnet/minecraft/class_1309;)I
named getDepthStrider
Lnet/minecraft/enchantment/EnchantmentHelper;getDepthStrider(Lnet/minecraft/entity/LivingEntity;)I
-
getEfficiency
- Mappings:
Namespace Name Mixin selector official f
Lbrr;f(Lari;)I
intermediary method_8234
Lnet/minecraft/class_1890;method_8234(Lnet/minecraft/class_1309;)I
named getEfficiency
Lnet/minecraft/enchantment/EnchantmentHelper;getEfficiency(Lnet/minecraft/entity/LivingEntity;)I
-
getLuckOfTheSea
- Mappings:
Namespace Name Mixin selector official b
Lbrr;b(Lbnv;)I
intermediary method_8223
Lnet/minecraft/class_1890;method_8223(Lnet/minecraft/class_1799;)I
named getLuckOfTheSea
Lnet/minecraft/enchantment/EnchantmentHelper;getLuckOfTheSea(Lnet/minecraft/item/ItemStack;)I
-
getLure
- Mappings:
Namespace Name Mixin selector official c
Lbrr;c(Lbnv;)I
intermediary method_8215
Lnet/minecraft/class_1890;method_8215(Lnet/minecraft/class_1799;)I
named getLure
Lnet/minecraft/enchantment/EnchantmentHelper;getLure(Lnet/minecraft/item/ItemStack;)I
-
getLooting
- Mappings:
Namespace Name Mixin selector official g
Lbrr;g(Lari;)I
intermediary method_8226
Lnet/minecraft/class_1890;method_8226(Lnet/minecraft/class_1309;)I
named getLooting
Lnet/minecraft/enchantment/EnchantmentHelper;getLooting(Lnet/minecraft/entity/LivingEntity;)I
-
hasAquaAffinity
- Mappings:
Namespace Name Mixin selector official h
Lbrr;h(Lari;)Z
intermediary method_8200
Lnet/minecraft/class_1890;method_8200(Lnet/minecraft/class_1309;)Z
named hasAquaAffinity
Lnet/minecraft/enchantment/EnchantmentHelper;hasAquaAffinity(Lnet/minecraft/entity/LivingEntity;)Z
-
hasFrostWalker
- Mappings:
Namespace Name Mixin selector official i
Lbrr;i(Lari;)Z
intermediary method_8216
Lnet/minecraft/class_1890;method_8216(Lnet/minecraft/class_1309;)Z
named hasFrostWalker
Lnet/minecraft/enchantment/EnchantmentHelper;hasFrostWalker(Lnet/minecraft/entity/LivingEntity;)Z
-
hasSoulSpeed
- Mappings:
Namespace Name Mixin selector official j
Lbrr;j(Lari;)Z
intermediary method_25951
Lnet/minecraft/class_1890;method_25951(Lnet/minecraft/class_1309;)Z
named hasSoulSpeed
Lnet/minecraft/enchantment/EnchantmentHelper;hasSoulSpeed(Lnet/minecraft/entity/LivingEntity;)Z
-
hasBindingCurse
- Mappings:
Namespace Name Mixin selector official d
Lbrr;d(Lbnv;)Z
intermediary method_8224
Lnet/minecraft/class_1890;method_8224(Lnet/minecraft/class_1799;)Z
named hasBindingCurse
Lnet/minecraft/enchantment/EnchantmentHelper;hasBindingCurse(Lnet/minecraft/item/ItemStack;)Z
-
hasVanishingCurse
- Mappings:
Namespace Name Mixin selector official e
Lbrr;e(Lbnv;)Z
intermediary method_8221
Lnet/minecraft/class_1890;method_8221(Lnet/minecraft/class_1799;)Z
named hasVanishingCurse
Lnet/minecraft/enchantment/EnchantmentHelper;hasVanishingCurse(Lnet/minecraft/item/ItemStack;)Z
-
getLoyalty
- Mappings:
Namespace Name Mixin selector official f
Lbrr;f(Lbnv;)I
intermediary method_8206
Lnet/minecraft/class_1890;method_8206(Lnet/minecraft/class_1799;)I
named getLoyalty
Lnet/minecraft/enchantment/EnchantmentHelper;getLoyalty(Lnet/minecraft/item/ItemStack;)I
-
getRiptide
- Mappings:
Namespace Name Mixin selector official g
Lbrr;g(Lbnv;)I
intermediary method_8202
Lnet/minecraft/class_1890;method_8202(Lnet/minecraft/class_1799;)I
named getRiptide
Lnet/minecraft/enchantment/EnchantmentHelper;getRiptide(Lnet/minecraft/item/ItemStack;)I
-
hasChanneling
- Mappings:
Namespace Name Mixin selector official h
Lbrr;h(Lbnv;)Z
intermediary method_8228
Lnet/minecraft/class_1890;method_8228(Lnet/minecraft/class_1799;)Z
named hasChanneling
Lnet/minecraft/enchantment/EnchantmentHelper;hasChanneling(Lnet/minecraft/item/ItemStack;)Z
-
chooseEquipmentWith
@Nullable public static Map.Entry<EquipmentSlot,ItemStack> chooseEquipmentWith(Enchantment enchantment, LivingEntity entity)Returns a pair of an equipment slot and the item stack in the supplied entity's slot, indicating the item stack has the enchantment supplied.If multiple equipment slots' item stacks are valid, a random pair is returned.
- Parameters:
enchantment
- the enchantment the equipped item stack must haveentity
- the entity to choose equipments from- Mappings:
Namespace Name Mixin selector official b
Lbrr;b(Lbrp;Lari;)Ljava/util/Map$Entry;
intermediary method_8204
Lnet/minecraft/class_1890;method_8204(Lnet/minecraft/class_1887;Lnet/minecraft/class_1309;)Ljava/util/Map$Entry;
named chooseEquipmentWith
Lnet/minecraft/enchantment/EnchantmentHelper;chooseEquipmentWith(Lnet/minecraft/enchantment/Enchantment;Lnet/minecraft/entity/LivingEntity;)Ljava/util/Map$Entry;
-
chooseEquipmentWith
@Nullable public static Map.Entry<EquipmentSlot,ItemStack> chooseEquipmentWith(Enchantment enchantment, LivingEntity entity, Predicate<ItemStack> condition)Returns a pair of an equipment slot and the item stack in the supplied entity's slot, indicating the item stack has the enchantment supplied and fulfills the extra condition.If multiple equipment slots' item stacks are valid, a random pair is returned.
- Parameters:
enchantment
- the enchantment the equipped item stack must haveentity
- the entity to choose equipments fromcondition
- extra conditions for the item stack to pass for selection- Mappings:
Namespace Name Mixin selector official a
Lbrr;a(Lbrp;Lari;Ljava/util/function/Predicate;)Ljava/util/Map$Entry;
intermediary method_24365
Lnet/minecraft/class_1890;method_24365(Lnet/minecraft/class_1887;Lnet/minecraft/class_1309;Ljava/util/function/Predicate;)Ljava/util/Map$Entry;
named chooseEquipmentWith
Lnet/minecraft/enchantment/EnchantmentHelper;chooseEquipmentWith(Lnet/minecraft/enchantment/Enchantment;Lnet/minecraft/entity/LivingEntity;Ljava/util/function/Predicate;)Ljava/util/Map$Entry;
-
calculateRequiredExperienceLevel
public static int calculateRequiredExperienceLevel(Random random, int slotIndex, int bookshelfCount, ItemStack stack)Returns the required experience level for an enchanting option in the enchanting table's screen, or the enchantment screen.- Parameters:
random
- the random, which guarantees consistent results with the same seedslotIndex
- the index of the enchanting optionbookshelfCount
- the number of bookshelvesstack
- the item stack to enchant- Mappings:
Namespace Name Mixin selector official a
Lbrr;a(Ljava/util/Random;IILbnv;)I
intermediary method_8227
Lnet/minecraft/class_1890;method_8227(Ljava/util/Random;IILnet/minecraft/class_1799;)I
named calculateRequiredExperienceLevel
Lnet/minecraft/enchantment/EnchantmentHelper;calculateRequiredExperienceLevel(Ljava/util/Random;IILnet/minecraft/item/ItemStack;)I
-
enchant
public static ItemStack enchant(Random random, ItemStack target, int level, boolean treasureAllowed)Enchants thetarget
item stack and returns it.- Parameters:
random
- the seedtarget
- the item stack to enchantlevel
- the experience leveltreasureAllowed
- whether treasure enchantments may appear- Mappings:
Namespace Name Mixin selector official a
Lbrr;a(Ljava/util/Random;Lbnv;IZ)Lbnv;
intermediary method_8233
Lnet/minecraft/class_1890;method_8233(Ljava/util/Random;Lnet/minecraft/class_1799;IZ)Lnet/minecraft/class_1799;
named enchant
Lnet/minecraft/enchantment/EnchantmentHelper;enchant(Ljava/util/Random;Lnet/minecraft/item/ItemStack;IZ)Lnet/minecraft/item/ItemStack;
-
generateEnchantments
public static List<EnchantmentLevelEntry> generateEnchantments(Random random, ItemStack stack, int level, boolean treasureAllowed)Generate the enchantments for enchanting thestack
.- Mappings:
Namespace Name Mixin selector official b
Lbrr;b(Ljava/util/Random;Lbnv;IZ)Ljava/util/List;
intermediary method_8230
Lnet/minecraft/class_1890;method_8230(Ljava/util/Random;Lnet/minecraft/class_1799;IZ)Ljava/util/List;
named generateEnchantments
Lnet/minecraft/enchantment/EnchantmentHelper;generateEnchantments(Ljava/util/Random;Lnet/minecraft/item/ItemStack;IZ)Ljava/util/List;
-
removeConflicts
public static void removeConflicts(List<EnchantmentLevelEntry> possibleEntries, EnchantmentLevelEntry pickedEntry)Remove entries conflicting with the picked entry from the possible entries.- Parameters:
possibleEntries
- the possible entriespickedEntry
- the picked entry- Mappings:
Namespace Name Mixin selector official a
Lbrr;a(Ljava/util/List;Lbrs;)V
intermediary method_8231
Lnet/minecraft/class_1890;method_8231(Ljava/util/List;Lnet/minecraft/class_1889;)V
named removeConflicts
Lnet/minecraft/enchantment/EnchantmentHelper;removeConflicts(Ljava/util/List;Lnet/minecraft/enchantment/EnchantmentLevelEntry;)V
-
isCompatible
Returns whether thecandidate
enchantment is compatible with theexisting
enchantments.- Mappings:
Namespace Name Mixin selector official a
Lbrr;a(Ljava/util/Collection;Lbrp;)Z
intermediary method_8201
Lnet/minecraft/class_1890;method_8201(Ljava/util/Collection;Lnet/minecraft/class_1887;)Z
named isCompatible
Lnet/minecraft/enchantment/EnchantmentHelper;isCompatible(Ljava/util/Collection;Lnet/minecraft/enchantment/Enchantment;)Z
-
getPossibleEntries
public static List<EnchantmentLevelEntry> getPossibleEntries(int power, ItemStack stack, boolean treasureAllowed)Gets all the possible entries for enchanting thestack
at the givenpower
.- Mappings:
Namespace Name Mixin selector official a
Lbrr;a(ILbnv;Z)Ljava/util/List;
intermediary method_8229
Lnet/minecraft/class_1890;method_8229(ILnet/minecraft/class_1799;Z)Ljava/util/List;
named getPossibleEntries
Lnet/minecraft/enchantment/EnchantmentHelper;getPossibleEntries(ILnet/minecraft/item/ItemStack;Z)Ljava/util/List;
-