| 1 | package net.minecraft.core.component.predicates;
|
| 2 |
|
| 3 | import com.mojang.serialization.Codec;
|
| 4 | import net.minecraft.core.Registry;
|
| 5 | import net.minecraft.core.registries.BuiltInRegistries;
|
| 6 |
|
| 7 | public class DataComponentPredicates {
|
| 8 | public static final DataComponentPredicate.Type<DamagePredicate> DAMAGE = register("damage", DamagePredicate.CODEC);
|
| 9 | public static final DataComponentPredicate.Type<EnchantmentsPredicate.Enchantments> ENCHANTMENTS = register(
|
| 10 | "enchantments", EnchantmentsPredicate.Enchantments.CODEC
|
| 11 | );
|
| 12 | public static final DataComponentPredicate.Type<EnchantmentsPredicate.StoredEnchantments> STORED_ENCHANTMENTS = register(
|
| 13 | "stored_enchantments", EnchantmentsPredicate.StoredEnchantments.CODEC
|
| 14 | );
|
| 15 | public static final DataComponentPredicate.Type<PotionsPredicate> POTIONS = register("potion_contents", PotionsPredicate.CODEC);
|
| 16 | public static final DataComponentPredicate.Type<CustomDataPredicate> CUSTOM_DATA = register("custom_data", CustomDataPredicate.CODEC);
|
| 17 | public static final DataComponentPredicate.Type<ContainerPredicate> CONTAINER = register("container", ContainerPredicate.CODEC);
|
| 18 | public static final DataComponentPredicate.Type<BundlePredicate> BUNDLE_CONTENTS = register("bundle_contents", BundlePredicate.CODEC);
|
| 19 | public static final DataComponentPredicate.Type<FireworkExplosionPredicate> FIREWORK_EXPLOSION = register(
|
| 20 | "firework_explosion", FireworkExplosionPredicate.CODEC
|
| 21 | );
|
| 22 | public static final DataComponentPredicate.Type<FireworksPredicate> FIREWORKS = register("fireworks", FireworksPredicate.CODEC);
|
| 23 | public static final DataComponentPredicate.Type<WritableBookPredicate> WRITABLE_BOOK = register("writable_book_content", WritableBookPredicate.CODEC);
|
| 24 | public static final DataComponentPredicate.Type<WrittenBookPredicate> WRITTEN_BOOK = register("written_book_content", WrittenBookPredicate.CODEC);
|
| 25 | public static final DataComponentPredicate.Type<AttributeModifiersPredicate> ATTRIBUTE_MODIFIERS = register(
|
| 26 | "attribute_modifiers", AttributeModifiersPredicate.CODEC
|
| 27 | );
|
| 28 | public static final DataComponentPredicate.Type<TrimPredicate> ARMOR_TRIM = register("trim", TrimPredicate.CODEC);
|
| 29 | public static final DataComponentPredicate.Type<JukeboxPlayablePredicate> JUKEBOX_PLAYABLE = register("jukebox_playable", JukeboxPlayablePredicate.CODEC);
|
| 30 | public static final DataComponentPredicate.Type<VillagerTypePredicate> VILLAGER_VARIANT = register("villager/variant", VillagerTypePredicate.CODEC);
|
| 31 |
|
| 32 | private static <T extends DataComponentPredicate> DataComponentPredicate.Type<T> register(final String id, final Codec<T> codec) {
|
| 33 | return Registry.register(BuiltInRegistries.DATA_COMPONENT_PREDICATE_TYPE, id, new DataComponentPredicate.ConcreteType<>(codec));
|
| 34 | }
|
| 35 |
|
| 36 | public static DataComponentPredicate.Type<?> bootstrap(final Registry<DataComponentPredicate.Type<?>> registry) {
|
| 37 | return DAMAGE;
|
| 38 | }
|
| 39 | }
|
| 40 |
|