Record Class EffectList

java.lang.Object
java.lang.Record
me.cybersteve.equiplib.util.EffectList

public record EffectList(ConcurrentHashMap<net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect>,EffectMeta> data) extends Record
The Effect list class that stores EffectMeta for each effect.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    The Builder for EffectList.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final net.minecraft.network.codec.StreamCodec<?,EffectList>
    The constant STREAM_CODEC for networking purposes.
  • Constructor Summary

    Constructors
    Constructor
    Description
    EffectList(ConcurrentHashMap<net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect>,EffectMeta> data)
    Creates an instance of a EffectList record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    ConcurrentHashMap<net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect>,EffectMeta>
    Returns the value of the data record component.
    boolean
    Indicates whether some other object is "equal to" this one.
    static EffectList
    Gets empty EffectList.
    int
    Returns a hash code value for this object.
    boolean
    Method to check if EffectList is empty.
    void
    removeEffect(net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect)
    Remove effect from list.
    void
    setNewMetaForEffect(net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect, EffectMeta meta)
    Sets new meta for effect in list.
    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

    • STREAM_CODEC

      public static final net.minecraft.network.codec.StreamCodec<?,EffectList> STREAM_CODEC
      The constant STREAM_CODEC for networking purposes.
  • Constructor Details

    • EffectList

      public EffectList(ConcurrentHashMap<net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect>,EffectMeta> data)
      Creates an instance of a EffectList record class.
      Parameters:
      data - the value for the data record component
  • Method Details

    • getEmptyList

      public static EffectList getEmptyList()
      Gets empty EffectList.
      Returns:
      the emptyEffectList
    • setNewMetaForEffect

      public void setNewMetaForEffect(net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect, EffectMeta meta)
      Sets new meta for effect in list.
      Parameters:
      effect - the effect
      meta - the meta
    • removeEffect

      public void removeEffect(net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect)
      Remove effect from list.
      Parameters:
      effect - the effect
    • equals

      public 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.
    • hashCode

      public 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
    • isEmpty

      public boolean isEmpty()
      Method to check if EffectList is empty.
      Returns:
      boolean representing emptiness of the list
    • 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
    • data

      public ConcurrentHashMap<net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect>,EffectMeta> data()
      Returns the value of the data record component.
      Returns:
      the value of the data record component