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
  • Field Details

    • slot

      private final EquipmentSlot slot
      The field for the slot record component.
    • equipSound

      private final Holder<SoundEvent> equipSound
      The field for the equipSound record component.
    • assetId

      private final Optional<ResourceKey<EquipmentAsset>> assetId
      The field for the assetId record component.
    • cameraOverlay

      private final Optional<ResourceLocation> cameraOverlay
      The field for the cameraOverlay record component.
    • allowedEntities

      private final Optional<HolderSet<EntityType<?>>> allowedEntities
      The field for the allowedEntities record component.
    • dispensable

      private final boolean dispensable
      The field for the dispensable record component.
    • swappable

      private final boolean swappable
      The field for the swappable record component.
    • damageOnHurt

      private final boolean damageOnHurt
      The field for the damageOnHurt record component.
    • equipOnInteract

      private final boolean equipOnInteract
      The field for the equipOnInteract record component.
    • CODEC

      public static final com.mojang.serialization.Codec<Equippable> CODEC
    • STREAM_CODEC

      public static final StreamCodec<RegistryFriendlyByteBuf,Equippable> 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 a Equippable record class.
      Parameters:
      slot - the value for the slot record component
      equipSound - the value for the equipSound record component
      assetId - the value for the assetId record component
      cameraOverlay - the value for the cameraOverlay record component
      allowedEntities - the value for the allowedEntities record component
      dispensable - the value for the dispensable record component
      swappable - the value for the swappable record component
      damageOnHurt - the value for the damageOnHurt record component
      equipOnInteract - the value for the equipOnInteract record component
  • Method Details

    • llamaSwag

      public static Equippable llamaSwag(DyeColor p_371759_)
    • saddle

      public static Equippable saddle()
    • builder

      public static Equippable.Builder builder(EquipmentSlot p_373113_)
    • swapWithEquipmentSlot

      public InteractionResult swapWithEquipmentSlot(ItemStack p_371218_, Player p_371907_)
    • equipOnTarget

      public InteractionResult equipOnTarget(Player p_397505_, LivingEntity p_397083_, ItemStack p_397903_)
    • canBeEquippedBy

      public boolean canBeEquippedBy(EntityType<?> p_371805_)
    • 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
    • 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.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final 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. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      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.
    • slot

      public EquipmentSlot slot()
      Returns the value of the slot record component.
      Returns:
      the value of the slot record component
    • equipSound

      public Holder<SoundEvent> equipSound()
      Returns the value of the equipSound record component.
      Returns:
      the value of the equipSound record component
    • assetId

      public Optional<ResourceKey<EquipmentAsset>> assetId()
      Returns the value of the assetId record component.
      Returns:
      the value of the assetId record component
    • cameraOverlay

      public Optional<ResourceLocation> cameraOverlay()
      Returns the value of the cameraOverlay record component.
      Returns:
      the value of the cameraOverlay record component
    • allowedEntities

      public Optional<HolderSet<EntityType<?>>> allowedEntities()
      Returns the value of the allowedEntities record component.
      Returns:
      the value of the allowedEntities record component
    • dispensable

      public boolean dispensable()
      Returns the value of the dispensable record component.
      Returns:
      the value of the dispensable record component
    • swappable

      public boolean swappable()
      Returns the value of the swappable record component.
      Returns:
      the value of the swappable record component
    • damageOnHurt

      public boolean damageOnHurt()
      Returns the value of the damageOnHurt record component.
      Returns:
      the value of the damageOnHurt record component
    • equipOnInteract

      public boolean equipOnInteract()
      Returns the value of the equipOnInteract record component.
      Returns:
      the value of the equipOnInteract record component