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 float
calculateArmorBreach
(Entity p_338241_, float p_338545_) static boolean
canStoreEnchantments
(ItemStack p_330666_) static void
doPostDamageEffects
(LivingEntity p_44897_, Entity p_44898_) static void
doPostHurtEffects
(LivingEntity p_44824_, Entity p_44825_) static void
doPostItemStackHurtEffects
(LivingEntity p_338188_, Entity p_338394_, ItemEnchantments p_338474_) static ItemStack
enchantItem
(FeatureFlagSet p_338479_, 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
(FeatureFlagSet p_338712_, int p_44818_, ItemStack p_44819_, boolean p_44820_) static int
getBlockEfficiency
(LivingEntity p_44927_) private static DataComponentType
<ItemEnchantments> getComponentType
(ItemStack p_331909_) static float
getDamageBonus
(ItemStack p_44834_, EntityType<?> p_320195_) 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 int
getEnchantmentLevel
(Enchantment p_44837_, LivingEntity p_44838_) static ItemEnchantments
getEnchantmentsForCrafting
(ItemStack p_330538_) 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
(int p_335376_) static float
getSweepingDamageRatio
(LivingEntity p_44822_) static boolean
hasAnyEnchantments
(ItemStack p_332657_) 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<Holder<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
(FeatureFlagSet p_338533_, RandomSource p_220298_, ItemStack p_220299_, int p_220300_, boolean p_220301_) static void
setEnchantments
(ItemStack p_44867_, ItemEnchantments p_332148_) static ItemEnchantments
updateEnchantments
(ItemStack p_331034_, Consumer<ItemEnchantments.Mutable> p_332031_)
-
Field Details
-
SWIFT_SNEAK_EXTRA_FACTOR
private static final float SWIFT_SNEAK_EXTRA_FACTOR- See Also:
-
-
Constructor Details
-
EnchantmentHelper
public EnchantmentHelper()
-
-
Method Details
-
getItemEnchantmentLevel
Deprecated.Neo: UseIItemStackExtension.getEnchantmentLevel(Enchantment)
for gameplay logic. Use the data component when modifying the enchantments. -
updateEnchantments
public static ItemEnchantments updateEnchantments(ItemStack p_331034_, Consumer<ItemEnchantments.Mutable> p_332031_) -
canStoreEnchantments
-
setEnchantments
-
getEnchantmentsForCrafting
-
getComponentType
-
hasAnyEnchantments
-
getSweepingDamageRatio
public static float getSweepingDamageRatio(int p_335376_) -
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
-
calculateArmorBreach
-
doPostHurtEffects
-
doPostDamageEffects
-
doPostItemStackHurtEffects
public static void doPostItemStackHurtEffects(LivingEntity p_338188_, Entity p_338394_, ItemEnchantments p_338474_) -
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(FeatureFlagSet p_338479_, RandomSource p_220293_, ItemStack p_220294_, int p_220295_, boolean p_220296_) -
selectEnchantment
public static List<EnchantmentInstance> selectEnchantment(FeatureFlagSet p_338533_, 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<Holder<Enchantment>> p_44860_, Enchantment p_44861_) -
getAvailableEnchantmentResults
public static List<EnchantmentInstance> getAvailableEnchantmentResults(FeatureFlagSet p_338712_, int p_44818_, ItemStack p_44819_, boolean p_44820_)
-
IItemStackExtension.getEnchantmentLevel(Enchantment)
for gameplay logic.