17 lines
582 B
Java
17 lines
582 B
Java
package net.minecraft.advancements.critereon;
|
|
|
|
import com.mojang.serialization.Codec;
|
|
import net.minecraft.world.item.ItemStack;
|
|
|
|
public record ItemCustomDataPredicate(NbtPredicate value) implements ItemSubPredicate {
|
|
public static final Codec<ItemCustomDataPredicate> CODEC = NbtPredicate.CODEC.xmap(ItemCustomDataPredicate::new, ItemCustomDataPredicate::value);
|
|
|
|
@Override
|
|
public boolean matches(ItemStack stack) {
|
|
return this.value.matches(stack);
|
|
}
|
|
|
|
public static ItemCustomDataPredicate customData(NbtPredicate value) {
|
|
return new ItemCustomDataPredicate(value);
|
|
}
|
|
}
|