Class EnchantmentHelper
java.lang.Object
net.minecraft.world.item.enchantment.EnchantmentHelper
- 
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interface - 
Field Summary
Fields - 
Constructor Summary
Constructors - 
Method Summary
Modifier and TypeMethodDescriptionstatic Map<Enchantment,Integer> deserializeEnchantments(ListTag p_44883_) static voiddoPostDamageEffects(LivingEntity p_44897_, Entity p_44898_) static voiddoPostHurtEffects(LivingEntity p_44824_, Entity p_44825_) static ItemStackenchantItem(RandomSource p_220293_, ItemStack p_220294_, int p_220295_, boolean p_220296_) static voidfilterCompatibleEnchantments(List<EnchantmentInstance> p_44863_, EnchantmentInstance p_44864_) static List<EnchantmentInstance>getAvailableEnchantmentResults(int p_44818_, ItemStack p_44819_, boolean p_44820_) static intgetBlockEfficiency(LivingEntity p_44927_) static floatgetDamageBonus(ItemStack p_44834_, MobType p_44835_) static intgetDamageProtection(Iterable<ItemStack> p_44857_, DamageSource p_44858_) static intgetDepthStrider(LivingEntity p_44923_) static intgetEnchantmentCost(RandomSource p_220288_, int p_220289_, int p_220290_, ItemStack p_220291_) static ResourceLocationgetEnchantmentId(CompoundTag p_182447_) static ResourceLocationgetEnchantmentId(Enchantment p_182433_) static intgetEnchantmentLevel(CompoundTag p_182439_) static intgetEnchantmentLevel(Enchantment p_44837_, LivingEntity p_44838_) static Map<Enchantment,Integer> getEnchantments(ItemStack p_44832_) static intgetFireAspect(LivingEntity p_44915_) static intgetFishingLuckBonus(ItemStack p_44905_) static intgetFishingSpeedBonus(ItemStack p_44917_) static intgetItemEnchantmentLevel(Enchantment p_44844_, ItemStack p_44845_) Deprecated.static intgetKnockbackBonus(LivingEntity p_44895_) static intgetLoyalty(ItemStack p_44929_) static intgetMobLooting(LivingEntity p_44931_) static Map.Entry<EquipmentSlot,ItemStack> getRandomItemWith(Enchantment p_44907_, LivingEntity p_44908_) static Map.Entry<EquipmentSlot,ItemStack> getRandomItemWith(Enchantment p_44840_, LivingEntity p_44841_, Predicate<ItemStack> p_44842_) static intgetRespiration(LivingEntity p_44919_) static intgetRiptide(ItemStack p_44933_) static floatgetSneakingSpeedBonus(LivingEntity p_220303_) static floatgetSweepingDamageRatio(LivingEntity p_44822_) static intgetTagEnchantmentLevel(Enchantment p_44844_, ItemStack p_44845_) Gets the enchantment level from NBT.static booleanhasAquaAffinity(LivingEntity p_44935_) static booleanhasBindingCurse(ItemStack p_44921_) static booleanhasChanneling(ItemStack p_44937_) static booleanhasFrostWalker(LivingEntity p_44939_) static booleanhasSilkTouch(ItemStack p_273444_) static booleanhasSoulSpeed(LivingEntity p_44943_) static booleanhasVanishingCurse(ItemStack p_44925_) static booleanisEnchantmentCompatible(Collection<Enchantment> p_44860_, Enchantment p_44861_) private static voidrunIterationOnInventory(EnchantmentHelper.EnchantmentVisitor p_44854_, Iterable<ItemStack> p_44855_) private static voidrunIterationOnItem(EnchantmentHelper.EnchantmentVisitor p_44851_, ItemStack p_44852_) static List<EnchantmentInstance>selectEnchantment(RandomSource p_220298_, ItemStack p_220299_, int p_220300_, boolean p_220301_) static voidsetEnchantmentLevel(CompoundTag p_182441_, int p_182442_) static voidsetEnchantments(Map<Enchantment, Integer> p_44866_, ItemStack p_44867_) static CompoundTagstoreEnchantment(ResourceLocation p_182444_, int p_182445_)  
- 
Field Details
- 
TAG_ENCH_ID
- See Also:
 
 - 
