Class EnchantmentHelper
java.lang.Object
net.minecraft.world.item.enchantment.EnchantmentHelper
-
Nested Class Summary
Modifier and TypeClassDescription(package private) static interface
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic Map<Enchantment,
Integer> deserializeEnchantments
(ListTag p_44883_) static void
doPostDamageEffects
(LivingEntity p_44897_, Entity p_44898_) static void
doPostHurtEffects
(LivingEntity p_44824_, Entity p_44825_) static ItemStack
enchantItem
(RandomSource p_220293_, ItemStack p_220294_, int p_220295_, boolean p_220296_) static void
filterCompatibleEnchantments
(List<EnchantmentInstance> p_44863_, EnchantmentInstance p_44864_) static List<EnchantmentInstance>
getAvailableEnchantmentResults
(int p_44818_, ItemStack p_44819_, boolean p_44820_) static int
getBlockEfficiency
(LivingEntity p_44927_) static float
getDamageBonus
(ItemStack p_44834_, MobType p_44835_) static int
getDamageProtection
(Iterable<ItemStack> p_44857_, DamageSource p_44858_) static int
getDepthStrider
(LivingEntity p_44923_) static int
getEnchantmentCost
(RandomSource p_220288_, int p_220289_, int p_220290_, ItemStack p_220291_) static ResourceLocation
getEnchantmentId
(CompoundTag p_182447_) static ResourceLocation
getEnchantmentId
(Enchantment p_182433_) static int
getEnchantmentLevel
(CompoundTag p_182439_) static int
getEnchantmentLevel
(Enchantment p_44837_, LivingEntity p_44838_) static Map<Enchantment,
Integer> getEnchantments
(ItemStack p_44832_) static int
getFireAspect
(LivingEntity p_44915_) static int
getFishingLuckBonus
(ItemStack p_44905_) static int
getFishingSpeedBonus
(ItemStack p_44917_) static int
getItemEnchantmentLevel
(Enchantment p_44844_, ItemStack p_44845_) Deprecated.static int
getKnockbackBonus
(LivingEntity p_44895_) static int
getLoyalty
(ItemStack p_44929_) static int
getMobLooting
(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 int
getRespiration
(LivingEntity p_44919_) static int
getRiptide
(ItemStack p_44933_) static float
getSneakingSpeedBonus
(LivingEntity p_220303_) static float
getSweepingDamageRatio
(LivingEntity p_44822_) static int
getTagEnchantmentLevel
(Enchantment p_44844_, ItemStack p_44845_) Gets the enchantment level from NBT.static boolean
hasAquaAffinity
(LivingEntity p_44935_) static boolean
hasBindingCurse
(ItemStack p_44921_) static boolean
hasChanneling
(ItemStack p_44937_) static boolean
hasFrostWalker
(LivingEntity p_44939_) static boolean
hasSilkTouch
(ItemStack p_273444_) static boolean
hasSoulSpeed
(LivingEntity p_44943_) static boolean
hasVanishingCurse
(ItemStack p_44925_) static boolean
isEnchantmentCompatible
(Collection<Enchantment> p_44860_, Enchantment p_44861_) private static void
runIterationOnInventory
(EnchantmentHelper.EnchantmentVisitor p_44854_, Iterable<ItemStack> p_44855_) private static void
runIterationOnItem
(EnchantmentHelper.EnchantmentVisitor p_44851_, ItemStack p_44852_) static List<EnchantmentInstance>
selectEnchantment
(RandomSource p_220298_, ItemStack p_220299_, int p_220300_, boolean p_220301_) static void
setEnchantmentLevel
(CompoundTag p_182441_, int p_182442_) static void
setEnchantments
(Map<Enchantment, Integer> p_44866_, ItemStack p_44867_) static CompoundTag
storeEnchantment
(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)