Record Class EnchantmentList
java.lang.Object
java.lang.Record
net.minestom.server.item.component.EnchantmentList
public record EnchantmentList(@NotNull Map<RegistryKey<Enchantment>, Integer> enchantments)
extends Record
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec
<EnchantmentList> static final EnchantmentList
static final NetworkBuffer.Type
<EnchantmentList> -
Constructor Summary
ConstructorsConstructorDescriptionEnchantmentList
(@NotNull Map<RegistryKey<Enchantment>, Integer> enchantments) Creates an instance of aEnchantmentList
record class.EnchantmentList
(@NotNull RegistryKey<Enchantment> enchantment, int level) -
Method Summary
Modifier and TypeMethodDescription@NotNull Map
<RegistryKey<Enchantment>, Integer> Returns the value of theenchantments
record component.final boolean
Indicates whether some other object is "equal to" this one.boolean
has
(@NotNull RegistryKey<Enchantment> enchantment) final int
hashCode()
Returns a hash code value for this object.int
level
(@NotNull RegistryKey<Enchantment> enchantment) @NotNull EnchantmentList
remove
(@NotNull RegistryKey<Enchantment> enchantment) final String
toString()
Returns a string representation of this record class.@NotNull EnchantmentList
with
(@NotNull RegistryKey<Enchantment> enchantment, int level)
-
Field Details
-
EMPTY
-
NETWORK_TYPE
-
CODEC
-
-
Constructor Details
-
EnchantmentList
Creates an instance of aEnchantmentList
record class.- Parameters:
enchantments
- the value for theenchantments
record component
-
EnchantmentList
-
-
Method Details
-
has
-
level
-
with
@NotNull public @NotNull EnchantmentList with(@NotNull @NotNull RegistryKey<Enchantment> enchantment, int level) -
remove
@NotNull public @NotNull EnchantmentList remove(@NotNull @NotNull RegistryKey<Enchantment> enchantment) -
toString
-
hashCode
-
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)
. -
enchantments
Returns the value of theenchantments
record component.- Returns:
- the value of the
enchantments
record component
-