Record Class BinomialDistributionGenerator
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.providers.number.BinomialDistributionGenerator
- All Implemented Interfaces:
LootContextUser, NumberProvider, Validatable
public record BinomialDistributionGenerator(NumberProvider n, NumberProvider p)
extends Record
implements NumberProvider
A number provider which generates a random number based on a binomial distribution.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<BinomialDistributionGenerator> private final NumberProviderThe field for thenrecord component.private final NumberProviderThe field for theprecord component. -
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of aBinomialDistributionGeneratorrecord class. -
Method Summary
Modifier and TypeMethodDescriptionbinomial(int n, float p) com.mojang.serialization.MapCodec<BinomialDistributionGenerator> codec()final booleanIndicates whether some other object is "equal to" this one.floatgetFloat(LootContext context) intgetInt(LootContext context) final inthashCode()Returns a hash code value for this object.n()Returns the value of thenrecord component.p()Returns the value of theprecord component.final StringtoString()Returns a string representation of this record class.voidvalidate(ValidationContext context) Validate that this object is used correctly according to the given ValidationContext.Methods inherited from interface LootContextUser
getReferencedContextParams
-
Field Details
-
n
The field for thenrecord component. -
p
The field for theprecord component. -
MAP_CODEC
-
-
Constructor Details
-
BinomialDistributionGenerator
Creates an instance of aBinomialDistributionGeneratorrecord class.- Parameters:
n- the value for thenrecord componentp- the value for theprecord component
-
-
Method Details
-
codec
- Specified by:
codecin interfaceNumberProvider
-
getInt
- Specified by:
getIntin interfaceNumberProvider
-
getFloat
- Specified by:
getFloatin interfaceNumberProvider
-
binomial
-
validate
Description copied from interface:LootContextUserValidate that this object is used correctly according to the given ValidationContext.- Specified by:
validatein interfaceLootContextUser- Specified by:
validatein interfaceValidatable
-
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). -
n
Returns the value of thenrecord component.- Returns:
- the value of the
nrecord component
-
p
Returns the value of theprecord component.- Returns:
- the value of the
precord component
-