Record Class LodestoneSlotBasedEnchantmentAttributeEffect

java.lang.Object
java.lang.Record
team.lodestar.lodestone.modules.toolkit.enchanting.LodestoneSlotBasedEnchantmentAttributeEffect
All Implemented Interfaces:
net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect

public record LodestoneSlotBasedEnchantmentAttributeEffect(net.minecraft.resources.ResourceLocation id, net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute, net.minecraft.world.item.enchantment.LevelBasedValue amount, net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation operation) extends Record implements net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.MapCodec<LodestoneSlotBasedEnchantmentAttributeEffect>
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    LodestoneSlotBasedEnchantmentAttributeEffect(net.minecraft.resources.ResourceLocation id, net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute, net.minecraft.world.item.enchantment.LevelBasedValue amount, net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation operation)
    Creates an instance of a LodestoneSlotBasedEnchantmentAttributeEffect record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.minecraft.world.item.enchantment.LevelBasedValue
    Returns the value of the amount record component.
    net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute>
    Returns the value of the attribute record component.
    com.mojang.serialization.MapCodec<LodestoneSlotBasedEnchantmentAttributeEffect>
     
    final boolean
    Indicates whether some other object is "equal to" this one.
    net.minecraft.world.entity.ai.attributes.AttributeModifier
    getModifier(int enchantmentLevel, net.minecraft.util.StringRepresentable slot)
     
    final int
    Returns a hash code value for this object.
    net.minecraft.resources.ResourceLocation
    id()
    Returns the value of the id record component.
    static void
    modifyAttributes(net.neoforged.neoforge.event.ItemAttributeModifierEvent event)
     
    void
    onChangedBlock(net.minecraft.server.level.ServerLevel level, int enchantmentLevel, net.minecraft.world.item.enchantment.EnchantedItemInUse item, net.minecraft.world.entity.Entity entity, net.minecraft.world.phys.Vec3 pos, boolean applyTransientEffects)
     
    void
    onDeactivated(net.minecraft.world.item.enchantment.EnchantedItemInUse item, net.minecraft.world.entity.Entity entity, net.minecraft.world.phys.Vec3 pos, int enchantmentLevel)
     
    net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation
    Returns the value of the operation record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

  • Constructor Details

    • LodestoneSlotBasedEnchantmentAttributeEffect

      public LodestoneSlotBasedEnchantmentAttributeEffect(net.minecraft.resources.ResourceLocation id, net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute, net.minecraft.world.item.enchantment.LevelBasedValue amount, net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation operation)
      Creates an instance of a LodestoneSlotBasedEnchantmentAttributeEffect record class.
      Parameters:
      id - the value for the id record component
      attribute - the value for the attribute record component
      amount - the value for the amount record component
      operation - the value for the operation record component
  • Method Details

    • modifyAttributes

      public static void modifyAttributes(net.neoforged.neoforge.event.ItemAttributeModifierEvent event)
    • getModifier

      public net.minecraft.world.entity.ai.attributes.AttributeModifier getModifier(int enchantmentLevel, net.minecraft.util.StringRepresentable slot)
    • onChangedBlock

      public void onChangedBlock(net.minecraft.server.level.ServerLevel level, int enchantmentLevel, net.minecraft.world.item.enchantment.EnchantedItemInUse item, net.minecraft.world.entity.Entity entity, net.minecraft.world.phys.Vec3 pos, boolean applyTransientEffects)
      Specified by:
      onChangedBlock in interface net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
    • onDeactivated

      public void onDeactivated(net.minecraft.world.item.enchantment.EnchantedItemInUse item, net.minecraft.world.entity.Entity entity, net.minecraft.world.phys.Vec3 pos, int enchantmentLevel)
      Specified by:
      onDeactivated in interface net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
    • codec

      public com.mojang.serialization.MapCodec<LodestoneSlotBasedEnchantmentAttributeEffect> codec()
      Specified by:
      codec in interface net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect
    • toString

      public final 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
    • 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.
    • id

      public net.minecraft.resources.ResourceLocation id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • attribute

      public net.minecraft.core.Holder<net.minecraft.world.entity.ai.attributes.Attribute> attribute()
      Returns the value of the attribute record component.
      Returns:
      the value of the attribute record component
    • amount

      public net.minecraft.world.item.enchantment.LevelBasedValue amount()
      Returns the value of the amount record component.
      Returns:
      the value of the amount record component
    • operation

      public net.minecraft.world.entity.ai.attributes.AttributeModifier.Operation operation()
      Returns the value of the operation record component.
      Returns:
      the value of the operation record component