Record Class ConditionalNumberProvider
java.lang.Object
java.lang.Record
com.petrolpark.core.data.loot.numberprovider.ConditionalNumberProvider
- All Implemented Interfaces:
IEstimableNumberProvider,net.minecraft.world.level.storage.loot.LootContextUser,net.minecraft.world.level.storage.loot.providers.number.NumberProvider
public record ConditionalNumberProvider(net.minecraft.world.level.storage.loot.predicates.LootItemCondition condition, net.minecraft.world.level.storage.loot.providers.number.NumberProvider pass, net.minecraft.world.level.storage.loot.providers.number.NumberProvider fail)
extends Record
implements IEstimableNumberProvider
petrolpark:conditional
NumberProviders based on whether a LootItemCondition passes.
Arguments:
-
condition-LootItemConditionto test -
pass-NumberProviderto call if the condition is met -
fail-NumberProviderto call if the condition is not met
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<ConditionalNumberProvider> -
Constructor Summary
ConstructorsConstructorDescriptionConditionalNumberProvider(net.minecraft.world.level.storage.loot.predicates.LootItemCondition condition, net.minecraft.world.level.storage.loot.providers.number.NumberProvider pass, net.minecraft.world.level.storage.loot.providers.number.NumberProvider fail) Creates an instance of aConditionalNumberProviderrecord class. -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.world.level.storage.loot.predicates.LootItemConditionReturns the value of theconditionrecord component.final booleanIndicates whether some other object is "equal to" this one.net.minecraft.world.level.storage.loot.providers.number.NumberProviderfail()Returns the value of thefailrecord component.net.minecraft.world.level.storage.loot.providers.number.NumberProviderget(net.minecraft.world.level.storage.loot.LootContext context) 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.Set<net.minecraft.world.level.storage.loot.parameters.LootContextParam<?>> net.minecraft.world.level.storage.loot.providers.number.LootNumberProviderTypegetType()final inthashCode()Returns a hash code value for this object.net.minecraft.world.level.storage.loot.providers.number.NumberProviderpass()Returns the value of thepassrecord component.final StringtoString()Returns a string representation of this record class.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
validate
-
Field Details
-
CODEC
-
-
Constructor Details
-
ConditionalNumberProvider
public ConditionalNumberProvider(net.minecraft.world.level.storage.loot.predicates.LootItemCondition condition, net.minecraft.world.level.storage.loot.providers.number.NumberProvider pass, net.minecraft.world.level.storage.loot.providers.number.NumberProvider fail) Creates an instance of aConditionalNumberProviderrecord class.- Parameters:
condition- the value for theconditionrecord componentpass- the value for thepassrecord componentfail- the value for thefailrecord component
-
-
Method Details
-
get
public net.minecraft.world.level.storage.loot.providers.number.NumberProvider get(net.minecraft.world.level.storage.loot.LootContext context) -
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
-
getType
public net.minecraft.world.level.storage.loot.providers.number.LootNumberProviderType getType()- Specified by:
getTypein 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
-
getReferencedContextParams
public Set<net.minecraft.world.level.storage.loot.parameters.LootContextParam<?>> getReferencedContextParams()- Specified by:
getReferencedContextParamsin interfacenet.minecraft.world.level.storage.loot.LootContextUser
-
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). -
condition
public net.minecraft.world.level.storage.loot.predicates.LootItemCondition condition()Returns the value of theconditionrecord component.- Returns:
- the value of the
conditionrecord component
-
pass
public net.minecraft.world.level.storage.loot.providers.number.NumberProvider pass()Returns the value of thepassrecord component.- Returns:
- the value of the
passrecord component
-
fail
public net.minecraft.world.level.storage.loot.providers.number.NumberProvider fail()Returns the value of thefailrecord component.- Returns:
- the value of the
failrecord component
-