Package net.minecraft.world.entity
Record Class DropChances
java.lang.Object
java.lang.Record
net.minecraft.world.entity.DropChances
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<EquipmentSlot, Float> The field for thebyEquipmentrecord component.static final com.mojang.serialization.Codec<DropChances> static final DropChancesstatic final floatstatic final intstatic final float -
Constructor Summary
ConstructorsConstructorDescriptionDropChances(Map<EquipmentSlot, Float> byEquipment) Creates an instance of aDropChancesrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of thebyEquipmentrecord component.floatbyEquipment(EquipmentSlot pSlot) final booleanIndicates whether some other object is "equal to" this one.private static Map<EquipmentSlot, Float> filterDefaultValues(Map<EquipmentSlot, Float> pChances) final inthashCode()Returns a hash code value for this object.booleanisPreserved(EquipmentSlot pSlot) private static Map<EquipmentSlot, Float> toEnumMap(Map<EquipmentSlot, Float> pChances) final StringtoString()Returns a string representation of this record class.withEquipmentChance(EquipmentSlot pSlot, float pChance) withGuaranteedDrop(EquipmentSlot pSlot)
-
Field Details
-
byEquipment
The field for thebyEquipmentrecord 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
-
CODEC
-
-
Constructor Details
-
DropChances
Creates an instance of aDropChancesrecord class.- Parameters:
byEquipment- the value for thebyEquipmentrecord component
-
-
Method Details
-
filterDefaultValues
-
toEnumMap
-
withGuaranteedDrop
-
withEquipmentChance
-
byEquipment
-
isPreserved
-
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. All components in this record class are compared withObjects::equals(Object,Object). -
byEquipment
Returns the value of thebyEquipmentrecord component.- Returns:
- the value of the
byEquipmentrecord component
-