Record Class ApplyBonusCount.BinomialWithBonusCount
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.functions.ApplyBonusCount.BinomialWithBonusCount
- All Implemented Interfaces:
ApplyBonusCount.Formula
- Enclosing class:
ApplyBonusCount
private static record ApplyBonusCount.BinomialWithBonusCount(int extraRounds, float probability)
extends Record
implements ApplyBonusCount.Formula
Applies a bonus based on a binomial distribution with
n = enchantmentLevel + extraRounds and p = probability.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final com.mojang.serialization.Codec<ApplyBonusCount.BinomialWithBonusCount> private final intThe field for theextraRoundsrecord component.private final floatThe field for theprobabilityrecord component.static final ApplyBonusCount.FormulaType -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateBinomialWithBonusCount(int extraRounds, float probability) Creates an instance of aBinomialWithBonusCountrecord class. -
Method Summary
Modifier and TypeMethodDescriptionintcalculateNewCount(RandomSource random, int count, int level) final booleanIndicates whether some other object is "equal to" this one.intReturns the value of theextraRoundsrecord component.getType()final inthashCode()Returns a hash code value for this object.floatReturns the value of theprobabilityrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
extraRounds
private final int extraRoundsThe field for theextraRoundsrecord component. -
probability
private final float probabilityThe field for theprobabilityrecord component. -
CODEC
-
TYPE
-
-
Constructor Details
-
BinomialWithBonusCount
private BinomialWithBonusCount(int extraRounds, float probability) Creates an instance of aBinomialWithBonusCountrecord class.- Parameters:
extraRounds- the value for theextraRoundsrecord componentprobability- the value for theprobabilityrecord component
-
-
Method Details
-
calculateNewCount
- Specified by:
calculateNewCountin interfaceApplyBonusCount.Formula
-
getType
- Specified by:
getTypein interfaceApplyBonusCount.Formula
-
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 with thecomparemethod from their corresponding wrapper classes. -
extraRounds
public int extraRounds()Returns the value of theextraRoundsrecord component.- Returns:
- the value of the
extraRoundsrecord component
-
probability
public float probability()Returns the value of theprobabilityrecord component.- Returns:
- the value of the
probabilityrecord component
-