Record Class EnvironmentAttributeCheck<Value>
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.predicates.EnvironmentAttributeCheck<Value>
- All Implemented Interfaces:
Predicate<LootContext>, LootContextUser, LootItemCondition, Validatable
public record EnvironmentAttributeCheck<Value>(EnvironmentAttribute<Value> attribute, Value value)
extends Record
implements LootItemCondition
-
Nested Class Summary
Nested classes/interfaces inherited from interface LootItemCondition
LootItemCondition.Builder -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final EnvironmentAttribute<Value> The field for theattributerecord component.static final MapCodec<EnvironmentAttributeCheck<?>> private final ValueThe field for thevaluerecord component.Fields inherited from interface LootItemCondition
CODEC, DIRECT_CODEC, TYPED_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionEnvironmentAttributeCheck(EnvironmentAttribute<Value> attribute, Value value) Creates an instance of aEnvironmentAttributeCheckrecord class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattributerecord component.codec()private static <Value> MapCodec<EnvironmentAttributeCheck<Value>> createCodec(EnvironmentAttribute<Value> attribute) static <Value> LootItemCondition.BuilderenvironmentAttribute(EnvironmentAttribute<Value> attribute, Value value) final booleanIndicates whether some other object is "equal to" this one.Set<ContextKey<?>> final inthashCode()Returns a hash code value for this object.booleantest(LootContext context) final StringtoString()Returns a string representation of this record class.value()Returns the value of thevaluerecord component.Methods inherited from interface LootContextUser
validate
-
Field Details
-
attribute
The field for theattributerecord component. -
value
The field for thevaluerecord component. -
MAP_CODEC
-
-
Constructor Details
-
EnvironmentAttributeCheck
Creates an instance of aEnvironmentAttributeCheckrecord class.- Parameters:
attribute- the value for theattributerecord componentvalue- the value for thevaluerecord component
-
-
Method Details
-
createCodec
private static <Value> MapCodec<EnvironmentAttributeCheck<Value>> createCodec(EnvironmentAttribute<Value> attribute) -
codec
- Specified by:
codecin interfaceLootItemCondition
-
getReferencedContextParams
- Specified by:
getReferencedContextParamsin interfaceLootContextUser
-
test
-
environmentAttribute
public static <Value> LootItemCondition.Builder environmentAttribute(EnvironmentAttribute<Value> attribute, Value value) -
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
-
value
Returns the value of thevaluerecord component.- Returns:
- the value of the
valuerecord component
-