| 1 | package net.minecraft.world.item.enchantment.effects;
|
| 2 |
|
| 3 | import com.mojang.serialization.Codec;
|
| 4 | import com.mojang.serialization.MapCodec;
|
| 5 | import java.util.function.Function;
|
| 6 | import net.minecraft.core.Registry;
|
| 7 | import net.minecraft.core.registries.BuiltInRegistries;
|
| 8 | import net.minecraft.server.level.ServerLevel;
|
| 9 | import net.minecraft.world.entity.Entity;
|
| 10 | import net.minecraft.world.item.enchantment.EnchantedItemInUse;
|
| 11 | import net.minecraft.world.phys.Vec3;
|
| 12 |
|
| 13 | public interface EnchantmentLocationBasedEffect {
|
| 14 | Codec<EnchantmentLocationBasedEffect> CODEC = BuiltInRegistries.ENCHANTMENT_LOCATION_BASED_EFFECT_TYPE
|
| 15 | .byNameCodec()
|
| 16 | .dispatch(EnchantmentLocationBasedEffect::codec, Function.identity());
|
| 17 |
|
| 18 | static MapCodec<? extends EnchantmentLocationBasedEffect> bootstrap(final Registry<MapCodec<? extends EnchantmentLocationBasedEffect>> registry) {
|
| 19 | Registry.register(registry, "all_of", AllOf.LocationBasedEffects.CODEC);
|
| 20 | Registry.register(registry, "apply_mob_effect", ApplyMobEffect.CODEC);
|
| 21 | Registry.register(registry, "attribute", EnchantmentAttributeEffect.MAP_CODEC);
|
| 22 | Registry.register(registry, "change_item_damage", ChangeItemDamage.CODEC);
|
| 23 | Registry.register(registry, "damage_entity", DamageEntity.CODEC);
|
| 24 | Registry.register(registry, "explode", ExplodeEffect.CODEC);
|
| 25 | Registry.register(registry, "ignite", Ignite.CODEC);
|
| 26 | Registry.register(registry, "apply_impulse", ApplyEntityImpulse.CODEC);
|
| 27 | Registry.register(registry, "apply_exhaustion", ApplyExhaustion.CODEC);
|
| 28 | Registry.register(registry, "play_sound", PlaySoundEffect.CODEC);
|
| 29 | Registry.register(registry, "replace_block", ReplaceBlock.CODEC);
|
| 30 | Registry.register(registry, "replace_disk", ReplaceDisk.CODEC);
|
| 31 | Registry.register(registry, "run_function", RunFunction.CODEC);
|
| 32 | Registry.register(registry, "set_block_properties", SetBlockProperties.CODEC);
|
| 33 | Registry.register(registry, "spawn_particles", SpawnParticlesEffect.CODEC);
|
| 34 | return Registry.register(registry, "summon_entity", SummonEntityEffect.CODEC);
|
| 35 | }
|
| 36 |
|
| 37 | void onChangedBlock(ServerLevel serverLevel, int enchantmentLevel, EnchantedItemInUse item, Entity entity, Vec3 position, boolean becameActive);
|
| 38 |
|
| 39 | default void onDeactivated(final EnchantedItemInUse item, final Entity entity, final Vec3 position, final int level) {
|
| 40 | }
|
| 41 |
|
| 42 | MapCodec<? extends EnchantmentLocationBasedEffect> codec();
|
| 43 | }
|
| 44 |
|