Record Class Enchantment

java.lang.Object
java.lang.Record
net.minecraft.world.item.enchantment.Enchantment

public record Enchantment(Component description, Enchantment.EnchantmentDefinition definition, HolderSet<Enchantment> exclusiveSet, DataComponentMap effects) extends Record
  • Field Details

  • Constructor Details

    • Enchantment

      public Enchantment(Component description, Enchantment.EnchantmentDefinition definition, HolderSet<Enchantment> exclusiveSet, DataComponentMap effects)
      Creates an instance of a Enchantment record class.
      Parameters:
      description - the value for the description record component
      definition - the value for the definition record component
      exclusiveSet - the value for the exclusiveSet record component
      effects - the value for the effects record component
  • Method Details

    • constantCost

      public static Enchantment.Cost constantCost(int p_334530_)
    • dynamicCost

      public static Enchantment.Cost dynamicCost(int p_334326_, int p_335507_)
    • definition

      public static Enchantment.EnchantmentDefinition definition(HolderSet<Item> p_345362_, HolderSet<Item> p_343516_, int p_328611_, int p_336009_, Enchantment.Cost p_330605_, Enchantment.Cost p_333983_, int p_327771_, EquipmentSlotGroup... p_344843_)
    • definition

      public static Enchantment.EnchantmentDefinition definition(HolderSet<Item> p_342934_, int p_329635_, int p_331888_, Enchantment.Cost p_328182_, Enchantment.Cost p_328787_, int p_333931_, EquipmentSlotGroup... p_342587_)
    • getSlotItems

      public Map<EquipmentSlot,ItemStack> getSlotItems(LivingEntity p_44685_)
    • getSupportedItems

      public HolderSet<Item> getSupportedItems()
    • matchingSlot

      public boolean matchingSlot(EquipmentSlot p_344889_)
    • isPrimaryItem

      public boolean isPrimaryItem(ItemStack p_334183_)
    • isSupportedItem

      public boolean isSupportedItem(ItemStack p_343312_)
    • getWeight

      public int getWeight()
    • getAnvilCost

      public int getAnvilCost()
    • getMinLevel

      public int getMinLevel()
    • getMaxLevel

      public int getMaxLevel()
    • getMinCost

      public int getMinCost(int p_44679_)
    • getMaxCost

      public int getMaxCost(int p_44691_)
    • toString

      public String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • areCompatible

      public static boolean areCompatible(Holder<Enchantment> p_345028_, Holder<Enchantment> p_342568_)
    • getFullname

      public static Component getFullname(Holder<Enchantment> p_342825_, int p_44701_)
    • canEnchant

      public boolean canEnchant(ItemStack p_44689_)
    • getEffects

      public <T> List<T> getEffects(DataComponentType<List<T>> p_344699_)
    • isImmuneToDamage

      public boolean isImmuneToDamage(ServerLevel p_344493_, int p_345313_, Entity p_342613_, DamageSource p_345401_)
    • modifyDamageProtection

      public void modifyDamageProtection(ServerLevel p_344642_, int p_344297_, ItemStack p_345382_, Entity p_342229_, DamageSource p_342824_, org.apache.commons.lang3.mutable.MutableFloat p_345325_)
    • modifyDurabilityChange

      public void modifyDurabilityChange(ServerLevel p_342774_, int p_345090_, ItemStack p_343700_, org.apache.commons.lang3.mutable.MutableFloat p_343591_)
    • modifyAmmoCount

      public void modifyAmmoCount(ServerLevel p_342942_, int p_342884_, ItemStack p_344742_, org.apache.commons.lang3.mutable.MutableFloat p_343607_)
    • modifyPiercingCount

      public void modifyPiercingCount(ServerLevel p_342338_, int p_344838_, ItemStack p_343994_, org.apache.commons.lang3.mutable.MutableFloat p_342065_)
    • modifyBlockExperience

      public void modifyBlockExperience(ServerLevel p_342072_, int p_343543_, ItemStack p_343319_, org.apache.commons.lang3.mutable.MutableFloat p_342766_)
    • modifyMobExperience

      public void modifyMobExperience(ServerLevel p_343695_, int p_342521_, ItemStack p_344064_, Entity p_342215_, org.apache.commons.lang3.mutable.MutableFloat p_345517_)
    • modifyDurabilityToRepairFromXp

      public void modifyDurabilityToRepairFromXp(ServerLevel p_343302_, int p_343123_, ItemStack p_343007_, org.apache.commons.lang3.mutable.MutableFloat p_342327_)
    • modifyTridentReturnToOwnerAcceleration

      public void modifyTridentReturnToOwnerAcceleration(ServerLevel p_344014_, int p_345042_, ItemStack p_343051_, Entity p_342961_, org.apache.commons.lang3.mutable.MutableFloat p_343498_)
    • modifyTridentSpinAttackStrength

      public void modifyTridentSpinAttackStrength(RandomSource p_343013_, int p_342342_, org.apache.commons.lang3.mutable.MutableFloat p_342582_)
    • modifyFishingTimeReduction

      public void modifyFishingTimeReduction(ServerLevel p_343004_, int p_344690_, ItemStack p_342235_, Entity p_344564_, org.apache.commons.lang3.mutable.MutableFloat p_345086_)
    • modifyFishingLuckBonus

      public void modifyFishingLuckBonus(ServerLevel p_342216_, int p_343343_, ItemStack p_344550_, Entity p_343347_, org.apache.commons.lang3.mutable.MutableFloat p_345240_)
    • modifyDamage

      public void modifyDamage(ServerLevel p_343328_, int p_344751_, ItemStack p_342664_, Entity p_344239_, DamageSource p_345253_, org.apache.commons.lang3.mutable.MutableFloat p_344727_)
    • modifyFallBasedDamage

      public void modifyFallBasedDamage(ServerLevel p_344377_, int p_342769_, ItemStack p_344741_, Entity p_344920_, DamageSource p_345151_, org.apache.commons.lang3.mutable.MutableFloat p_343049_)
    • modifyKnockback

      public void modifyKnockback(ServerLevel p_345022_, int p_343469_, ItemStack p_343441_, Entity p_345003_, DamageSource p_345200_, org.apache.commons.lang3.mutable.MutableFloat p_345434_)
    • modifyArmorEffectivness

      public void modifyArmorEffectivness(ServerLevel p_345291_, int p_343247_, ItemStack p_343537_, Entity p_344244_, DamageSource p_344953_, org.apache.commons.lang3.mutable.MutableFloat p_345146_)
    • doPostAttack

      public static void doPostAttack(TargetedConditionalEffect<EnchantmentEntityEffect> p_344913_, ServerLevel p_344428_, int p_44688_, EnchantedItemInUse p_344260_, Entity p_44687_, DamageSource p_344028_)
    • doPostAttack

      public void doPostAttack(ServerLevel p_342826_, int p_343675_, EnchantedItemInUse p_343641_, EnchantmentTarget p_342372_, Entity p_344548_, DamageSource p_342692_)
    • modifyProjectileCount

      public void modifyProjectileCount(ServerLevel p_344710_, int p_344927_, ItemStack p_343332_, Entity p_344173_, org.apache.commons.lang3.mutable.MutableFloat p_345307_)
    • modifyProjectileSpread

      public void modifyProjectileSpread(ServerLevel p_342398_, int p_342291_, ItemStack p_345308_, Entity p_343809_, org.apache.commons.lang3.mutable.MutableFloat p_343769_)
    • modifyCrossbowChargeTime

      public void modifyCrossbowChargeTime(RandomSource p_345467_, int p_343593_, org.apache.commons.lang3.mutable.MutableFloat p_343046_)
    • modifyUnfilteredValue

      public void modifyUnfilteredValue(DataComponentType<EnchantmentValueEffect> p_342685_, RandomSource p_344622_, int p_343957_, org.apache.commons.lang3.mutable.MutableFloat p_342813_)
    • tick

      public void tick(ServerLevel p_345036_, int p_344388_, EnchantedItemInUse p_344279_, Entity p_342497_)
    • onProjectileSpawned

      public void onProjectileSpawned(ServerLevel p_344400_, int p_344273_, EnchantedItemInUse p_342998_, Entity p_344540_)
    • onHitBlock

      public void onHitBlock(ServerLevel p_343964_, int p_343622_, EnchantedItemInUse p_344872_, Entity p_342891_, Vec3 p_344312_, BlockState p_345016_)
    • modifyItemFilteredCount

      private void modifyItemFilteredCount(DataComponentType<List<ConditionalEffect<EnchantmentValueEffect>>> p_342071_, ServerLevel p_342667_, int p_344856_, ItemStack p_343442_, org.apache.commons.lang3.mutable.MutableFloat p_342223_)
    • modifyEntityFilteredValue

      private void modifyEntityFilteredValue(DataComponentType<List<ConditionalEffect<EnchantmentValueEffect>>> p_343552_, ServerLevel p_344107_, int p_342319_, ItemStack p_342576_, Entity p_343285_, org.apache.commons.lang3.mutable.MutableFloat p_342059_)
    • modifyDamageFilteredValue

      private void modifyDamageFilteredValue(DataComponentType<List<ConditionalEffect<EnchantmentValueEffect>>> p_342460_, ServerLevel p_344318_, int p_343892_, ItemStack p_345407_, Entity p_343559_, DamageSource p_344560_, org.apache.commons.lang3.mutable.MutableFloat p_344658_)
    • damageContext

      public static LootContext damageContext(ServerLevel p_342651_, int p_344201_, Entity p_345425_, DamageSource p_343766_)
    • itemContext

      private static LootContext itemContext(ServerLevel p_344430_, int p_344526_, ItemStack p_343134_)
    • locationContext

      private static LootContext locationContext(ServerLevel p_342658_, int p_342243_, Entity p_345215_, boolean p_342535_)
    • entityContext

      private static LootContext entityContext(ServerLevel p_342654_, int p_343984_, Entity p_342853_, Vec3 p_343585_)
    • blockHitContext

      private static LootContext blockHitContext(ServerLevel p_342041_, int p_344013_, Entity p_345496_, Vec3 p_343741_, BlockState p_342321_)
    • applyEffects

      private static <T> void applyEffects(List<ConditionalEffect<T>> p_345356_, LootContext p_343574_, Consumer<T> p_343387_)
    • runLocationChangedEffects

      public void runLocationChangedEffects(ServerLevel p_343889_, int p_344660_, EnchantedItemInUse p_344903_, LivingEntity p_342969_)
    • stopLocationBasedEffects

      public void stopLocationBasedEffects(int p_342505_, EnchantedItemInUse p_342723_, LivingEntity p_345268_)
    • enchantment

      public static Enchantment.Builder enchantment(Enchantment.EnchantmentDefinition p_342298_)
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • description

      public Component description()
      Returns the value of the description record component.
      Returns:
      the value of the description record component
    • definition

      public Enchantment.EnchantmentDefinition definition()
      Returns the value of the definition record component.
      Returns:
      the value of the definition record component
    • exclusiveSet

      public HolderSet<Enchantment> exclusiveSet()
      Returns the value of the exclusiveSet record component.
      Returns:
      the value of the exclusiveSet record component
    • effects

      public DataComponentMap effects()
      Returns the value of the effects record component.
      Returns:
      the value of the effects record component