Record Class EnvironmentAttributeValue
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.providers.number.EnvironmentAttributeValue
- All Implemented Interfaces:
LootContextUser, NumberProvider, Validatable
public record EnvironmentAttributeValue(EnvironmentAttribute<?> attribute)
extends Record
implements NumberProvider
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final EnvironmentAttribute<?> The field for theattributerecord component.private static final Codec<EnvironmentAttribute<?>> static final MapCodec<EnvironmentAttributeValue> -
Constructor Summary
ConstructorsConstructorDescriptionEnvironmentAttributeValue(EnvironmentAttribute<?> attribute) Creates an instance of aEnvironmentAttributeValuerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattributerecord component.codec()final booleanIndicates whether some other object is "equal to" this one.static EnvironmentAttributeValueforEnvironmentAttribute(EnvironmentAttribute<?> attribute) private static <Value> floatgetAsFloat(LootContext context, EnvironmentAttribute<Value> attribute) floatgetFloat(LootContext context) Set<ContextKey<?>> final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.Methods inherited from interface LootContextUser
validateMethods inherited from interface NumberProvider
getInt
-
Field Details
-
attribute
The field for theattributerecord component. -
ATTRIBUTE_CODEC
-
MAP_CODEC
-
-
Constructor Details
-
EnvironmentAttributeValue
Creates an instance of aEnvironmentAttributeValuerecord class.- Parameters:
attribute- the value for theattributerecord component
-
-
Method Details
-
codec
- Specified by:
codecin interfaceNumberProvider
-
getFloat
- Specified by:
getFloatin interfaceNumberProvider
-
getAsFloat
-
getReferencedContextParams
- Specified by:
getReferencedContextParamsin interfaceLootContextUser
-
forEnvironmentAttribute
-
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). -
attribute
Returns the value of theattributerecord component.- Returns:
- the value of the
attributerecord component
-