Class EnchantmentHelper
java.lang.Object
net.minecraft.world.item.enchantment.EnchantmentHelper
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static interface(package private) static interface -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanStoreEnchantments(ItemStack p_333572_) static voiddoPostAttackEffects(ServerLevel p_343618_, Entity p_343098_, DamageSource p_342187_) static voiddoPostAttackEffectsWithItemSource(ServerLevel p_345038_, Entity p_342420_, DamageSource p_344777_, ItemStack p_344587_) static ItemStackenchantItem(RandomSource p_220293_, ItemStack p_220294_, int p_220295_, Stream<Holder<Enchantment>> p_344664_) static ItemStackenchantItem(RandomSource p_344212_, ItemStack p_345193_, int p_344120_, RegistryAccess p_345399_, Optional<? extends HolderSet<Enchantment>> p_342141_) static voidenchantItemFromProvider(ItemStack p_344649_, RegistryAccess p_345511_, ResourceKey<EnchantmentProvider> p_342294_, DifficultyInstance p_343182_, RandomSource p_344701_) static voidfilterCompatibleEnchantments(List<EnchantmentInstance> p_44863_, EnchantmentInstance p_44864_) static voidforEachModifier(ItemStack p_344460_, EquipmentSlotGroup p_343938_, BiConsumer<Holder<Attribute>, AttributeModifier> p_345426_) static voidforEachModifier(ItemStack p_343035_, EquipmentSlot p_342305_, BiConsumer<Holder<Attribute>, AttributeModifier> p_342639_) static List<EnchantmentInstance> getAvailableEnchantmentResults(int p_44818_, ItemStack p_44819_, Stream<Holder<Enchantment>> p_342857_) private static DataComponentType<ItemEnchantments> getComponentType(ItemStack p_335414_) static floatgetDamageProtection(ServerLevel p_345416_, LivingEntity p_342248_, DamageSource p_44858_) static intgetEnchantmentCost(RandomSource p_220288_, int p_220289_, int p_220290_, ItemStack p_220291_) static intgetEnchantmentLevel(Holder<Enchantment> p_342592_, LivingEntity p_44838_) static ItemEnchantmentsgetEnchantmentsForCrafting(ItemStack p_335659_) static intgetFishingLuckBonus(ServerLevel p_345183_, ItemStack p_44905_, Entity p_344199_) static floatgetFishingTimeReduction(ServerLevel p_344336_, ItemStack p_343914_, Entity p_342898_) static <T> com.mojang.datafixers.util.Pair<T, Integer> getHighestLevel(ItemStack p_345335_, DataComponentType<T> p_344437_) static intgetItemEnchantmentLevel(Holder<Enchantment> p_344652_, ItemStack p_44845_) static intgetPiercingCount(ServerLevel p_343271_, ItemStack p_345451_, ItemStack p_343657_) static Optional<EnchantedItemInUse> getRandomItemWith(DataComponentType<?> p_345106_, LivingEntity p_44908_, Predicate<ItemStack> p_345112_) static intgetTridentReturnToOwnerAcceleration(ServerLevel p_342510_, ItemStack p_342608_, Entity p_343773_) static floatgetTridentSpinAttackStrength(ItemStack p_345397_, LivingEntity p_342067_) static booleanhas(ItemStack p_345483_, DataComponentType<?> p_344623_) static booleanhasAnyEnchantments(ItemStack p_335287_) static booleanhasTag(ItemStack p_344479_, TagKey<Enchantment> p_343396_) static booleanisEnchantmentCompatible(Collection<Holder<Enchantment>> p_44860_, Holder<Enchantment> p_345339_) static booleanisImmuneToDamage(ServerLevel p_343151_, LivingEntity p_344523_, DamageSource p_343996_) static floatmodifyArmorEffectiveness(ServerLevel p_345408_, ItemStack p_344868_, Entity p_345361_, DamageSource p_343275_, float p_345487_) static floatmodifyCrossbowChargingTime(ItemStack p_344573_, LivingEntity p_343136_, float p_343873_) static floatmodifyDamage(ServerLevel p_343245_, ItemStack p_342430_, Entity p_344044_, DamageSource p_344705_, float p_344247_) static intmodifyDurabilityToRepairFromXp(ServerLevel p_345080_, ItemStack p_343144_, int p_342792_) static floatmodifyFallBasedDamage(ServerLevel p_345393_, ItemStack p_344524_, Entity p_343535_, DamageSource p_343627_, float p_342940_) static floatmodifyKnockback(ServerLevel p_344591_, ItemStack p_345053_, Entity p_343711_, DamageSource p_344321_, float p_343554_) static voidonHitBlock(ServerLevel p_344864_, ItemStack p_342595_, LivingEntity p_345505_, Entity p_345420_, EquipmentSlot p_343177_, Vec3 p_343033_, BlockState p_343989_, Consumer<Item> p_344574_) static voidonProjectileSpawned(ServerLevel p_343338_, ItemStack p_344853_, AbstractArrow p_345004_, Consumer<Item> p_345317_) static <T> Optional<T> pickHighestLevel(ItemStack p_343484_, DataComponentType<List<T>> p_342070_) static intprocessAmmoUse(ServerLevel p_344585_, ItemStack p_344182_, ItemStack p_343578_, int p_342951_) static intprocessBlockExperience(ServerLevel p_343042_, ItemStack p_343624_, int p_342499_) static intprocessDurabilityChange(ServerLevel p_344040_, ItemStack p_345474_, int p_342600_) static floatprocessEquipmentDropChance(ServerLevel p_342296_, LivingEntity p_342126_, DamageSource p_344732_, float p_343626_) static intprocessMobExperience(ServerLevel p_343500_, Entity p_345230_, Entity p_344218_, int p_342604_) static intprocessProjectileCount(ServerLevel p_344575_, ItemStack p_345314_, Entity p_343374_, int p_343111_) static floatprocessProjectileSpread(ServerLevel p_342105_, ItemStack p_345162_, Entity p_343316_, float p_342659_) private static voidrunIterationOnEquipment(LivingEntity p_344171_, EnchantmentHelper.EnchantmentInSlotVisitor p_343067_) private static voidrunIterationOnItem(ItemStack p_44852_, EquipmentSlot p_344793_, LivingEntity p_344959_, EnchantmentHelper.EnchantmentInSlotVisitor p_342058_) private static voidrunIterationOnItem(ItemStack p_343610_, EnchantmentHelper.EnchantmentVisitor p_342837_) static voidrunLocationChangedEffects(ServerLevel p_342390_, LivingEntity p_344486_) static voidrunLocationChangedEffects(ServerLevel p_342666_, ItemStack p_342169_, LivingEntity p_343458_, EquipmentSlot p_344449_) static List<EnchantmentInstance> selectEnchantment(RandomSource p_220298_, ItemStack p_220299_, int p_220300_, Stream<Holder<Enchantment>> p_342119_) static voidsetEnchantments(ItemStack p_44867_, ItemEnchantments p_330134_) static voidstopLocationBasedEffects(LivingEntity p_342428_) static voidstopLocationBasedEffects(ItemStack p_343782_, LivingEntity p_342864_, EquipmentSlot p_342427_) static voidtickEffects(ServerLevel p_344571_, LivingEntity p_343172_) static ItemEnchantmentsupdateEnchantments(ItemStack p_333740_, Consumer<ItemEnchantments.Mutable> p_328467_)
-
Constructor Details
-
EnchantmentHelper
public EnchantmentHelper()
-
-
Method Details
-
getItemEnchantmentLevel
-
updateEnchantments
public static ItemEnchantments updateEnchantments(ItemStack p_333740_, Consumer<ItemEnchantments.Mutable> p_328467_) -
canStoreEnchantments
-
setEnchantments
-
getEnchantmentsForCrafting
-
getComponentType
-
hasAnyEnchantments
-
processDurabilityChange
public static int processDurabilityChange(ServerLevel p_344040_, ItemStack p_345474_, int p_342600_) -
processAmmoUse
public static int processAmmoUse(ServerLevel p_344585_, ItemStack p_344182_, ItemStack p_343578_, int p_342951_) -
processBlockExperience
-
processMobExperience
public static int processMobExperience(ServerLevel p_343500_, @Nullable Entity p_345230_, Entity p_344218_, int p_342604_) -
runIterationOnItem
private static void runIterationOnItem(ItemStack p_343610_, EnchantmentHelper.EnchantmentVisitor p_342837_) -
runIterationOnItem
private static void runIterationOnItem(ItemStack p_44852_, EquipmentSlot p_344793_, LivingEntity p_344959_, EnchantmentHelper.EnchantmentInSlotVisitor p_342058_) -
runIterationOnEquipment
private static void runIterationOnEquipment(LivingEntity p_344171_, EnchantmentHelper.EnchantmentInSlotVisitor p_343067_) -
isImmuneToDamage
public static boolean isImmuneToDamage(ServerLevel p_343151_, LivingEntity p_344523_, DamageSource p_343996_) -
getDamageProtection
public static float getDamageProtection(ServerLevel p_345416_, LivingEntity p_342248_, DamageSource p_44858_) -
modifyDamage
public static float modifyDamage(ServerLevel p_343245_, ItemStack p_342430_, Entity p_344044_, DamageSource p_344705_, float p_344247_) -
modifyFallBasedDamage
public static float modifyFallBasedDamage(ServerLevel p_345393_, ItemStack p_344524_, Entity p_343535_, DamageSource p_343627_, float p_342940_) -
modifyArmorEffectiveness
public static float modifyArmorEffectiveness(ServerLevel p_345408_, ItemStack p_344868_, Entity p_345361_, DamageSource p_343275_, float p_345487_) -
modifyKnockback
public static float modifyKnockback(ServerLevel p_344591_, ItemStack p_345053_, Entity p_343711_, DamageSource p_344321_, float p_343554_) -
doPostAttackEffects
public static void doPostAttackEffects(ServerLevel p_343618_, Entity p_343098_, DamageSource p_342187_) -
doPostAttackEffectsWithItemSource
public static void doPostAttackEffectsWithItemSource(ServerLevel p_345038_, Entity p_342420_, DamageSource p_344777_, @Nullable ItemStack p_344587_) -
runLocationChangedEffects
-
runLocationChangedEffects
public static void runLocationChangedEffects(ServerLevel p_342666_, ItemStack p_342169_, LivingEntity p_343458_, EquipmentSlot p_344449_) -
stopLocationBasedEffects
-
stopLocationBasedEffects
public static void stopLocationBasedEffects(ItemStack p_343782_, LivingEntity p_342864_, EquipmentSlot p_342427_) -
tickEffects
-
getEnchantmentLevel
-
processProjectileCount
public static int processProjectileCount(ServerLevel p_344575_, ItemStack p_345314_, Entity p_343374_, int p_343111_) -
processProjectileSpread
public static float processProjectileSpread(ServerLevel p_342105_, ItemStack p_345162_, Entity p_343316_, float p_342659_) -
getPiercingCount
-
onProjectileSpawned
public static void onProjectileSpawned(ServerLevel p_343338_, ItemStack p_344853_, AbstractArrow p_345004_, Consumer<Item> p_345317_) -
onHitBlock
public static void onHitBlock(ServerLevel p_344864_, ItemStack p_342595_, @Nullable LivingEntity p_345505_, Entity p_345420_, @Nullable EquipmentSlot p_343177_, Vec3 p_343033_, BlockState p_343989_, Consumer<Item> p_344574_) -
modifyDurabilityToRepairFromXp
public static int modifyDurabilityToRepairFromXp(ServerLevel p_345080_, ItemStack p_343144_, int p_342792_) -
processEquipmentDropChance
public static float processEquipmentDropChance(ServerLevel p_342296_, LivingEntity p_342126_, DamageSource p_344732_, float p_343626_) -
forEachModifier
public static void forEachModifier(ItemStack p_344460_, EquipmentSlotGroup p_343938_, BiConsumer<Holder<Attribute>, AttributeModifier> p_345426_) -
forEachModifier
public static void forEachModifier(ItemStack p_343035_, EquipmentSlot p_342305_, BiConsumer<Holder<Attribute>, AttributeModifier> p_342639_) -
getFishingLuckBonus
-
getFishingTimeReduction
public static float getFishingTimeReduction(ServerLevel p_344336_, ItemStack p_343914_, Entity p_342898_) -
getTridentReturnToOwnerAcceleration
public static int getTridentReturnToOwnerAcceleration(ServerLevel p_342510_, ItemStack p_342608_, Entity p_343773_) -
modifyCrossbowChargingTime
public static float modifyCrossbowChargingTime(ItemStack p_344573_, LivingEntity p_343136_, float p_343873_) -
getTridentSpinAttackStrength
-
hasTag
-
has
-
pickHighestLevel
public static <T> Optional<T> pickHighestLevel(ItemStack p_343484_, DataComponentType<List<T>> p_342070_) -
getHighestLevel
@Nullable public static <T> com.mojang.datafixers.util.Pair<T,Integer> getHighestLevel(ItemStack p_345335_, DataComponentType<T> p_344437_) -
getRandomItemWith
public static Optional<EnchantedItemInUse> getRandomItemWith(DataComponentType<?> p_345106_, LivingEntity p_44908_, Predicate<ItemStack> p_345112_) -
getEnchantmentCost
public static int getEnchantmentCost(RandomSource p_220288_, int p_220289_, int p_220290_, ItemStack p_220291_) -
enchantItem
public static ItemStack enchantItem(RandomSource p_344212_, ItemStack p_345193_, int p_344120_, RegistryAccess p_345399_, Optional<? extends HolderSet<Enchantment>> p_342141_) -
enchantItem
public static ItemStack enchantItem(RandomSource p_220293_, ItemStack p_220294_, int p_220295_, Stream<Holder<Enchantment>> p_344664_) -
selectEnchantment
public static List<EnchantmentInstance> selectEnchantment(RandomSource p_220298_, ItemStack p_220299_, int p_220300_, Stream<Holder<Enchantment>> p_342119_) -
filterCompatibleEnchantments
public static void filterCompatibleEnchantments(List<EnchantmentInstance> p_44863_, EnchantmentInstance p_44864_) -
isEnchantmentCompatible
public static boolean isEnchantmentCompatible(Collection<Holder<Enchantment>> p_44860_, Holder<Enchantment> p_345339_) -
getAvailableEnchantmentResults
public static List<EnchantmentInstance> getAvailableEnchantmentResults(int p_44818_, ItemStack p_44819_, Stream<Holder<Enchantment>> p_342857_) -
enchantItemFromProvider
public static void enchantItemFromProvider(ItemStack p_344649_, RegistryAccess p_345511_, ResourceKey<EnchantmentProvider> p_342294_, DifficultyInstance p_343182_, RandomSource p_344701_)
-