Class EnchantmentHelper

java.lang.Object
net.minecraft.enchantment.EnchantmentHelper

public class EnchantmentHelper extends Object
Mappings:
Namespace Name
official alm
intermediary net/minecraft/class_1129
named net/minecraft/enchantment/EnchantmentHelper
  • Field Details

    • PROTECTION_CONSUMER

      private static final EnchantmentHelper.ProtectionModifier PROTECTION_CONSUMER
      Mappings:
      Namespace Name Mixin selector
      official a Lalm;a:Lalm$e;
      intermediary field_4490 Lnet/minecraft/class_1129;field_4490:Lnet/minecraft/class_1129$class_1133;
      named PROTECTION_CONSUMER Lnet/minecraft/enchantment/EnchantmentHelper;PROTECTION_CONSUMER:Lnet/minecraft/enchantment/EnchantmentHelper$ProtectionModifier;
    • DAMAGE_CONSUMER

      private static final EnchantmentHelper.DamageModifier DAMAGE_CONSUMER
      Mappings:
      Namespace Name Mixin selector
      official b Lalm;b:Lalm$d;
      intermediary field_4491 Lnet/minecraft/class_1129;field_4491:Lnet/minecraft/class_1129$class_1132;
      named DAMAGE_CONSUMER Lnet/minecraft/enchantment/EnchantmentHelper;DAMAGE_CONSUMER:Lnet/minecraft/enchantment/EnchantmentHelper$DamageModifier;
    • ON_DAMAGE_CONSUMER

      private static final EnchantmentHelper.OnDamagedWith ON_DAMAGE_CONSUMER
      Mappings:
      Namespace Name Mixin selector
      official c Lalm;c:Lalm$b;
      intermediary field_7159 Lnet/minecraft/class_1129;field_7159:Lnet/minecraft/class_1129$class_1738;
      named ON_DAMAGE_CONSUMER Lnet/minecraft/enchantment/EnchantmentHelper;ON_DAMAGE_CONSUMER:Lnet/minecraft/enchantment/EnchantmentHelper$OnDamagedWith;
    • ON_ATTACK_CONSUMER

      private static final EnchantmentHelper.OnAttackedWith ON_ATTACK_CONSUMER
      Mappings:
      Namespace Name Mixin selector
      official d Lalm;d:Lalm$a;
      intermediary field_7160 Lnet/minecraft/class_1129;field_7160:Lnet/minecraft/class_1129$class_1737;
      named ON_ATTACK_CONSUMER Lnet/minecraft/enchantment/EnchantmentHelper;ON_ATTACK_CONSUMER:Lnet/minecraft/enchantment/EnchantmentHelper$OnAttackedWith;
  • Constructor Details

    • EnchantmentHelper

      public EnchantmentHelper()
  • Method Details

    • getLevel

      public static int getLevel(Enchantment enchantment, ItemStack stack)
      Gets the level of an enchantment on an item stack.
      Mappings:
      Namespace Name Mixin selector
      official a Lalm;a(Lalk;Laip;)I
      intermediary method_11452 Lnet/minecraft/class_1129;method_11452(Lnet/minecraft/class_1127;Lnet/minecraft/class_1071;)I
      named getLevel Lnet/minecraft/enchantment/EnchantmentHelper;getLevel(Lnet/minecraft/enchantment/Enchantment;Lnet/minecraft/item/ItemStack;)I
    • get

      public static Map<Enchantment,Integer> get(ItemStack stack)
      Gets the enchantments on an item stack.

      For enchanted books, it retrieves from the item stack's stored than regular enchantments.

      See Also:
      Mappings:
      Namespace Name Mixin selector
      official a Lalm;a(Laip;)Ljava/util/Map;
      intermediary method_4648 Lnet/minecraft/class_1129;method_4648(Lnet/minecraft/class_1071;)Ljava/util/Map;
      named get Lnet/minecraft/enchantment/EnchantmentHelper;get(Lnet/minecraft/item/ItemStack;)Ljava/util/Map;
    • set

      public static void set(Map<Enchantment,Integer> enchantments, ItemStack stack)
      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:
      Mappings:
      Namespace Name Mixin selector
      official a Lalm;a(Ljava/util/Map;Laip;)V
      intermediary method_4645 Lnet/minecraft/class_1129;method_4645(Ljava/util/Map;Lnet/minecraft/class_1071;)V
      named set Lnet/minecraft/enchantment/EnchantmentHelper;set(Ljava/util/Map;Lnet/minecraft/item/ItemStack;)V
    • forEachEnchantment

      private static void forEachEnchantment(EnchantmentHelper.Consumer consumer, ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      official a Lalm;a(Lalm$c;Laip;)V
      intermediary method_3526 Lnet/minecraft/class_1129;method_3526(Lnet/minecraft/class_1129$class_1131;Lnet/minecraft/class_1071;)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 Lalm;a(Lalm$c;Ljava/lang/Iterable;)V
      intermediary method_11454 Lnet/minecraft/class_1129;method_11454(Lnet/minecraft/class_1129$class_1131;Ljava/lang/Iterable;)V
      named forEachEnchantment Lnet/minecraft/enchantment/EnchantmentHelper;forEachEnchantment(Lnet/minecraft/enchantment/EnchantmentHelper$Consumer;Ljava/lang/Iterable;)V
    • getProtectionAmount

      public static int getProtectionAmount(Iterable<ItemStack> stacks, DamageSource source)
      Mappings:
      Namespace Name Mixin selector
      official a Lalm;a(Ljava/lang/Iterable;Lur;)I
      intermediary method_11455 Lnet/minecraft/class_1129;method_11455(Ljava/lang/Iterable;Lnet/minecraft/class_856;)I
      named getProtectionAmount Lnet/minecraft/enchantment/EnchantmentHelper;getProtectionAmount(Ljava/lang/Iterable;Lnet/minecraft/entity/damage/DamageSource;)I
    • getAttackDamage

      public static float getAttackDamage(ItemStack stack, EntityGroup group)
      Mappings:
      Namespace Name Mixin selector
      official a Lalm;a(Laip;Lvu;)F
      intermediary method_6384 Lnet/minecraft/class_1129;method_6384(Lnet/minecraft/class_1071;Lnet/minecraft/class_873;)F
      named getAttackDamage Lnet/minecraft/enchantment/EnchantmentHelper;getAttackDamage(Lnet/minecraft/item/ItemStack;Lnet/minecraft/entity/EntityGroup;)F
    • getSweepingMultiplier

      public static float getSweepingMultiplier(LivingEntity entity)
      Mappings:
      Namespace Name Mixin selector
      official a Lalm;a(Lvp;)F
      intermediary method_13676 Lnet/minecraft/class_1129;method_13676(Lnet/minecraft/class_1699;)F
      named getSweepingMultiplier Lnet/minecraft/enchantment/EnchantmentHelper;getSweepingMultiplier(Lnet/minecraft/entity/LivingEntity;)F
    • onUserDamaged

      public static void onUserDamaged(LivingEntity user, Entity attacker)
      Mappings:
      Namespace Name Mixin selector
      official a Lalm;a(Lvp;Lvg;)V
      intermediary method_6386 Lnet/minecraft/class_1129;method_6386(Lnet/minecraft/class_1699;Lnet/minecraft/class_864;)V
      named onUserDamaged Lnet/minecraft/enchantment/EnchantmentHelper;onUserDamaged(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/Entity;)V
    • onTargetDamaged

      public static void onTargetDamaged(LivingEntity user, Entity attacker)
      Mappings:
      Namespace Name Mixin selector
      official b Lalm;b(Lvp;Lvg;)V
      intermediary method_6388 Lnet/minecraft/class_1129;method_6388(Lnet/minecraft/class_1699;Lnet/minecraft/class_864;)V
      named onTargetDamaged Lnet/minecraft/enchantment/EnchantmentHelper;onTargetDamaged(Lnet/minecraft/entity/LivingEntity;Lnet/minecraft/entity/Entity;)V
    • getEquipmentLevel

      public static int getEquipmentLevel(Enchantment enchantment, LivingEntity entity)
      Returns the highest level of the passed enchantment in the enchantment's applicable equipment slots' item stacks.
      Parameters:
      entity - the entity whose equipment slots are checked
      enchantment - the enchantment
      Returns:
      the highest level of the passed enchantment in the enchantment's applicable equipment slots' item stacks
      Mappings:
      Namespace Name Mixin selector
      official a Lalm;a(Lalk;Lvp;)I
      intermediary method_11453 Lnet/minecraft/class_1129;method_11453(Lnet/minecraft/class_1127;Lnet/minecraft/class_1699;)I
      named getEquipmentLevel Lnet/minecraft/enchantment/EnchantmentHelper;getEquipmentLevel(Lnet/minecraft/enchantment/Enchantment;Lnet/minecraft/entity/LivingEntity;)I
    • getKnockback

      public static int getKnockback(LivingEntity entity)
      Mappings:
      Namespace Name Mixin selector
      official b Lalm;b(Lvp;)I
      intermediary method_5493 Lnet/minecraft/class_1129;method_5493(Lnet/minecraft/class_1699;)I
      named getKnockback Lnet/minecraft/enchantment/EnchantmentHelper;getKnockback(Lnet/minecraft/entity/LivingEntity;)I
    • getFireAspect

      public static int getFireAspect(LivingEntity entity)
      Mappings:
      Namespace Name Mixin selector
      official c Lalm;c(Lvp;)I
      intermediary method_5491 Lnet/minecraft/class_1129;method_5491(Lnet/minecraft/class_1699;)I
      named getFireAspect Lnet/minecraft/enchantment/EnchantmentHelper;getFireAspect(Lnet/minecraft/entity/LivingEntity;)I
    • getRespiration

      public static int getRespiration(LivingEntity entity)
      Mappings:
      Namespace Name Mixin selector
      official d Lalm;d(Lvp;)I
      intermediary method_11458 Lnet/minecraft/class_1129;method_11458(Lnet/minecraft/class_1699;)I
      named getRespiration Lnet/minecraft/enchantment/EnchantmentHelper;getRespiration(Lnet/minecraft/entity/LivingEntity;)I
    • getDepthStrider

      public static int getDepthStrider(LivingEntity entity)
      Mappings:
      Namespace Name Mixin selector
      official e Lalm;e(Lvp;)I
      intermediary method_11459 Lnet/minecraft/class_1129;method_11459(Lnet/minecraft/class_1699;)I
      named getDepthStrider Lnet/minecraft/enchantment/EnchantmentHelper;getDepthStrider(Lnet/minecraft/entity/LivingEntity;)I
    • getEfficiency

      public static int getEfficiency(LivingEntity entity)
      Mappings:
      Namespace Name Mixin selector
      official f Lalm;f(Lvp;)I
      intermediary method_11460 Lnet/minecraft/class_1129;method_11460(Lnet/minecraft/class_1699;)I
      named getEfficiency Lnet/minecraft/enchantment/EnchantmentHelper;getEfficiency(Lnet/minecraft/entity/LivingEntity;)I
    • getLuckOfTheSea

      public static int getLuckOfTheSea(ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      official b Lalm;b(Laip;)I
      intermediary method_13677 Lnet/minecraft/class_1129;method_13677(Lnet/minecraft/class_1071;)I
      named getLuckOfTheSea Lnet/minecraft/enchantment/EnchantmentHelper;getLuckOfTheSea(Lnet/minecraft/item/ItemStack;)I
    • getLure

      public static int getLure(ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      official c Lalm;c(Laip;)I
      intermediary method_13678 Lnet/minecraft/class_1129;method_13678(Lnet/minecraft/class_1071;)I
      named getLure Lnet/minecraft/enchantment/EnchantmentHelper;getLure(Lnet/minecraft/item/ItemStack;)I
    • getLooting

      public static int getLooting(LivingEntity stack)
      Mappings:
      Namespace Name Mixin selector
      official g Lalm;g(Lvp;)I
      intermediary method_11461 Lnet/minecraft/class_1129;method_11461(Lnet/minecraft/class_1699;)I
      named getLooting Lnet/minecraft/enchantment/EnchantmentHelper;getLooting(Lnet/minecraft/entity/LivingEntity;)I
    • hasAquaAffinity

      public static boolean hasAquaAffinity(LivingEntity entity)
      Mappings:
      Namespace Name Mixin selector
      official h Lalm;h(Lvp;)Z
      intermediary method_11462 Lnet/minecraft/class_1129;method_11462(Lnet/minecraft/class_1699;)Z
      named hasAquaAffinity Lnet/minecraft/enchantment/EnchantmentHelper;hasAquaAffinity(Lnet/minecraft/entity/LivingEntity;)Z
    • hasFrostWalker

      public static boolean hasFrostWalker(LivingEntity entity)
      Mappings:
      Namespace Name Mixin selector
      official i Lalm;i(Lvp;)Z
      intermediary method_13312 Lnet/minecraft/class_1129;method_13312(Lnet/minecraft/class_1699;)Z
      named hasFrostWalker Lnet/minecraft/enchantment/EnchantmentHelper;hasFrostWalker(Lnet/minecraft/entity/LivingEntity;)Z
    • hasBindingCurse

      public static boolean hasBindingCurse(ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      official d Lalm;d(Laip;)Z
      intermediary method_13679 Lnet/minecraft/class_1129;method_13679(Lnet/minecraft/class_1071;)Z
      named hasBindingCurse Lnet/minecraft/enchantment/EnchantmentHelper;hasBindingCurse(Lnet/minecraft/item/ItemStack;)Z
    • hasVanishingCurse

      public static boolean hasVanishingCurse(ItemStack stack)
      Mappings:
      Namespace Name Mixin selector
      official e Lalm;e(Laip;)Z
      intermediary method_13680 Lnet/minecraft/class_1129;method_13680(Lnet/minecraft/class_1071;)Z
      named hasVanishingCurse Lnet/minecraft/enchantment/EnchantmentHelper;hasVanishingCurse(Lnet/minecraft/item/ItemStack;)Z
    • chooseEquipmentWith

      public static ItemStack chooseEquipmentWith(Enchantment enchantment, LivingEntity entity)
      Mappings:
      Namespace Name Mixin selector
      official b Lalm;b(Lalk;Lvp;)Laip;
      intermediary method_5490 Lnet/minecraft/class_1129;method_5490(Lnet/minecraft/class_1127;Lnet/minecraft/class_1699;)Lnet/minecraft/class_1071;
      named chooseEquipmentWith Lnet/minecraft/enchantment/EnchantmentHelper;chooseEquipmentWith(Lnet/minecraft/enchantment/Enchantment;Lnet/minecraft/entity/LivingEntity;)Lnet/minecraft/item/ItemStack;
    • 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 seed
      slotIndex - the index of the enchanting option
      bookshelfCount - the number of bookshelves
      stack - the item stack to enchant
      Returns:
      the required experience level for an enchanting option in the enchanting table's screen, or the enchantment screen
      Mappings:
      Namespace Name Mixin selector
      official a Lalm;a(Ljava/util/Random;IILaip;)I
      intermediary method_3521 Lnet/minecraft/class_1129;method_3521(Ljava/util/Random;IILnet/minecraft/class_1071;)I
      named calculateRequiredExperienceLevel Lnet/minecraft/enchantment/EnchantmentHelper;calculateRequiredExperienceLevel(Ljava/util/Random;IILnet/minecraft/item/ItemStack;)I
    • enchant

      public static ItemStack enchant(Random random, ItemStack stack, int level, boolean treasureAllowed)
      Enchants the target item stack and returns it.
      Parameters:
      level - the experience level
      treasureAllowed - whether treasure enchantments may appear
      random - the seed
      target - the item stack to enchant
      Mappings:
      Namespace Name Mixin selector
      official a Lalm;a(Ljava/util/Random;Laip;IZ)Laip;
      intermediary method_6385 Lnet/minecraft/class_1129;method_6385(Ljava/util/Random;Lnet/minecraft/class_1071;IZ)Lnet/minecraft/class_1071;
      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 the stack.
      Mappings:
      Namespace Name Mixin selector
      official b Lalm;b(Ljava/util/Random;Laip;IZ)Ljava/util/List;
      intermediary method_11457 Lnet/minecraft/class_1129;method_11457(Ljava/util/Random;Lnet/minecraft/class_1071;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 entries
      pickedEntry - the picked entry
      Mappings:
      Namespace Name Mixin selector
      official a Lalm;a(Ljava/util/List;Laln;)V
      intermediary method_11456 Lnet/minecraft/class_1129;method_11456(Ljava/util/List;Lnet/minecraft/class_1134;)V
      named removeConflicts Lnet/minecraft/enchantment/EnchantmentHelper;removeConflicts(Ljava/util/List;Lnet/minecraft/enchantment/EnchantmentLevelEntry;)V
    • getPossibleEntries

      public static List<EnchantmentLevelEntry> getPossibleEntries(int power, ItemStack stack, boolean treasureAllowed)
      Gets all the possible entries for enchanting the stack at the given power.
      Mappings:
      Namespace Name Mixin selector
      official a Lalm;a(ILaip;Z)Ljava/util/List;
      intermediary method_11451 Lnet/minecraft/class_1129;method_11451(ILnet/minecraft/class_1071;Z)Ljava/util/List;
      named getPossibleEntries Lnet/minecraft/enchantment/EnchantmentHelper;getPossibleEntries(ILnet/minecraft/item/ItemStack;Z)Ljava/util/List;