Package me.cybersteve.equiplib.util
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 -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final net.minecraft.network.codec.StreamCodec<?, EffectList> The constant STREAM_CODEC for networking purposes. -
Constructor Summary
ConstructorsConstructorDescriptionEffectList(ConcurrentHashMap<net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect>, EffectMeta> data) Creates an instance of aEffectListrecord class. -
Method Summary
Modifier and TypeMethodDescriptionConcurrentHashMap<net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect>, EffectMeta> data()Returns the value of thedatarecord component.booleanIndicates whether some other object is "equal to" this one.static EffectListGets empty EffectList.inthashCode()Returns a hash code value for this object.booleanisEmpty()Method to check if EffectList is empty.voidremoveEffect(net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect) Remove effect from list.voidsetNewMetaForEffect(net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect> effect, EffectMeta meta) Sets new meta for effect in list.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
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 aEffectListrecord class.- Parameters:
data- the value for thedatarecord component
-
-
Method Details
-
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 effectmeta- 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
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 withObjects::equals(Object,Object). -
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. -
isEmpty
public boolean isEmpty()Method to check if EffectList is empty.- Returns:
- boolean representing emptiness of the list
-
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. -
data
public ConcurrentHashMap<net.minecraft.core.Holder<net.minecraft.world.effect.MobEffect>,EffectMeta> data()Returns the value of thedatarecord component.- Returns:
- the value of the
datarecord component
-