Record Class Accessory

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

public record Accessory(net.minecraft.core.Holder<net.minecraft.world.item.Item> item, AccessorySlot slot, List<AccessoryEffectInstance> effects, List<AttributeOperation> attributeModifiers, List<DynamicAttributeOperationInstance> dynamicAttributeModifiers, List<net.minecraft.world.effect.MobEffectInstance> mobEffectInstances, List<SerializableTooltip> tooltips) extends Record
  • Field Details

    • CODEC

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

      public static final net.minecraft.network.codec.StreamCodec<net.minecraft.network.RegistryFriendlyByteBuf, Accessory> STREAM_CODEC
  • Constructor Details

    • Accessory

      public Accessory(net.minecraft.core.Holder<net.minecraft.world.item.Item> item, AccessorySlot slot, AccessoryEffectBuilder builder)
    • Accessory

      public Accessory(net.minecraft.core.Holder<net.minecraft.world.item.Item> item, AccessorySlot slot, List<AccessoryEffectInstance> effects, List<AttributeOperation> attributeModifiers, List<DynamicAttributeOperationInstance> dynamicAttributeModifiers, List<net.minecraft.world.effect.MobEffectInstance> mobEffectInstances, List<SerializableTooltip> tooltips)
      Creates an instance of a Accessory record class.
      Parameters:
      item - the value for the item record component
      slot - the value for the slot record component
      effects - the value for the effects 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
      tooltips - the value for the tooltips 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
    • 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.
      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)
    • 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
    • getBaseEffectValue

      public double getBaseEffectValue(AccessoryEffectType type)
    • getEffectValue

      public double getEffectValue(AccessoryEffectType type, net.minecraft.world.entity.player.Player player)
    • 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.
    • item

      public net.minecraft.core.Holder<net.minecraft.world.item.Item> item()
      Returns the value of the item record component.
      Returns:
      the value of the item record component
    • 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
    • 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
    • tooltips

      public List<SerializableTooltip> tooltips()
      Returns the value of the tooltips record component.
      Returns:
      the value of the tooltips record component