/* * Decompiled with CFR 0.152. * * Could not load the following classes: * com.mojang.serialization.Codec */ package net.minecraft.world.item.enchantment; import com.mojang.serialization.Codec; import java.util.List; import java.util.function.UnaryOperator; import net.minecraft.core.Holder; import net.minecraft.core.Registry; import net.minecraft.core.component.DataComponentMap; import net.minecraft.core.component.DataComponentType; import net.minecraft.core.registries.BuiltInRegistries; import net.minecraft.sounds.SoundEvent; import net.minecraft.util.Unit; import net.minecraft.world.item.CrossbowItem; import net.minecraft.world.item.enchantment.ConditionalEffect; import net.minecraft.world.item.enchantment.TargetedConditionalEffect; import net.minecraft.world.item.enchantment.effects.DamageImmunity; import net.minecraft.world.item.enchantment.effects.EnchantmentAttributeEffect; import net.minecraft.world.item.enchantment.effects.EnchantmentEntityEffect; import net.minecraft.world.item.enchantment.effects.EnchantmentLocationBasedEffect; import net.minecraft.world.item.enchantment.effects.EnchantmentValueEffect; import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; public interface EnchantmentEffectComponents { public static final Codec> COMPONENT_CODEC = Codec.lazyInitialized(() -> BuiltInRegistries.ENCHANTMENT_EFFECT_COMPONENT_TYPE.byNameCodec()); public static final Codec CODEC = DataComponentMap.makeCodec(COMPONENT_CODEC); public static final DataComponentType>> DAMAGE_PROTECTION = EnchantmentEffectComponents.register("damage_protection", b -> b.persistent(ConditionalEffect.codec(EnchantmentValueEffect.CODEC, LootContextParamSets.ENCHANTED_DAMAGE).listOf())); public static final DataComponentType>> DAMAGE_IMMUNITY = EnchantmentEffectComponents.register("damage_immunity", b -> b.persistent(ConditionalEffect.codec(DamageImmunity.CODEC, LootContextParamSets.ENCHANTED_DAMAGE).listOf())); public static final DataComponentType>> DAMAGE = EnchantmentEffectComponents.register("damage", b -> b.persistent(ConditionalEffect.codec(EnchantmentValueEffect.CODEC, LootContextParamSets.ENCHANTED_DAMAGE).listOf())); public static final DataComponentType>> SMASH_DAMAGE_PER_FALLEN_BLOCK = EnchantmentEffectComponents.register("smash_damage_per_fallen_block", b -> b.persistent(ConditionalEffect.codec(EnchantmentValueEffect.CODEC, LootContextParamSets.ENCHANTED_DAMAGE).listOf())); public static final DataComponentType>> KNOCKBACK = EnchantmentEffectComponents.register("knockback", b -> b.persistent(ConditionalEffect.codec(EnchantmentValueEffect.CODEC, LootContextParamSets.ENCHANTED_DAMAGE).listOf())); public static final DataComponentType>> ARMOR_EFFECTIVENESS = EnchantmentEffectComponents.register("armor_effectiveness", b -> b.persistent(ConditionalEffect.codec(EnchantmentValueEffect.CODEC, LootContextParamSets.ENCHANTED_DAMAGE).listOf())); public static final DataComponentType>> POST_ATTACK = EnchantmentEffectComponents.register("post_attack", b -> b.persistent(TargetedConditionalEffect.codec(EnchantmentEntityEffect.CODEC, LootContextParamSets.ENCHANTED_DAMAGE).listOf())); public static final DataComponentType>> POST_PIERCING_ATTACK = EnchantmentEffectComponents.register("post_piercing_attack", b -> b.persistent(ConditionalEffect.codec(EnchantmentEntityEffect.CODEC, LootContextParamSets.ENCHANTED_DAMAGE).listOf())); public static final DataComponentType>> HIT_BLOCK = EnchantmentEffectComponents.register("hit_block", b -> b.persistent(ConditionalEffect.codec(EnchantmentEntityEffect.CODEC, LootContextParamSets.HIT_BLOCK).listOf())); public static final DataComponentType>> ITEM_DAMAGE = EnchantmentEffectComponents.register("item_damage", b -> b.persistent(ConditionalEffect.codec(EnchantmentValueEffect.CODEC, LootContextParamSets.ENCHANTED_ITEM).listOf())); public static final DataComponentType> ATTRIBUTES = EnchantmentEffectComponents.register("attributes", b -> b.persistent(EnchantmentAttributeEffect.CODEC.codec().listOf())); public static final DataComponentType>> EQUIPMENT_DROPS = EnchantmentEffectComponents.register("equipment_drops", b -> b.persistent(TargetedConditionalEffect.equipmentDropsCodec(EnchantmentValueEffect.CODEC, LootContextParamSets.ENCHANTED_DAMAGE).listOf())); public static final DataComponentType>> LOCATION_CHANGED = EnchantmentEffectComponents.register("location_changed", b -> b.persistent(ConditionalEffect.codec(EnchantmentLocationBasedEffect.CODEC, LootContextParamSets.ENCHANTED_LOCATION).listOf())); public static final DataComponentType>> TICK = EnchantmentEffectComponents.register("tick", b -> b.persistent(ConditionalEffect.codec(EnchantmentEntityEffect.CODEC, LootContextParamSets.ENCHANTED_ENTITY).listOf())); public static final DataComponentType>> AMMO_USE = EnchantmentEffectComponents.register("ammo_use", b -> b.persistent(ConditionalEffect.codec(EnchantmentValueEffect.CODEC, LootContextParamSets.ENCHANTED_ITEM).listOf())); public static final DataComponentType>> PROJECTILE_PIERCING = EnchantmentEffectComponents.register("projectile_piercing", b -> b.persistent(ConditionalEffect.codec(EnchantmentValueEffect.CODEC, LootContextParamSets.ENCHANTED_ITEM).listOf())); public static final DataComponentType>> PROJECTILE_SPAWNED = EnchantmentEffectComponents.register("projectile_spawned", b -> b.persistent(ConditionalEffect.codec(EnchantmentEntityEffect.CODEC, LootContextParamSets.ENCHANTED_ENTITY).listOf())); public static final DataComponentType>> PROJECTILE_SPREAD = EnchantmentEffectComponents.register("projectile_spread", b -> b.persistent(ConditionalEffect.codec(EnchantmentValueEffect.CODEC, LootContextParamSets.ENCHANTED_ENTITY).listOf())); public static final DataComponentType>> PROJECTILE_COUNT = EnchantmentEffectComponents.register("projectile_count", b -> b.persistent(ConditionalEffect.codec(EnchantmentValueEffect.CODEC, LootContextParamSets.ENCHANTED_ENTITY).listOf())); public static final DataComponentType>> TRIDENT_RETURN_ACCELERATION = EnchantmentEffectComponents.register("trident_return_acceleration", b -> b.persistent(ConditionalEffect.codec(EnchantmentValueEffect.CODEC, LootContextParamSets.ENCHANTED_ENTITY).listOf())); public static final DataComponentType>> FISHING_TIME_REDUCTION = EnchantmentEffectComponents.register("fishing_time_reduction", b -> b.persistent(ConditionalEffect.codec(EnchantmentValueEffect.CODEC, LootContextParamSets.ENCHANTED_ENTITY).listOf())); public static final DataComponentType>> FISHING_LUCK_BONUS = EnchantmentEffectComponents.register("fishing_luck_bonus", b -> b.persistent(ConditionalEffect.codec(EnchantmentValueEffect.CODEC, LootContextParamSets.ENCHANTED_ENTITY).listOf())); public static final DataComponentType>> BLOCK_EXPERIENCE = EnchantmentEffectComponents.register("block_experience", b -> b.persistent(ConditionalEffect.codec(EnchantmentValueEffect.CODEC, LootContextParamSets.ENCHANTED_ITEM).listOf())); public static final DataComponentType>> MOB_EXPERIENCE = EnchantmentEffectComponents.register("mob_experience", b -> b.persistent(ConditionalEffect.codec(EnchantmentValueEffect.CODEC, LootContextParamSets.ENCHANTED_ENTITY).listOf())); public static final DataComponentType>> REPAIR_WITH_XP = EnchantmentEffectComponents.register("repair_with_xp", b -> b.persistent(ConditionalEffect.codec(EnchantmentValueEffect.CODEC, LootContextParamSets.ENCHANTED_ITEM).listOf())); public static final DataComponentType CROSSBOW_CHARGE_TIME = EnchantmentEffectComponents.register("crossbow_charge_time", b -> b.persistent(EnchantmentValueEffect.CODEC)); public static final DataComponentType> CROSSBOW_CHARGING_SOUNDS = EnchantmentEffectComponents.register("crossbow_charging_sounds", b -> b.persistent(CrossbowItem.ChargingSounds.CODEC.listOf())); public static final DataComponentType>> TRIDENT_SOUND = EnchantmentEffectComponents.register("trident_sound", b -> b.persistent(SoundEvent.CODEC.listOf())); public static final DataComponentType PREVENT_EQUIPMENT_DROP = EnchantmentEffectComponents.register("prevent_equipment_drop", b -> b.persistent(Unit.CODEC)); public static final DataComponentType PREVENT_ARMOR_CHANGE = EnchantmentEffectComponents.register("prevent_armor_change", b -> b.persistent(Unit.CODEC)); public static final DataComponentType TRIDENT_SPIN_ATTACK_STRENGTH = EnchantmentEffectComponents.register("trident_spin_attack_strength", b -> b.persistent(EnchantmentValueEffect.CODEC)); public static DataComponentType bootstrap(Registry> registry) { return DAMAGE_PROTECTION; } private static DataComponentType register(String id, UnaryOperator> builder) { return Registry.register(BuiltInRegistries.ENCHANTMENT_EFFECT_COMPONENT_TYPE, id, ((DataComponentType.Builder)builder.apply(DataComponentType.builder())).build()); } }