Record Class Equippable
java.lang.Object
java.lang.Record
net.minecraft.world.item.equipment.Equippable
public record Equippable(EquipmentSlot slot, Holder<SoundEvent> equipSound, Optional<ResourceKey<EquipmentAsset>> assetId, Optional<ResourceLocation> cameraOverlay, Optional<HolderSet<EntityType<?>>> allowedEntities, boolean dispensable, boolean swappable, boolean damageOnHurt, boolean equipOnInteract)
extends Record
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Optional
<HolderSet<EntityType<?>>> The field for theallowedEntities
record component.private final Optional
<ResourceKey<EquipmentAsset>> The field for theassetId
record component.private final Optional
<ResourceLocation> The field for thecameraOverlay
record component.static final com.mojang.serialization.Codec
<Equippable> private final boolean
The field for thedamageOnHurt
record component.private final boolean
The field for thedispensable
record component.private final boolean
The field for theequipOnInteract
record component.private final Holder
<SoundEvent> The field for theequipSound
record component.private final EquipmentSlot
The field for theslot
record component.static final StreamCodec
<RegistryFriendlyByteBuf, Equippable> private final boolean
The field for theswappable
record component. -
Constructor Summary
ConstructorsConstructorDescriptionEquippable
(EquipmentSlot slot, Holder<SoundEvent> equipSound, Optional<ResourceKey<EquipmentAsset>> assetId, Optional<ResourceLocation> cameraOverlay, Optional<HolderSet<EntityType<?>>> allowedEntities, boolean dispensable, boolean swappable, boolean damageOnHurt, boolean equipOnInteract) Creates an instance of aEquippable
record class. -
Method Summary
Modifier and TypeMethodDescriptionOptional
<HolderSet<EntityType<?>>> Returns the value of theallowedEntities
record component.assetId()
Returns the value of theassetId
record component.static Equippable.Builder
builder
(EquipmentSlot p_373113_) Returns the value of thecameraOverlay
record component.boolean
canBeEquippedBy
(EntityType<?> p_371805_) boolean
Returns the value of thedamageOnHurt
record component.boolean
Returns the value of thedispensable
record component.final boolean
Indicates whether some other object is "equal to" this one.boolean
Returns the value of theequipOnInteract
record component.equipOnTarget
(Player p_397505_, LivingEntity p_397083_, ItemStack p_397903_) Returns the value of theequipSound
record component.final int
hashCode()
Returns a hash code value for this object.static Equippable
static Equippable
saddle()
slot()
Returns the value of theslot
record component.boolean
Returns the value of theswappable
record component.swapWithEquipmentSlot
(ItemStack p_371218_, Player p_371907_) final String
toString()
Returns a string representation of this record class.
-
Field Details
-
slot
The field for theslot
record component. -
equipSound
The field for theequipSound
record component. -
assetId
The field for theassetId
record component. -
cameraOverlay
The field for thecameraOverlay
record component. -
allowedEntities
The field for theallowedEntities
record component. -
dispensable
private final boolean dispensableThe field for thedispensable
record component. -
swappable
private final boolean swappableThe field for theswappable
record component. -
damageOnHurt
private final boolean damageOnHurtThe field for thedamageOnHurt
record component. -
equipOnInteract
private final boolean equipOnInteractThe field for theequipOnInteract
record component. -
CODEC
-
STREAM_CODEC
-
-
Constructor Details
-
Equippable
public Equippable(EquipmentSlot slot, Holder<SoundEvent> equipSound, Optional<ResourceKey<EquipmentAsset>> assetId, Optional<ResourceLocation> cameraOverlay, Optional<HolderSet<EntityType<?>>> allowedEntities, boolean dispensable, boolean swappable, boolean damageOnHurt, boolean equipOnInteract) Creates an instance of aEquippable
record class.- Parameters:
slot
- the value for theslot
record componentequipSound
- the value for theequipSound
record componentassetId
- the value for theassetId
record componentcameraOverlay
- the value for thecameraOverlay
record componentallowedEntities
- the value for theallowedEntities
record componentdispensable
- the value for thedispensable
record componentswappable
- the value for theswappable
record componentdamageOnHurt
- the value for thedamageOnHurt
record componentequipOnInteract
- the value for theequipOnInteract
record component
-
-
Method Details
-
llamaSwag
-
saddle
-
builder
-
swapWithEquipmentSlot
-
equipOnTarget
public InteractionResult equipOnTarget(Player p_397505_, LivingEntity p_397083_, ItemStack p_397903_) -
canBeEquippedBy
-
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. -
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. -
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. Reference components are compared withObjects::equals(Object,Object)
; primitive components are compared with '=='. -
slot
Returns the value of theslot
record component.- Returns:
- the value of the
slot
record component
-
equipSound
Returns the value of theequipSound
record component.- Returns:
- the value of the
equipSound
record component
-
assetId
Returns the value of theassetId
record component.- Returns:
- the value of the
assetId
record component
-
cameraOverlay
Returns the value of thecameraOverlay
record component.- Returns:
- the value of the
cameraOverlay
record component
-
allowedEntities
Returns the value of theallowedEntities
record component.- Returns:
- the value of the
allowedEntities
record component
-
dispensable
public boolean dispensable()Returns the value of thedispensable
record component.- Returns:
- the value of the
dispensable
record component
-
swappable
public boolean swappable()Returns the value of theswappable
record component.- Returns:
- the value of the
swappable
record component
-
damageOnHurt
public boolean damageOnHurt()Returns the value of thedamageOnHurt
record component.- Returns:
- the value of the
damageOnHurt
record component
-
equipOnInteract
public boolean equipOnInteract()Returns the value of theequipOnInteract
record component.- Returns:
- the value of the
equipOnInteract
record component
-