| 1 | package net.minecraft.core.component;
|
| 2 |
|
| 3 | import com.mojang.serialization.Codec;
|
| 4 | import java.util.List;
|
| 5 | import java.util.function.UnaryOperator;
|
| 6 | import net.minecraft.core.Holder;
|
| 7 | import net.minecraft.core.HolderSet;
|
| 8 | import net.minecraft.core.Registry;
|
| 9 | import net.minecraft.core.registries.BuiltInRegistries;
|
| 10 | import net.minecraft.core.registries.Registries;
|
| 11 | import net.minecraft.core.registries.codec.RegistryCodecs;
|
| 12 | import net.minecraft.network.chat.Component;
|
| 13 | import net.minecraft.network.chat.ComponentSerialization;
|
| 14 | import net.minecraft.network.codec.ByteBufCodecs;
|
| 15 | import net.minecraft.resources.Identifier;
|
| 16 | import net.minecraft.resources.ResourceKey;
|
| 17 | import net.minecraft.sounds.SoundEvent;
|
| 18 | import net.minecraft.sounds.SoundEvents;
|
| 19 | import net.minecraft.util.EncoderCache;
|
| 20 | import net.minecraft.util.ExtraCodecs;
|
| 21 | import net.minecraft.util.Unit;
|
| 22 | import net.minecraft.world.LockCode;
|
| 23 | import net.minecraft.world.damagesource.DamageType;
|
| 24 | import net.minecraft.world.entity.EntityType;
|
| 25 | import net.minecraft.world.entity.animal.axolotl.Axolotl;
|
| 26 | import net.minecraft.world.entity.animal.chicken.ChickenSoundVariant;
|
| 27 | import net.minecraft.world.entity.animal.chicken.ChickenVariant;
|
| 28 | import net.minecraft.world.entity.animal.cow.CowSoundVariant;
|
| 29 | import net.minecraft.world.entity.animal.cow.CowVariant;
|
| 30 | import net.minecraft.world.entity.animal.cow.MushroomCow;
|
| 31 | import net.minecraft.world.entity.animal.equine.Llama;
|
| 32 | import net.minecraft.world.entity.animal.equine.Variant;
|
| 33 | import net.minecraft.world.entity.animal.feline.CatSoundVariant;
|
| 34 | import net.minecraft.world.entity.animal.feline.CatVariant;
|
| 35 | import net.minecraft.world.entity.animal.fish.Salmon;
|
| 36 | import net.minecraft.world.entity.animal.fish.TropicalFish;
|
| 37 | import net.minecraft.world.entity.animal.fox.Fox;
|
| 38 | import net.minecraft.world.entity.animal.frog.FrogVariant;
|
| 39 | import net.minecraft.world.entity.animal.nautilus.ZombieNautilusVariant;
|
| 40 | import net.minecraft.world.entity.animal.parrot.Parrot;
|
| 41 | import net.minecraft.world.entity.animal.pig.PigSoundVariant;
|
| 42 | import net.minecraft.world.entity.animal.pig.PigVariant;
|
| 43 | import net.minecraft.world.entity.animal.rabbit.Rabbit;
|
| 44 | import net.minecraft.world.entity.animal.wolf.WolfSoundVariant;
|
| 45 | import net.minecraft.world.entity.animal.wolf.WolfVariant;
|
| 46 | import net.minecraft.world.entity.decoration.painting.PaintingVariant;
|
| 47 | import net.minecraft.world.entity.npc.villager.VillagerType;
|
| 48 | import net.minecraft.world.food.FoodProperties;
|
| 49 | import net.minecraft.world.food.VillagerFood;
|
| 50 | import net.minecraft.world.item.AdventureModePredicate;
|
| 51 | import net.minecraft.world.item.DyeColor;
|
| 52 | import net.minecraft.world.item.JukeboxPlayable;
|
| 53 | import net.minecraft.world.item.Rarity;
|
| 54 | import net.minecraft.world.item.alchemy.PotionContents;
|
| 55 | import net.minecraft.world.item.component.AttackRange;
|
| 56 | import net.minecraft.world.item.component.Bees;
|
| 57 | import net.minecraft.world.item.component.BlockItemStateProperties;
|
| 58 | import net.minecraft.world.item.component.BlocksAttacks;
|
| 59 | import net.minecraft.world.item.component.BrewingFuel;
|
| 60 | import net.minecraft.world.item.component.BundleContents;
|
| 61 | import net.minecraft.world.item.component.ChargedProjectiles;
|
| 62 | import net.minecraft.world.item.component.Compostable;
|
| 63 | import net.minecraft.world.item.component.Consumable;
|
| 64 | import net.minecraft.world.item.component.CookingFuel;
|
| 65 | import net.minecraft.world.item.component.CustomData;
|
| 66 | import net.minecraft.world.item.component.CustomModelData;
|
| 67 | import net.minecraft.world.item.component.DamageResistant;
|
| 68 | import net.minecraft.world.item.component.DeathProtection;
|
| 69 | import net.minecraft.world.item.component.DebugStickState;
|
| 70 | import net.minecraft.world.item.component.DyedItemColor;
|
| 71 | import net.minecraft.world.item.component.FireworkExplosion;
|
| 72 | import net.minecraft.world.item.component.Fireworks;
|
| 73 | import net.minecraft.world.item.component.InstrumentComponent;
|
| 74 | import net.minecraft.world.item.component.ItemAttributeModifiers;
|
| 75 | import net.minecraft.world.item.component.ItemContainerContents;
|
| 76 | import net.minecraft.world.item.component.ItemLore;
|
| 77 | import net.minecraft.world.item.component.KineticWeapon;
|
| 78 | import net.minecraft.world.item.component.LodestoneTracker;
|
| 79 | import net.minecraft.world.item.component.MapDecorations;
|
| 80 | import net.minecraft.world.item.component.MapPostProcessing;
|
| 81 | import net.minecraft.world.item.component.MobVisibility;
|
| 82 | import net.minecraft.world.item.component.OminousBottleAmplifier;
|
| 83 | import net.minecraft.world.item.component.PiercingWeapon;
|
| 84 | import net.minecraft.world.item.component.ResolvableProfile;
|
| 85 | import net.minecraft.world.item.component.SeededContainerLoot;
|
| 86 | import net.minecraft.world.item.component.SulfurCubeContent;
|
| 87 | import net.minecraft.world.item.component.SuspiciousStewEffects;
|
| 88 | import net.minecraft.world.item.component.SwingAnimation;
|
| 89 | import net.minecraft.world.item.component.Tool;
|
| 90 | import net.minecraft.world.item.component.TooltipDisplay;
|
| 91 | import net.minecraft.world.item.component.TypedEntityData;
|
| 92 | import net.minecraft.world.item.component.UseCooldown;
|
| 93 | import net.minecraft.world.item.component.UseEffects;
|
| 94 | import net.minecraft.world.item.component.UseRemainder;
|
| 95 | import net.minecraft.world.item.component.Weapon;
|
| 96 | import net.minecraft.world.item.component.WritableBookContent;
|
| 97 | import net.minecraft.world.item.component.WrittenBookContent;
|
| 98 | import net.minecraft.world.item.crafting.Recipe;
|
| 99 | import net.minecraft.world.item.enchantment.Enchantable;
|
| 100 | import net.minecraft.world.item.enchantment.ItemEnchantments;
|
| 101 | import net.minecraft.world.item.enchantment.Repairable;
|
| 102 | import net.minecraft.world.item.equipment.Equippable;
|
| 103 | import net.minecraft.world.item.equipment.trim.ArmorTrim;
|
| 104 | import net.minecraft.world.item.equipment.trim.TrimMaterial;
|
| 105 | import net.minecraft.world.level.block.entity.BannerPattern;
|
| 106 | import net.minecraft.world.level.block.entity.BannerPatternLayers;
|
| 107 | import net.minecraft.world.level.block.entity.BlockEntityType;
|
| 108 | import net.minecraft.world.level.block.entity.DecoratedPotPattern;
|
| 109 | import net.minecraft.world.level.block.entity.DecoratedPotPatterns;
|
| 110 | import net.minecraft.world.level.block.entity.PotDecorations;
|
| 111 | import net.minecraft.world.level.block.entity.SignText;
|
| 112 | import net.minecraft.world.level.saveddata.maps.MapId;
|
| 113 |
|
| 114 | public class DataComponents {
|
| 115 | static final EncoderCache ENCODER_CACHE = new EncoderCache(512);
|
| 116 | public static final DataComponentType<CustomData> CUSTOM_DATA = register("custom_data", b -> b.persistent(CustomData.CODEC));
|
| 117 | public static final DataComponentType<Integer> MAX_STACK_SIZE = register(
|
| 118 | "max_stack_size", b -> b.persistent(ExtraCodecs.intRange(1, 99)).networkSynchronized(ByteBufCodecs.VAR_INT)
|
| 119 | );
|
| 120 | public static final DataComponentType<Integer> MAX_DAMAGE = register(
|
| 121 | "max_damage", b -> b.persistent(ExtraCodecs.POSITIVE_INT).networkSynchronized(ByteBufCodecs.VAR_INT)
|
| 122 | );
|
| 123 | public static final DataComponentType<Integer> DAMAGE = register(
|
| 124 | "damage", b -> b.persistent(ExtraCodecs.NON_NEGATIVE_INT).ignoreSwapAnimation().networkSynchronized(ByteBufCodecs.VAR_INT)
|
| 125 | );
|
| 126 | public static final DataComponentType<Unit> UNBREAKABLE = register("unbreakable", b -> b.persistent(Unit.CODEC).networkSynchronized(Unit.STREAM_CODEC));
|
| 127 | public static final DataComponentType<UseEffects> USE_EFFECTS = register(
|
| 128 | "use_effects", b -> b.persistent(UseEffects.CODEC).networkSynchronized(UseEffects.STREAM_CODEC)
|
| 129 | );
|
| 130 | public static final DataComponentType<Component> CUSTOM_NAME = register(
|
| 131 | "custom_name", b -> b.persistent(ComponentSerialization.CODEC).networkSynchronized(ComponentSerialization.STREAM_CODEC).cacheEncoding()
|
| 132 | );
|
| 133 | public static final DataComponentType<Float> MINIMUM_ATTACK_CHARGE = register(
|
| 134 | "minimum_attack_charge", b -> b.persistent(ExtraCodecs.floatRange(0.0F, 1.0F)).networkSynchronized(ByteBufCodecs.FLOAT)
|
| 135 | );
|
| 136 | public static final DataComponentType<Holder<DamageType>> DAMAGE_TYPE = register(
|
| 137 | "damage_type", b -> b.persistent(DamageType.CODEC).networkSynchronized(DamageType.STREAM_CODEC)
|
| 138 | );
|
| 139 | public static final DataComponentType<Component> ITEM_NAME = register(
|
| 140 | "item_name", b -> b.persistent(ComponentSerialization.CODEC).networkSynchronized(ComponentSerialization.STREAM_CODEC).cacheEncoding()
|
| 141 | );
|
| 142 | public static final DataComponentType<Identifier> ITEM_MODEL = register(
|
| 143 | "item_model", b -> b.persistent(Identifier.CODEC).networkSynchronized(Identifier.STREAM_CODEC).cacheEncoding()
|
| 144 | );
|
| 145 | public static final DataComponentType<ItemLore> LORE = register(
|
| 146 | "lore", b -> b.persistent(ItemLore.CODEC).networkSynchronized(ItemLore.STREAM_CODEC).cacheEncoding()
|
| 147 | );
|
| 148 | public static final DataComponentType<Rarity> RARITY = register("rarity", b -> b.persistent(Rarity.CODEC).networkSynchronized(Rarity.STREAM_CODEC));
|
| 149 | public static final DataComponentType<ItemEnchantments> ENCHANTMENTS = register(
|
| 150 | "enchantments", b -> b.persistent(ItemEnchantments.CODEC).networkSynchronized(ItemEnchantments.STREAM_CODEC).cacheEncoding()
|
| 151 | );
|
| 152 | public static final DataComponentType<AdventureModePredicate> CAN_PLACE_ON = register(
|
| 153 | "can_place_on", b -> b.persistent(AdventureModePredicate.CODEC).networkSynchronized(AdventureModePredicate.STREAM_CODEC).cacheEncoding()
|
| 154 | );
|
| 155 | public static final DataComponentType<AdventureModePredicate> CAN_BREAK = register(
|
| 156 | "can_break", b -> b.persistent(AdventureModePredicate.CODEC).networkSynchronized(AdventureModePredicate.STREAM_CODEC).cacheEncoding()
|
| 157 | );
|
| 158 | public static final DataComponentType<ItemAttributeModifiers> ATTRIBUTE_MODIFIERS = register(
|
| 159 | "attribute_modifiers", b -> b.persistent(ItemAttributeModifiers.CODEC).networkSynchronized(ItemAttributeModifiers.STREAM_CODEC).cacheEncoding()
|
| 160 | );
|
| 161 | public static final DataComponentType<CustomModelData> CUSTOM_MODEL_DATA = register(
|
| 162 | "custom_model_data", b -> b.persistent(CustomModelData.CODEC).networkSynchronized(CustomModelData.STREAM_CODEC)
|
| 163 | );
|
| 164 | public static final DataComponentType<TooltipDisplay> TOOLTIP_DISPLAY = register(
|
| 165 | "tooltip_display", b -> b.persistent(TooltipDisplay.CODEC).networkSynchronized(TooltipDisplay.STREAM_CODEC).cacheEncoding()
|
| 166 | );
|
| 167 | public static final DataComponentType<Integer> REPAIR_COST = register(
|
| 168 | "repair_cost", b -> b.persistent(ExtraCodecs.NON_NEGATIVE_INT).networkSynchronized(ByteBufCodecs.VAR_INT)
|
| 169 | );
|
| 170 | public static final DataComponentType<Unit> CREATIVE_SLOT_LOCK = register("creative_slot_lock", b -> b.networkSynchronized(Unit.STREAM_CODEC));
|
| 171 | public static final DataComponentType<Boolean> ENCHANTMENT_GLINT_OVERRIDE = register(
|
| 172 | "enchantment_glint_override", b -> b.persistent(Codec.BOOL).networkSynchronized(ByteBufCodecs.BOOL)
|
| 173 | );
|
| 174 | public static final DataComponentType<Unit> INTANGIBLE_PROJECTILE = register("intangible_projectile", b -> b.persistent(Unit.CODEC));
|
| 175 | public static final DataComponentType<FoodProperties> FOOD = register(
|
| 176 | "food", b -> b.persistent(FoodProperties.DIRECT_CODEC).networkSynchronized(FoodProperties.DIRECT_STREAM_CODEC).cacheEncoding()
|
| 177 | );
|
| 178 | public static final DataComponentType<Consumable> CONSUMABLE = register(
|
| 179 | "consumable", b -> b.persistent(Consumable.CODEC).networkSynchronized(Consumable.STREAM_CODEC).cacheEncoding()
|
| 180 | );
|
| 181 | public static final DataComponentType<UseRemainder> USE_REMAINDER = register(
|
| 182 | "use_remainder", b -> b.persistent(UseRemainder.CODEC).networkSynchronized(UseRemainder.STREAM_CODEC).cacheEncoding()
|
| 183 | );
|
| 184 | public static final DataComponentType<UseCooldown> USE_COOLDOWN = register(
|
| 185 | "use_cooldown", b -> b.persistent(UseCooldown.CODEC).networkSynchronized(UseCooldown.STREAM_CODEC).cacheEncoding()
|
| 186 | );
|
| 187 | public static final DataComponentType<DamageResistant> DAMAGE_RESISTANT = register(
|
| 188 | "damage_resistant", b -> b.persistent(DamageResistant.CODEC).networkSynchronized(DamageResistant.STREAM_CODEC).cacheEncoding()
|
| 189 | );
|
| 190 | public static final DataComponentType<Tool> TOOL = register("tool", b -> b.persistent(Tool.CODEC).networkSynchronized(Tool.STREAM_CODEC).cacheEncoding());
|
| 191 | public static final DataComponentType<Weapon> WEAPON = register(
|
| 192 | "weapon", b -> b.persistent(Weapon.CODEC).networkSynchronized(Weapon.STREAM_CODEC).cacheEncoding()
|
| 193 | );
|
| 194 | public static final DataComponentType<AttackRange> ATTACK_RANGE = register(
|
| 195 | "attack_range", b -> b.persistent(AttackRange.CODEC).networkSynchronized(AttackRange.STREAM_CODEC).cacheEncoding()
|
| 196 | );
|
| 197 | public static final DataComponentType<Enchantable> ENCHANTABLE = register(
|
| 198 | "enchantable", b -> b.persistent(Enchantable.CODEC).networkSynchronized(Enchantable.STREAM_CODEC).cacheEncoding()
|
| 199 | );
|
| 200 | public static final DataComponentType<Equippable> EQUIPPABLE = register(
|
| 201 | "equippable", b -> b.persistent(Equippable.CODEC).networkSynchronized(Equippable.STREAM_CODEC).cacheEncoding()
|
| 202 | );
|
| 203 | public static final DataComponentType<Repairable> REPAIRABLE = register(
|
| 204 | "repairable", b -> b.persistent(Repairable.CODEC).networkSynchronized(Repairable.STREAM_CODEC).cacheEncoding()
|
| 205 | );
|
| 206 | public static final DataComponentType<Unit> GLIDER = register("glider", b -> b.persistent(Unit.CODEC).networkSynchronized(Unit.STREAM_CODEC));
|
| 207 | public static final DataComponentType<Identifier> TOOLTIP_STYLE = register(
|
| 208 | "tooltip_style", b -> b.persistent(Identifier.CODEC).networkSynchronized(Identifier.STREAM_CODEC).cacheEncoding()
|
| 209 | );
|
| 210 | public static final DataComponentType<DeathProtection> DEATH_PROTECTION = register(
|
| 211 | "death_protection", b -> b.persistent(DeathProtection.CODEC).networkSynchronized(DeathProtection.STREAM_CODEC).cacheEncoding()
|
| 212 | );
|
| 213 | public static final DataComponentType<BlocksAttacks> BLOCKS_ATTACKS = register(
|
| 214 | "blocks_attacks", b -> b.persistent(BlocksAttacks.CODEC).networkSynchronized(BlocksAttacks.STREAM_CODEC).cacheEncoding()
|
| 215 | );
|
| 216 | public static final DataComponentType<PiercingWeapon> PIERCING_WEAPON = register(
|
| 217 | "piercing_weapon", b -> b.persistent(PiercingWeapon.CODEC).networkSynchronized(PiercingWeapon.STREAM_CODEC).cacheEncoding()
|
| 218 | );
|
| 219 | public static final DataComponentType<KineticWeapon> KINETIC_WEAPON = register(
|
| 220 | "kinetic_weapon", b -> b.persistent(KineticWeapon.CODEC).networkSynchronized(KineticWeapon.STREAM_CODEC).cacheEncoding()
|
| 221 | );
|
| 222 | public static final DataComponentType<SwingAnimation> ATTACK_ANIMATION = register(
|
| 223 | "attack_animation", b -> b.persistent(SwingAnimation.CODEC).networkSynchronized(SwingAnimation.STREAM_CODEC)
|
| 224 | );
|
| 225 | public static final DataComponentType<SwingAnimation> INTERACT_ANIMATION = register(
|
| 226 | "interact_animation", b -> b.persistent(SwingAnimation.CODEC).networkSynchronized(SwingAnimation.STREAM_CODEC)
|
| 227 | );
|
| 228 | public static final DataComponentType<Integer> ADDITIONAL_TRADE_COST = register("additional_trade_cost", b -> b.networkSynchronized(ByteBufCodecs.VAR_INT));
|
| 229 | public static final DataComponentType<Holder<BlockTransformer>> BLOCK_TRANSFORMER = register(
|
| 230 | "block_transformer", b -> b.persistent(BlockTransformer.CODEC).networkSynchronized(BlockTransformer.STREAM_CODEC).cacheEncoding()
|
| 231 | );
|
| 232 | public static final DataComponentType<VillagerFood> VILLAGER_FOOD = register(
|
| 233 | "villager_food", b -> b.persistent(VillagerFood.CODEC).networkSynchronized(VillagerFood.STREAM_CODEC)
|
| 234 | );
|
| 235 | public static final DataComponentType<ItemEnchantments> STORED_ENCHANTMENTS = register(
|
| 236 | "stored_enchantments", b -> b.persistent(ItemEnchantments.CODEC).networkSynchronized(ItemEnchantments.STREAM_CODEC).cacheEncoding()
|
| 237 | );
|
| 238 | public static final DataComponentType<DyeColor> DYE = register("dye", b -> b.persistent(DyeColor.CODEC).networkSynchronized(DyeColor.STREAM_CODEC));
|
| 239 | public static final DataComponentType<DyedItemColor> DYED_COLOR = register(
|
| 240 | "dyed_color", b -> b.persistent(DyedItemColor.CODEC).networkSynchronized(DyedItemColor.STREAM_CODEC)
|
| 241 | );
|
| 242 | public static final DataComponentType<MapId> MAP_ID = register("map_id", b -> b.persistent(MapId.CODEC).networkSynchronized(MapId.STREAM_CODEC));
|
| 243 | public static final DataComponentType<MapDecorations> MAP_DECORATIONS = register("map_decorations", b -> b.persistent(MapDecorations.CODEC).cacheEncoding());
|
| 244 | public static final DataComponentType<MapPostProcessing> MAP_POST_PROCESSING = register(
|
| 245 | "map_post_processing", b -> b.networkSynchronized(MapPostProcessing.STREAM_CODEC)
|
| 246 | );
|
| 247 | public static final DataComponentType<ChargedProjectiles> CHARGED_PROJECTILES = register(
|
| 248 | "charged_projectiles", b -> b.persistent(ChargedProjectiles.CODEC).networkSynchronized(ChargedProjectiles.STREAM_CODEC).cacheEncoding()
|
| 249 | );
|
| 250 | public static final DataComponentType<BundleContents> BUNDLE_CONTENTS = register(
|
| 251 | "bundle_contents", b -> b.persistent(BundleContents.CODEC).networkSynchronized(BundleContents.STREAM_CODEC).cacheEncoding()
|
| 252 | );
|
| 253 | public static final DataComponentType<PotionContents> POTION_CONTENTS = register(
|
| 254 | "potion_contents", b -> b.persistent(PotionContents.CODEC).networkSynchronized(PotionContents.STREAM_CODEC).cacheEncoding()
|
| 255 | );
|
| 256 | public static final DataComponentType<Float> POTION_DURATION_SCALE = register(
|
| 257 | "potion_duration_scale", b -> b.persistent(ExtraCodecs.NON_NEGATIVE_FLOAT).networkSynchronized(ByteBufCodecs.FLOAT).cacheEncoding()
|
| 258 | );
|
| 259 | public static final DataComponentType<SuspiciousStewEffects> SUSPICIOUS_STEW_EFFECTS = register(
|
| 260 | "suspicious_stew_effects", b -> b.persistent(SuspiciousStewEffects.CODEC).networkSynchronized(SuspiciousStewEffects.STREAM_CODEC).cacheEncoding()
|
| 261 | );
|
| 262 | public static final DataComponentType<WritableBookContent> WRITABLE_BOOK_CONTENT = register(
|
| 263 | "writable_book_content", b -> b.persistent(WritableBookContent.CODEC).networkSynchronized(WritableBookContent.STREAM_CODEC).cacheEncoding()
|
| 264 | );
|
| 265 | public static final DataComponentType<WrittenBookContent> WRITTEN_BOOK_CONTENT = register(
|
| 266 | "written_book_content", b -> b.persistent(WrittenBookContent.CODEC).networkSynchronized(WrittenBookContent.STREAM_CODEC).cacheEncoding()
|
| 267 | );
|
| 268 | public static final DataComponentType<ArmorTrim> TRIM = register(
|
| 269 | "trim", b -> b.persistent(ArmorTrim.CODEC).networkSynchronized(ArmorTrim.STREAM_CODEC).cacheEncoding()
|
| 270 | );
|
| 271 | public static final DataComponentType<DebugStickState> DEBUG_STICK_STATE = register(
|
| 272 | "debug_stick_state", b -> b.persistent(DebugStickState.CODEC).cacheEncoding()
|
| 273 | );
|
| 274 | public static final DataComponentType<TypedEntityData<EntityType<?>>> ENTITY_DATA = register(
|
| 275 | "entity_data", b -> b.persistent(TypedEntityData.codec(EntityType.CODEC)).networkSynchronized(TypedEntityData.streamCodec(EntityType.STREAM_CODEC))
|
| 276 | );
|
| 277 | public static final DataComponentType<CustomData> BUCKET_ENTITY_DATA = register(
|
| 278 | "bucket_entity_data", b -> b.persistent(CustomData.CODEC).networkSynchronized(CustomData.STREAM_CODEC)
|
| 279 | );
|
| 280 | public static final DataComponentType<TypedEntityData<BlockEntityType<?>>> BLOCK_ENTITY_DATA = register(
|
| 281 | "block_entity_data",
|
| 282 | b -> b.persistent(TypedEntityData.codec(BuiltInRegistries.BLOCK_ENTITY_TYPE.byNameCodec()))
|
| 283 | .networkSynchronized(TypedEntityData.streamCodec(ByteBufCodecs.registry(Registries.BLOCK_ENTITY_TYPE)))
|
| 284 | );
|
| 285 | public static final DataComponentType<InstrumentComponent> INSTRUMENT = register(
|
| 286 | "instrument", b -> b.persistent(InstrumentComponent.CODEC).networkSynchronized(InstrumentComponent.STREAM_CODEC).cacheEncoding()
|
| 287 | );
|
| 288 | public static final DataComponentType<Holder<TrimMaterial>> PROVIDES_TRIM_MATERIAL = register(
|
| 289 | "provides_trim_material", b -> b.persistent(TrimMaterial.CODEC).networkSynchronized(TrimMaterial.STREAM_CODEC).cacheEncoding()
|
| 290 | );
|
| 291 | public static final DataComponentType<OminousBottleAmplifier> OMINOUS_BOTTLE_AMPLIFIER = register(
|
| 292 | "ominous_bottle_amplifier", b -> b.persistent(OminousBottleAmplifier.CODEC).networkSynchronized(OminousBottleAmplifier.STREAM_CODEC)
|
| 293 | );
|
| 294 | public static final DataComponentType<JukeboxPlayable> JUKEBOX_PLAYABLE = register(
|
| 295 | "jukebox_playable", b -> b.persistent(JukeboxPlayable.CODEC).networkSynchronized(JukeboxPlayable.STREAM_CODEC)
|
| 296 | );
|
| 297 | public static final DataComponentType<HolderSet<BannerPattern>> PROVIDES_BANNER_PATTERNS = register(
|
| 298 | "provides_banner_patterns",
|
| 299 | b -> b.persistent(RegistryCodecs.holderSet(Registries.BANNER_PATTERN))
|
| 300 | .networkSynchronized(ByteBufCodecs.holderSet(Registries.BANNER_PATTERN))
|
| 301 | .cacheEncoding()
|
| 302 | );
|
| 303 | public static final DataComponentType<List<ResourceKey<Recipe<?>>>> RECIPES = register("recipes", b -> b.persistent(Recipe.KEY_CODEC.listOf()).cacheEncoding());
|
| 304 | public static final DataComponentType<LodestoneTracker> LODESTONE_TRACKER = register(
|
| 305 | "lodestone_tracker", b -> b.persistent(LodestoneTracker.CODEC).networkSynchronized(LodestoneTracker.STREAM_CODEC).cacheEncoding()
|
| 306 | );
|
| 307 | public static final DataComponentType<FireworkExplosion> FIREWORK_EXPLOSION = register(
|
| 308 | "firework_explosion", b -> b.persistent(FireworkExplosion.CODEC).networkSynchronized(FireworkExplosion.STREAM_CODEC).cacheEncoding()
|
| 309 | );
|
| 310 | public static final DataComponentType<Fireworks> FIREWORKS = register(
|
| 311 | "fireworks", b -> b.persistent(Fireworks.CODEC).networkSynchronized(Fireworks.STREAM_CODEC).cacheEncoding()
|
| 312 | );
|
| 313 | public static final DataComponentType<ResolvableProfile> PROFILE = register(
|
| 314 | "profile", b -> b.persistent(ResolvableProfile.CODEC).networkSynchronized(ResolvableProfile.STREAM_CODEC).cacheEncoding()
|
| 315 | );
|
| 316 | public static final DataComponentType<Identifier> NOTE_BLOCK_SOUND = register(
|
| 317 | "note_block_sound", b -> b.persistent(Identifier.CODEC).networkSynchronized(Identifier.STREAM_CODEC)
|
| 318 | );
|
| 319 | public static final DataComponentType<BannerPatternLayers> BANNER_PATTERNS = register(
|
| 320 | "banner_patterns", b -> b.persistent(BannerPatternLayers.CODEC).networkSynchronized(BannerPatternLayers.STREAM_CODEC).cacheEncoding()
|
| 321 | );
|
| 322 | public static final DataComponentType<DyeColor> BASE_COLOR = register(
|
| 323 | "base_color", b -> b.persistent(DyeColor.CODEC).networkSynchronized(DyeColor.STREAM_CODEC)
|
| 324 | );
|
| 325 | public static final DataComponentType<PotDecorations> POT_DECORATIONS = register(
|
| 326 | "pot_decorations", b -> b.persistent(PotDecorations.CODEC).networkSynchronized(PotDecorations.STREAM_CODEC).cacheEncoding()
|
| 327 | );
|
| 328 | public static final DataComponentType<ItemContainerContents> CONTAINER = register(
|
| 329 | "container", b -> b.persistent(ItemContainerContents.CODEC).networkSynchronized(ItemContainerContents.STREAM_CODEC).cacheEncoding()
|
| 330 | );
|
| 331 | public static final DataComponentType<BlockItemStateProperties> BLOCK_STATE = register(
|
| 332 | "block_state", b -> b.persistent(BlockItemStateProperties.CODEC).networkSynchronized(BlockItemStateProperties.STREAM_CODEC).cacheEncoding()
|
| 333 | );
|
| 334 | public static final DataComponentType<Bees> BEES = register("bees", b -> b.persistent(Bees.CODEC).networkSynchronized(Bees.STREAM_CODEC).cacheEncoding());
|
| 335 | public static final DataComponentType<SulfurCubeContent> SULFUR_CUBE_CONTENT = register(
|
| 336 | "sulfur_cube_content", b -> b.persistent(SulfurCubeContent.CODEC).networkSynchronized(SulfurCubeContent.STREAM_CODEC).cacheEncoding()
|
| 337 | );
|
| 338 | public static final DataComponentType<LockCode> LOCK = register("lock", b -> b.persistent(LockCode.CODEC));
|
| 339 | public static final DataComponentType<SeededContainerLoot> CONTAINER_LOOT = register("container_loot", b -> b.persistent(SeededContainerLoot.CODEC));
|
| 340 | public static final DataComponentType<Holder<SoundEvent>> BREAK_SOUND = register(
|
| 341 | "break_sound", b -> b.persistent(SoundEvent.CODEC).networkSynchronized(SoundEvent.STREAM_CODEC).cacheEncoding()
|
| 342 | );
|
| 343 | public static final DataComponentType<Compostable> COMPOSTABLE = register(
|
| 344 | "compostable", b -> b.persistent(Compostable.CODEC).networkSynchronized(Compostable.STREAM_CODEC)
|
| 345 | );
|
| 346 | public static final DataComponentType<CookingFuel> COOKING_FUEL = register(
|
| 347 | "cooking_fuel", b -> b.persistent(CookingFuel.CODEC).networkSynchronized(CookingFuel.STREAM_CODEC)
|
| 348 | );
|
| 349 | public static final DataComponentType<BrewingFuel> BREWING_FUEL = register(
|
| 350 | "brewing_fuel", b -> b.persistent(BrewingFuel.CODEC).networkSynchronized(BrewingFuel.STREAM_CODEC)
|
| 351 | );
|
| 352 | public static final DataComponentType<MobVisibility> MOB_VISIBILITY = register(
|
| 353 | "mob_visibility", b -> b.persistent(MobVisibility.CODEC).networkSynchronized(MobVisibility.STREAM_CODEC)
|
| 354 | );
|
| 355 | public static final DataComponentType<Holder<VillagerType>> VILLAGER_VARIANT = register(
|
| 356 | "villager/variant", b -> b.persistent(VillagerType.CODEC).networkSynchronized(VillagerType.STREAM_CODEC)
|
| 357 | );
|
| 358 | public static final DataComponentType<Holder<WolfVariant>> WOLF_VARIANT = register(
|
| 359 | "wolf/variant", b -> b.persistent(WolfVariant.CODEC).networkSynchronized(WolfVariant.STREAM_CODEC)
|
| 360 | );
|
| 361 | public static final DataComponentType<Holder<WolfSoundVariant>> WOLF_SOUND_VARIANT = register(
|
| 362 | "wolf/sound_variant", b -> b.persistent(WolfSoundVariant.CODEC).networkSynchronized(WolfSoundVariant.STREAM_CODEC)
|
| 363 | );
|
| 364 | public static final DataComponentType<DyeColor> WOLF_COLLAR = register(
|
| 365 | "wolf/collar", b -> b.persistent(DyeColor.CODEC).networkSynchronized(DyeColor.STREAM_CODEC)
|
| 366 | );
|
| 367 | public static final DataComponentType<Fox.Variant> FOX_VARIANT = register(
|
| 368 | "fox/variant", b -> b.persistent(Fox.Variant.CODEC).networkSynchronized(Fox.Variant.STREAM_CODEC)
|
| 369 | );
|
| 370 | public static final DataComponentType<Salmon.Variant> SALMON_SIZE = register(
|
| 371 | "salmon/size", b -> b.persistent(Salmon.Variant.CODEC).networkSynchronized(Salmon.Variant.STREAM_CODEC)
|
| 372 | );
|
| 373 | public static final DataComponentType<Parrot.Variant> PARROT_VARIANT = register(
|
| 374 | "parrot/variant", b -> b.persistent(Parrot.Variant.CODEC).networkSynchronized(Parrot.Variant.STREAM_CODEC)
|
| 375 | );
|
| 376 | public static final DataComponentType<TropicalFish.Pattern> TROPICAL_FISH_PATTERN = register(
|
| 377 | "tropical_fish/pattern", b -> b.persistent(TropicalFish.Pattern.CODEC).networkSynchronized(TropicalFish.Pattern.STREAM_CODEC)
|
| 378 | );
|
| 379 | public static final DataComponentType<DyeColor> TROPICAL_FISH_BASE_COLOR = register(
|
| 380 | "tropical_fish/base_color", b -> b.persistent(DyeColor.CODEC).networkSynchronized(DyeColor.STREAM_CODEC)
|
| 381 | );
|
| 382 | public static final DataComponentType<DyeColor> TROPICAL_FISH_PATTERN_COLOR = register(
|
| 383 | "tropical_fish/pattern_color", b -> b.persistent(DyeColor.CODEC).networkSynchronized(DyeColor.STREAM_CODEC)
|
| 384 | );
|
| 385 | public static final DataComponentType<MushroomCow.Variant> MOOSHROOM_VARIANT = register(
|
| 386 | "mooshroom/variant", b -> b.persistent(MushroomCow.Variant.CODEC).networkSynchronized(MushroomCow.Variant.STREAM_CODEC)
|
| 387 | );
|
| 388 | public static final DataComponentType<Rabbit.Variant> RABBIT_VARIANT = register(
|
| 389 | "rabbit/variant", b -> b.persistent(Rabbit.Variant.CODEC).networkSynchronized(Rabbit.Variant.STREAM_CODEC)
|
| 390 | );
|
| 391 | public static final DataComponentType<Holder<PigVariant>> PIG_VARIANT = register(
|
| 392 | "pig/variant", b -> b.persistent(PigVariant.CODEC).networkSynchronized(PigVariant.STREAM_CODEC)
|
| 393 | );
|
| 394 | public static final DataComponentType<Holder<PigSoundVariant>> PIG_SOUND_VARIANT = register(
|
| 395 | "pig/sound_variant", b -> b.persistent(PigSoundVariant.CODEC).networkSynchronized(PigSoundVariant.STREAM_CODEC)
|
| 396 | );
|
| 397 | public static final DataComponentType<Holder<CowVariant>> COW_VARIANT = register(
|
| 398 | "cow/variant", b -> b.persistent(CowVariant.CODEC).networkSynchronized(CowVariant.STREAM_CODEC)
|
| 399 | );
|
| 400 | public static final DataComponentType<Holder<CowSoundVariant>> COW_SOUND_VARIANT = register(
|
| 401 | "cow/sound_variant", b -> b.persistent(CowSoundVariant.CODEC).networkSynchronized(CowSoundVariant.STREAM_CODEC)
|
| 402 | );
|
| 403 | public static final DataComponentType<Holder<ChickenVariant>> CHICKEN_VARIANT = register(
|
| 404 | "chicken/variant", b -> b.persistent(ChickenVariant.CODEC).networkSynchronized(ChickenVariant.STREAM_CODEC)
|
| 405 | );
|
| 406 | public static final DataComponentType<Holder<ChickenSoundVariant>> CHICKEN_SOUND_VARIANT = register(
|
| 407 | "chicken/sound_variant", b -> b.persistent(ChickenSoundVariant.CODEC).networkSynchronized(ChickenSoundVariant.STREAM_CODEC)
|
| 408 | );
|
| 409 | public static final DataComponentType<Holder<ZombieNautilusVariant>> ZOMBIE_NAUTILUS_VARIANT = register(
|
| 410 | "zombie_nautilus/variant", b -> b.persistent(ZombieNautilusVariant.CODEC).networkSynchronized(ZombieNautilusVariant.STREAM_CODEC)
|
| 411 | );
|
| 412 | public static final DataComponentType<Holder<FrogVariant>> FROG_VARIANT = register(
|
| 413 | "frog/variant", b -> b.persistent(FrogVariant.CODEC).networkSynchronized(FrogVariant.STREAM_CODEC)
|
| 414 | );
|
| 415 | public static final DataComponentType<Variant> HORSE_VARIANT = register(
|
| 416 | "horse/variant", b -> b.persistent(Variant.CODEC).networkSynchronized(Variant.STREAM_CODEC)
|
| 417 | );
|
| 418 | public static final DataComponentType<Holder<PaintingVariant>> PAINTING_VARIANT = register(
|
| 419 | "painting/variant", b -> b.persistent(PaintingVariant.CODEC).networkSynchronized(PaintingVariant.STREAM_CODEC)
|
| 420 | );
|
| 421 | public static final DataComponentType<Llama.Variant> LLAMA_VARIANT = register(
|
| 422 | "llama/variant", b -> b.persistent(Llama.Variant.CODEC).networkSynchronized(Llama.Variant.STREAM_CODEC)
|
| 423 | );
|
| 424 | public static final DataComponentType<Axolotl.Variant> AXOLOTL_VARIANT = register(
|
| 425 | "axolotl/variant", b -> b.persistent(Axolotl.Variant.CODEC).networkSynchronized(Axolotl.Variant.STREAM_CODEC)
|
| 426 | );
|
| 427 | public static final DataComponentType<Holder<CatVariant>> CAT_VARIANT = register(
|
| 428 | "cat/variant", b -> b.persistent(CatVariant.CODEC).networkSynchronized(CatVariant.STREAM_CODEC)
|
| 429 | );
|
| 430 | public static final DataComponentType<Holder<CatSoundVariant>> CAT_SOUND_VARIANT = register(
|
| 431 | "cat/sound_variant", b -> b.persistent(CatSoundVariant.CODEC).networkSynchronized(CatSoundVariant.STREAM_CODEC)
|
| 432 | );
|
| 433 | public static final DataComponentType<DyeColor> CAT_COLLAR = register(
|
| 434 | "cat/collar", b -> b.persistent(DyeColor.CODEC).networkSynchronized(DyeColor.STREAM_CODEC)
|
| 435 | );
|
| 436 | public static final DataComponentType<DyeColor> SHEEP_COLOR = register(
|
| 437 | "sheep/color", b -> b.persistent(DyeColor.CODEC).networkSynchronized(DyeColor.STREAM_CODEC)
|
| 438 | );
|
| 439 | public static final DataComponentType<DyeColor> SHULKER_COLOR = register(
|
| 440 | "shulker/color", b -> b.persistent(DyeColor.CODEC).networkSynchronized(DyeColor.STREAM_CODEC)
|
| 441 | );
|
| 442 | public static final DataComponentType<Holder<DecoratedPotPattern>> PROVIDES_POTTERY_PATTERN = register(
|
| 443 | "provides_pottery_pattern", b -> b.persistent(DecoratedPotPatterns.CODEC).networkSynchronized(DecoratedPotPatterns.STREAM_CODEC)
|
| 444 | );
|
| 445 | public static final DataComponentType<SignText> SIGN_TEXT_FRONT = register(
|
| 446 | "sign_text_front", b -> b.persistent(SignText.CODEC).networkSynchronized(SignText.STREAM_CODEC).cacheEncoding()
|
| 447 | );
|
| 448 | public static final DataComponentType<SignText> SIGN_TEXT_BACK = register(
|
| 449 | "sign_text_back", b -> b.persistent(SignText.CODEC).networkSynchronized(SignText.STREAM_CODEC).cacheEncoding()
|
| 450 | );
|
| 451 | public static final DataComponentType<Unit> WAXED = register("waxed", b -> b.persistent(Unit.CODEC).networkSynchronized(Unit.STREAM_CODEC));
|
| 452 | public static final DataComponentType<DyeColor> CUSHION_COLOR = register(
|
| 453 | "cushion/color", b -> b.persistent(DyeColor.CODEC).networkSynchronized(DyeColor.STREAM_CODEC)
|
| 454 | );
|
| 455 | public static final DataComponentMap COMMON_ITEM_COMPONENTS = DataComponentMap.builder()
|
| 456 | .set(MAX_STACK_SIZE, 64)
|
| 457 | .set(LORE, ItemLore.EMPTY)
|
| 458 | .set(ENCHANTMENTS, ItemEnchantments.EMPTY)
|
| 459 | .set(REPAIR_COST, 0)
|
| 460 | .set(USE_EFFECTS, UseEffects.DEFAULT)
|
| 461 | .set(ATTRIBUTE_MODIFIERS, ItemAttributeModifiers.EMPTY)
|
| 462 | .set(RARITY, Rarity.COMMON)
|
| 463 | .set(BREAK_SOUND, SoundEvents.ITEM_BREAK)
|
| 464 | .set(TOOLTIP_DISPLAY, TooltipDisplay.DEFAULT)
|
| 465 | .set(ATTACK_ANIMATION, SwingAnimation.DEFAULT)
|
| 466 | .set(INTERACT_ANIMATION, SwingAnimation.DEFAULT)
|
| 467 | .build();
|
| 468 |
|
| 469 | public static DataComponentType<?> bootstrap(final Registry<DataComponentType<?>> registry) {
|
| 470 | return CUSTOM_DATA;
|
| 471 | }
|
| 472 |
|
| 473 | private static <T> DataComponentType<T> register(final String id, final UnaryOperator<DataComponentType.Builder<T>> builder) {
|
| 474 | return Registry.register(BuiltInRegistries.DATA_COMPONENT_TYPE, id, builder.apply(DataComponentType.builder()).build());
|
| 475 | }
|
| 476 | }
|
| 477 |
|