Record Class PolynomialNumberProvider
java.lang.Object
java.lang.Record
com.petrolpark.core.data.loot.numberprovider.PolynomialNumberProvider
- All Implemented Interfaces:
IEstimableNumberProvider,net.minecraft.world.level.storage.loot.LootContextUser,net.minecraft.world.level.storage.loot.providers.number.NumberProvider
public record PolynomialNumberProvider(net.minecraft.world.level.storage.loot.providers.number.NumberProvider value, List<net.minecraft.world.level.storage.loot.providers.number.NumberProvider> coefficients)
extends Record
implements IEstimableNumberProvider
petrolpark:polynomial
NumberProviders.
Arguments:
-
value- ANumberProviderto act as input ("x") to the polynomial -
coefficients- A list ofNumberProviders which are the ascending ordered coefficients of the polynomial, including the constant
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<PolynomialNumberProvider> -
Constructor Summary
ConstructorsConstructorDescriptionPolynomialNumberProvider(net.minecraft.world.level.storage.loot.providers.number.NumberProvider value, List<net.minecraft.world.level.storage.loot.providers.number.NumberProvider> coefficients) Creates an instance of aPolynomialNumberProviderrecord class. -
Method Summary
Modifier and TypeMethodDescriptionList<net.minecraft.world.level.storage.loot.providers.number.NumberProvider> Returns the value of thecoefficientsrecord component.final booleanIndicates whether some other object is "equal to" this one.A rough estimate for the output of this Number Provider, for display purposes only.floatgetFloat(net.minecraft.world.level.storage.loot.LootContext lootContext) intgetInt(net.minecraft.world.level.storage.loot.LootContext lootContext) floatgetMaxFloat(net.minecraft.world.level.storage.loot.LootContext context) The maximum possible value this Number Provider can give, ignoring any randomness.net.minecraft.world.level.storage.loot.providers.number.LootNumberProviderTypegetType()final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.net.minecraft.world.level.storage.loot.providers.number.NumberProvidervalue()Returns the value of thevaluerecord component.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface net.minecraft.world.level.storage.loot.LootContextUser
getReferencedContextParams, validate
-
Field Details
-
CODEC
-
-
Constructor Details
-
PolynomialNumberProvider
public PolynomialNumberProvider(net.minecraft.world.level.storage.loot.providers.number.NumberProvider value, List<net.minecraft.world.level.storage.loot.providers.number.NumberProvider> coefficients) Creates an instance of aPolynomialNumberProviderrecord class.- Parameters:
value- the value for thevaluerecord componentcoefficients- the value for thecoefficientsrecord component
-
-
Method Details
-
getFloat
public float getFloat(@Nonnull net.minecraft.world.level.storage.loot.LootContext lootContext) - Specified by:
getFloatin interfacenet.minecraft.world.level.storage.loot.providers.number.NumberProvider
-
getInt
public int getInt(@Nonnull net.minecraft.world.level.storage.loot.LootContext lootContext) - Specified by:
getIntin interfacenet.minecraft.world.level.storage.loot.providers.number.NumberProvider
-
getEstimate
Description copied from interface:IEstimableNumberProviderA rough estimate for the output of this Number Provider, for display purposes only.- Specified by:
getEstimatein interfaceIEstimableNumberProvider
-
getMaxFloat
public float getMaxFloat(net.minecraft.world.level.storage.loot.LootContext context) Description copied from interface:IEstimableNumberProviderThe maximum possible value this Number Provider can give, ignoring any randomness.- Specified by:
getMaxFloatin interfaceIEstimableNumberProvider
-
getType
public net.minecraft.world.level.storage.loot.providers.number.LootNumberProviderType getType()- Specified by:
getTypein interfacenet.minecraft.world.level.storage.loot.providers.number.NumberProvider
-
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). -
value
public net.minecraft.world.level.storage.loot.providers.number.NumberProvider value()Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-
coefficients
Returns the value of thecoefficientsrecord component.- Returns:
- the value of the
coefficientsrecord component
-