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, boolean canBeSheared, Holder<SoundEvent> shearingSound)
extends Record
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Optional<HolderSet<EntityType<?>>> The field for theallowedEntitiesrecord component.private final Optional<ResourceKey<EquipmentAsset>> The field for theassetIdrecord component.private final Optional<ResourceLocation> The field for thecameraOverlayrecord component.private final booleanThe field for thecanBeShearedrecord component.static final com.mojang.serialization.Codec<Equippable> private final booleanThe field for thedamageOnHurtrecord component.private final booleanThe field for thedispensablerecord component.private final booleanThe field for theequipOnInteractrecord component.private final Holder<SoundEvent> The field for theequipSoundrecord component.private final Holder<SoundEvent> The field for theshearingSoundrecord component.private final EquipmentSlotThe field for theslotrecord component.static final StreamCodec<RegistryFriendlyByteBuf, Equippable> private final booleanThe field for theswappablerecord 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, boolean canBeSheared, Holder<SoundEvent> shearingSound) Creates an instance of aEquippablerecord class. -
Method Summary
Modifier and TypeMethodDescriptionOptional<HolderSet<EntityType<?>>> Returns the value of theallowedEntitiesrecord component.assetId()Returns the value of theassetIdrecord component.static Equippable.Builderbuilder(EquipmentSlot pSlot) Returns the value of thecameraOverlayrecord component.booleancanBeEquippedBy(EntityType<?> pEntityType) booleanReturns the value of thecanBeShearedrecord component.booleanReturns the value of thedamageOnHurtrecord component.booleanReturns the value of thedispensablerecord component.final booleanIndicates whether some other object is "equal to" this one.booleanReturns the value of theequipOnInteractrecord component.equipOnTarget(Player pPlayer, LivingEntity pEntity, ItemStack pStack) Returns the value of theequipSoundrecord component.static Equippablefinal inthashCode()Returns a hash code value for this object.static Equippablestatic Equippablesaddle()Returns the value of theshearingSoundrecord component.slot()Returns the value of theslotrecord component.booleanReturns the value of theswappablerecord component.swapWithEquipmentSlot(ItemStack pStack, Player pPlayer) final StringtoString()Returns a string representation of this record class.
-
Field Details
-
slot
The field for theslotrecord component. -
equipSound
The field for theequipSoundrecord component. -
assetId
The field for theassetIdrecord component. -
cameraOverlay
The field for thecameraOverlayrecord component. -
allowedEntities
The field for theallowedEntitiesrecord component. -
dispensable
private final boolean dispensableThe field for thedispensablerecord component. -
swappable
private final boolean swappableThe field for theswappablerecord component. -
damageOnHurt
private final boolean damageOnHurtThe field for thedamageOnHurtrecord component. -
equipOnInteract
private final boolean equipOnInteractThe field for theequipOnInteractrecord component. -
canBeSheared
private final boolean canBeShearedThe field for thecanBeShearedrecord component. -
shearingSound
The field for theshearingSoundrecord 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, boolean canBeSheared, Holder<SoundEvent> shearingSound) Creates an instance of aEquippablerecord class.- Parameters:
slot- the value for theslotrecord componentequipSound- the value for theequipSoundrecord componentassetId- the value for theassetIdrecord componentcameraOverlay- the value for thecameraOverlayrecord componentallowedEntities- the value for theallowedEntitiesrecord componentdispensable- the value for thedispensablerecord componentswappable- the value for theswappablerecord componentdamageOnHurt- the value for thedamageOnHurtrecord componentequipOnInteract- the value for theequipOnInteractrecord componentcanBeSheared- the value for thecanBeShearedrecord componentshearingSound- the value for theshearingSoundrecord component
-
-
Method Details
-
llamaSwag
-
saddle
-
harness
-
builder
-
swapWithEquipmentSlot
-
equipOnTarget
-
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 theslotrecord component.- Returns:
- the value of the
slotrecord component
-
equipSound
Returns the value of theequipSoundrecord component.- Returns:
- the value of the
equipSoundrecord component
-
assetId
Returns the value of theassetIdrecord component.- Returns:
- the value of the
assetIdrecord component
-
cameraOverlay
Returns the value of thecameraOverlayrecord component.- Returns:
- the value of the
cameraOverlayrecord component
-
allowedEntities
Returns the value of theallowedEntitiesrecord component.- Returns:
- the value of the
allowedEntitiesrecord component
-
dispensable
public boolean dispensable()Returns the value of thedispensablerecord component.- Returns:
- the value of the
dispensablerecord component
-
swappable
public boolean swappable()Returns the value of theswappablerecord component.- Returns:
- the value of the
swappablerecord component
-
damageOnHurt
public boolean damageOnHurt()Returns the value of thedamageOnHurtrecord component.- Returns:
- the value of the
damageOnHurtrecord component
-
equipOnInteract
public boolean equipOnInteract()Returns the value of theequipOnInteractrecord component.- Returns:
- the value of the
equipOnInteractrecord component
-
canBeSheared
public boolean canBeSheared()Returns the value of thecanBeShearedrecord component.- Returns:
- the value of the
canBeShearedrecord component
-
shearingSound
Returns the value of theshearingSoundrecord component.- Returns:
- the value of the
shearingSoundrecord component
-