java.lang.Object
java.lang.Record
tech.anonymoushacker1279.immersiveweapons.item.accessory.Accessory

public record Accessory(AccessorySlot slot, List<AccessoryEffectInstance> effects, Map<String,AccessoryEffectScalingType> effectScalingTypes, List<AttributeOperation> attributeModifiers, List<DynamicAttributeOperationInstance> dynamicAttributeModifiers, List<net.minecraft.world.effect.MobEffectInstance> mobEffectInstances) extends Record
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<Accessory> CODEC
    • ACCESSORY

      public static final net.neoforged.neoforge.registries.datamaps.DataMapType<net.minecraft.world.item.Item,Accessory> ACCESSORY
  • Constructor Details

    • Accessory

      public Accessory(AccessorySlot slot, AccessoryEffectBuilder builder)
    • Accessory

      public Accessory(AccessorySlot slot, List<AccessoryEffectInstance> effects, Map<String,AccessoryEffectScalingType> effectScalingTypes, List<AttributeOperation> attributeModifiers, List<DynamicAttributeOperationInstance> dynamicAttributeModifiers, List<net.minecraft.world.effect.MobEffectInstance> mobEffectInstances)
      Creates an instance of a Accessory record class.
      Parameters:
      slot - the value for the slot record component
      effects - the value for the effects record component
      effectScalingTypes - the value for the effectScalingTypes record component
      attributeModifiers - the value for the attributeModifiers record component
      dynamicAttributeModifiers - the value for the dynamicAttributeModifiers record component
      mobEffectInstances - the value for the mobEffectInstances record component
  • Method Details

    • getGlobalAttributeModifiers

      public static Set<AttributeOperation> getGlobalAttributeModifiers()
      The global attribute modifier map contains all standard and dynamic modifiers for all registered accessories.
      Returns:
      the global attribute modifier map
    • isActive

      public boolean isActive(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack accessoryStack, AccessorySlot slot)
      Check if this accessory is active.
      Parameters:
      player - the Player to check
      Returns:
      true if the accessory is active, false otherwise
    • isAccessoryActive

      public static boolean isAccessoryActive(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.ItemStack stack)
      Check if the specified accessory is active for the player. If IWCB is installed and the Curios plugin is registered, it will defer to IWCB.
      Parameters:
      player - the Player to check
      stack - the ItemStack to check
      Returns:
      true if the accessory is active, false otherwise
    • isAccessoryActive

      public static boolean isAccessoryActive(net.minecraft.world.entity.player.Player player, net.minecraft.world.item.Item item)
    • getEffectValue

      public double getEffectValue(AccessoryEffectType type)
    • 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.
    • slot

      public AccessorySlot slot()
      Returns the value of the slot record component.
      Returns:
      the value of the slot record component
    • effects

      public List<AccessoryEffectInstance> effects()
      Returns the value of the effects record component.
      Returns:
      the value of the effects record component
    • effectScalingTypes

      public Map<String,AccessoryEffectScalingType> effectScalingTypes()
      Returns the value of the effectScalingTypes record component.
      Returns:
      the value of the effectScalingTypes record component
    • attributeModifiers

      public List<AttributeOperation> attributeModifiers()
      Returns the value of the attributeModifiers record component.
      Returns:
      the value of the attributeModifiers record component
    • dynamicAttributeModifiers

      public List<DynamicAttributeOperationInstance> dynamicAttributeModifiers()
      Returns the value of the dynamicAttributeModifiers record component.
      Returns:
      the value of the dynamicAttributeModifiers record component
    • mobEffectInstances

      public List<net.minecraft.world.effect.MobEffectInstance> mobEffectInstances()
      Returns the value of the mobEffectInstances record component.
      Returns:
      the value of the mobEffectInstances record component