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
-
Field Summary
Modifier and TypeFieldDescriptionThe field for theblock
record component.static final com.mojang.serialization.Codec<LootItemBlockStatePropertyCondition>
private final Optional<StatePropertiesPredicate>
The field for theproperties
record component. -
Constructor Summary
ConstructorDescriptionLootItemBlockStatePropertyCondition
(Holder<Block> block, Optional<StatePropertiesPredicate> properties) Creates an instance of aLootItemBlockStatePropertyCondition
record class. -
Method Summary
Modifier and TypeMethodDescriptionblock()
Returns the value of theblock
record component.final boolean
Indicates whether some other object is "equal to" this one.Set<LootContextParam<?>>
getType()
hasBlockStateProperties
(Block p_81770_) final int
hashCode()
Returns a hash code value for this object.Returns the value of theproperties
record component.boolean
test
(LootContext p_81772_) final String
toString()
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, wait
Methods inherited from interface net.minecraft.world.level.storage.loot.LootContextUser
validate
-
Field Details
-
block
The field for theblock
record component. -
properties
The field for theproperties
record component. -
CODEC
-
-
Constructor Details
-
LootItemBlockStatePropertyCondition
public LootItemBlockStatePropertyCondition(Holder<Block> block, Optional<StatePropertiesPredicate> properties) Creates an instance of aLootItemBlockStatePropertyCondition
record class.- Parameters:
block
- the value for theblock
record componentproperties
- the value for theproperties
record component
-
-
Method Details
-
validate
private static com.mojang.serialization.DataResult<LootItemBlockStatePropertyCondition> validate(LootItemBlockStatePropertyCondition p_298673_) -
getType
- Specified by:
getType
in interfaceLootItemCondition
-
getReferencedContextParams
- Specified by:
getReferencedContextParams
in interfaceLootContextUser
-
test
- Specified by:
test
in 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 theblock
record component.- Returns:
- the value of the
block
record component
-
properties
Returns the value of theproperties
record component.- Returns:
- the value of the
properties
record component
-