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 slot) final booleanIndicates whether some other object is "equal to" this one.private static Map<EquipmentSlot, Float> filterDefaultValues(Map<EquipmentSlot, Float> map) final inthashCode()Returns a hash code value for this object.booleanisPreserved(EquipmentSlot slot) private static Map<EquipmentSlot, Float> toEnumMap(Map<EquipmentSlot, Float> map) final StringtoString()Returns a string representation of this record class.withEquipmentChance(EquipmentSlot slot, float chance)
-
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
-
hashCode
-
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
-