Record Class LootItemBlockStatePropertyCondition
java.lang.Object
java.lang.Record
net.minecraft.world.level.storage.loot.predicates.LootItemBlockStatePropertyCondition
- All Implemented Interfaces:
Predicate<LootContext>,LootContextUser,LootItemCondition
public record LootItemBlockStatePropertyCondition(Holder<Block> block, Optional<StatePropertiesPredicate> properties)
extends Record
implements LootItemCondition
-
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. -
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.final booleanIndicates whether some other object is "equal to" this one.Set<LootContextParam<?>> getType()hasBlockStateProperties(Block p_81770_) final inthashCode()Returns a hash code value for this object.Returns the value of thepropertiesrecord component.booleantest(LootContext p_81772_) final StringtoString()Returns a string representation of this record class.private static com.mojang.serialization.DataResult<LootItemBlockStatePropertyCondition> validate(LootItemBlockStatePropertyCondition p_298673_) 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
validate
-
Field Details
-
block
The field for theblockrecord component. -
properties
The field for thepropertiesrecord component. -
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 p_298673_) -
getType
- Specified by:
getTypein interfaceLootItemCondition
-
getReferencedContextParams
- Specified by:
getReferencedContextParamsin interfaceLootContextUser
-
test
- Specified by:
testin interfacePredicate<LootContext>
-
hasBlockStateProperties
-
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). -
block
Returns the value of theblockrecord component.- Returns:
- the value of the
blockrecord component
-
properties
Returns the value of thepropertiesrecord component.- Returns:
- the value of the
propertiesrecord component
-