Record Class EnvironmentAttributeValue
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.providers.number.floats.EnvironmentAttributeValue
- All Implemented Interfaces:
LootContextUser, EnvironmentAttributeProvider, ContextFloatProvider, Validatable
public record EnvironmentAttributeValue(EnvironmentAttribute<?> attribute)
extends Record
implements ContextFloatProvider, EnvironmentAttributeProvider
-
Nested Class Summary
Nested classes/interfaces inherited from interface EnvironmentAttributeProvider
EnvironmentAttributeProvider.Factory<Self> -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final EnvironmentAttribute<?> The field for theattributerecord component.private static final com.mojang.serialization.Codec<EnvironmentAttribute<?>> static final com.mojang.serialization.MapCodec<EnvironmentAttributeValue> -
Constructor Summary
ConstructorsConstructorDescriptionEnvironmentAttributeValue(EnvironmentAttribute<?> attribute) Creates an instance of aEnvironmentAttributeValuerecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattributerecord component.com.mojang.serialization.MapCodec<EnvironmentAttributeValue> codec()final booleanIndicates whether some other object is "equal to" this one.private static <Value> floatgetAsFloat(LootContext context, EnvironmentAttribute<Value> attribute) floatgetFloatUnsafe(LootContext context) final inthashCode()Returns a hash code value for this object.final StringtoString()Returns a string representation of this record class.Methods inherited from interface ContextFloatProvider
getFloat, getFloatOrThrowMethods inherited from interface EnvironmentAttributeProvider
getReferencedContextParamsMethods inherited from interface LootContextUser
validate
-
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 interfaceContextFloatProvider
-
getFloatUnsafe
- Specified by:
getFloatUnsafein interfaceContextFloatProvider
-
getAsFloat
-
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.- Specified by:
attributein interfaceEnvironmentAttributeProvider- Returns:
- the value of the
attributerecord component
-