Record Class ContextEntityNumberProvider
java.lang.Object
java.lang.Record
com.petrolpark.core.data.loot.numberprovider.ContextEntityNumberProvider
- All Implemented Interfaces:
IEstimableNumberProvider,net.minecraft.world.level.storage.loot.LootContextUser,net.minecraft.world.level.storage.loot.providers.number.NumberProvider
public record ContextEntityNumberProvider(IEntityTarget target, EntityNumberProvider value)
extends Record
implements IEstimableNumberProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec<ContextEntityNumberProvider> -
Constructor Summary
ConstructorsConstructorDescriptionContextEntityNumberProvider(IEntityTarget target, EntityNumberProvider value) Creates an instance of aContextEntityNumberProviderrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal 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 context) 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.target()Returns the value of thetargetrecord component.final StringtoString()Returns a string representation of this record class.value()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
validateMethods inherited from interface net.minecraft.world.level.storage.loot.providers.number.NumberProvider
getInt
-
Field Details
-
CODEC
-
-
Constructor Details
-
ContextEntityNumberProvider
Creates an instance of aContextEntityNumberProviderrecord class.- Parameters:
target- the value for thetargetrecord componentvalue- the value for thevaluerecord component
-
-
Method Details
-
getFloat
public float getFloat(@Nonnull net.minecraft.world.level.storage.loot.LootContext context) - Specified by:
getFloatin 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
-
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). -
target
Returns the value of thetargetrecord component.- Returns:
- the value of the
targetrecord component
-
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-