Record Class LootItemBlockStatePropertyCondition
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition
- All Implemented Interfaces:
Predicate<LootContext>, LootContextUser, LootItemCondition, Validatable
public record LootItemBlockStatePropertyCondition(Holder<Block> block, Optional<StatePropertiesPredicate> properties)
extends Record
implements LootItemCondition
A LootItemCondition that checks whether the block state matches a given Block and
StatePropertiesPredicate.-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionThe field for theblockrecord component.static final com.mojang.serialization.MapCodec<LootItemBlockStatePropertyCondition> private final Optional<StatePropertiesPredicate> The field for thepropertiesrecord component.Fields inherited from interface LootItemCondition
CODEC, DIRECT_CODEC, TYPED_CODEC -
Constructor Summary
ConstructorsConstructorDescriptionLootItemBlockStatePropertyCondition(Holder<Block> block, Optional<StatePropertiesPredicate> properties) Creates an instance of aLootItemBlockStatePropertyConditionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionblock()Returns the value of theblockrecord component.com.mojang.serialization.MapCodec<LootItemBlockStatePropertyCondition> codec()final booleanIndicates whether some other object is "equal to" this one.Set<ContextKey<?>> hasBlockStateProperties(Block block) final inthashCode()Returns a hash code value for this object.Returns the value of thepropertiesrecord component.booleantest(LootContext context) final StringtoString()Returns a string representation of this record class.private static com.mojang.serialization.DataResult<LootItemBlockStatePropertyCondition> validate(LootItemBlockStatePropertyCondition condition) Methods inherited from interface LootContextUser
validate
-
Field Details
-
block
-
properties
The field for thepropertiesrecord component. -
MAP_CODEC
public static final com.mojang.serialization.MapCodec<LootItemBlockStatePropertyCondition> MAP_CODEC
-
-
Constructor Details
-
LootItemBlockStatePropertyCondition
public LootItemBlockStatePropertyCondition(Holder<Block> block, Optional<StatePropertiesPredicate> properties) Creates an instance of aLootItemBlockStatePropertyConditionrecord class.- Parameters:
block- the value for theblockrecord componentproperties- the value for thepropertiesrecord component
-
-
Method Details
-
validate
private static com.mojang.serialization.DataResult<LootItemBlockStatePropertyCondition> validate(LootItemBlockStatePropertyCondition condition) -
codec
- Specified by:
codecin interfaceLootItemCondition
-
getReferencedContextParams
- Specified by:
getReferencedContextParamsin interfaceLootContextUser
-
test
- Specified by:
testin interfacePredicate<LootContext>
-
hasBlockStateProperties
-
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). -
block
-
properties
Returns the value of thepropertiesrecord component.- Returns:
- the value of the
propertiesrecord component
-