Record Class DropChances

java.lang.Object
java.lang.Record
net.minecraft.world.entity.DropChances

public record DropChances(Map<EquipmentSlot,Float> byEquipment) extends Record
  • Field Details

    • byEquipment

      private final Map<EquipmentSlot,Float> byEquipment
      The field for the byEquipment record component.
    • DEFAULT_EQUIPMENT_DROP_CHANCE

      public static final float DEFAULT_EQUIPMENT_DROP_CHANCE
      See Also:
    • PRESERVE_ITEM_DROP_CHANCE_THRESHOLD

      public static final float PRESERVE_ITEM_DROP_CHANCE_THRESHOLD
      See Also:
    • PRESERVE_ITEM_DROP_CHANCE

      public static final int PRESERVE_ITEM_DROP_CHANCE
      See Also:
    • DEFAULT

      public static final DropChances DEFAULT
    • CODEC

      public static final com.mojang.serialization.Codec<DropChances> CODEC
  • Constructor Details

    • DropChances

      public DropChances(Map<EquipmentSlot,Float> byEquipment)
      Creates an instance of a DropChances record class.
      Parameters:
      byEquipment - the value for the byEquipment record component
  • Method Details

    • filterDefaultValues

      private static Map<EquipmentSlot,Float> filterDefaultValues(Map<EquipmentSlot,Float> p_394014_)
    • toEnumMap

      private static Map<EquipmentSlot,Float> toEnumMap(Map<EquipmentSlot,Float> p_393876_)
    • withGuaranteedDrop

      public DropChances withGuaranteedDrop(EquipmentSlot p_394388_)
    • withEquipmentChance

      public DropChances withEquipmentChance(EquipmentSlot p_394616_, float p_394553_)
    • byEquipment

      public float byEquipment(EquipmentSlot p_394232_)
    • isPreserved

      public boolean isPreserved(EquipmentSlot p_394426_)
    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • byEquipment

      public Map<EquipmentSlot,Float> byEquipment()
      Returns the value of the byEquipment record component.
      Returns:
      the value of the byEquipment record component