TAG_ENCH_LEVEL
- See Also:
 
 - 
SWIFT_SNEAK_EXTRA_FACTOR
private static final float SWIFT_SNEAK_EXTRA_FACTOR- See Also:
 
 
 - 
 - 
Constructor Details
- 
EnchantmentHelper
public EnchantmentHelper() 
 - 
 - 
Method Details
- 
storeEnchantment
 - 
setEnchantmentLevel
 - 
getEnchantmentLevel
 - 
getEnchantmentId
 - 
getEnchantmentId
 - 
getItemEnchantmentLevel
Deprecated. - 
getTagEnchantmentLevel
Gets the enchantment level from NBT. Generally should useIForgeItemStack.getEnchantmentLevel(Enchantment)for gameplay logic - 
getEnchantments
 - 
deserializeEnchantments
 - 
setEnchantments
 - 
runIterationOnItem
private static void runIterationOnItem(EnchantmentHelper.EnchantmentVisitor p_44851_, ItemStack p_44852_)  - 
runIterationOnInventory
private static void runIterationOnInventory(EnchantmentHelper.EnchantmentVisitor p_44854_, Iterable<ItemStack> p_44855_)  - 
getDamageProtection
 - 
getDamageBonus
 - 
getSweepingDamageRatio
 - 
doPostHurtEffects
 - 
doPostDamageEffects
 - 
getEnchantmentLevel
 - 
getSneakingSpeedBonus
 - 
getKnockbackBonus
 - 
getFireAspect
 - 
getRespiration
 - 
getDepthStrider
 - 
getBlockEfficiency
 - 
getFishingLuckBonus
 - 
getFishingSpeedBonus
 - 
getMobLooting
 - 
hasAquaAffinity
 - 
hasFrostWalker
 - 
hasSoulSpeed
 - 
hasBindingCurse
 - 
hasVanishingCurse
 - 
hasSilkTouch
 - 
getLoyalty
 - 
getRiptide
 - 
hasChanneling
 - 
getRandomItemWith
@Nullable public static Map.Entry<EquipmentSlot,ItemStack> getRandomItemWith(Enchantment p_44907_, LivingEntity p_44908_)  - 
getRandomItemWith
@Nullable public static Map.Entry<EquipmentSlot,ItemStack> getRandomItemWith(Enchantment p_44840_, LivingEntity p_44841_, Predicate<ItemStack> p_44842_)  - 
getEnchantmentCost
public static int getEnchantmentCost(RandomSource p_220288_, int p_220289_, int p_220290_, ItemStack p_220291_)  - 
enchantItem
public static ItemStack enchantItem(RandomSource p_220293_, ItemStack p_220294_, int p_220295_, boolean p_220296_)  - 
selectEnchantment
public static List<EnchantmentInstance> selectEnchantment(RandomSource p_220298_, ItemStack p_220299_, int p_220300_, boolean p_220301_)  - 
filterCompatibleEnchantments
public static void filterCompatibleEnchantments(List<EnchantmentInstance> p_44863_, EnchantmentInstance p_44864_)  - 
isEnchantmentCompatible
public static boolean isEnchantmentCompatible(Collection<Enchantment> p_44860_, Enchantment p_44861_)  - 
getAvailableEnchantmentResults
public static List<EnchantmentInstance> getAvailableEnchantmentResults(int p_44818_, ItemStack p_44819_, boolean p_44820_)  
 - 
 
getTagEnchantmentLevel(Enchantment, ItemStack)orIForgeItemStack.getEnchantmentLevel(Enchantment)