// Path: src/main/java/com/legobmw99/stormlight/modules/powers/PowersSetup.java
// public class PowersSetup {
// 
//     public static final DeferredRegister<MobEffect> EFFECTS = DeferredRegister.create(ForgeRegistries.MOB_EFFECTS, Stormlight.MODID);
// 
//     public static final RegistryObject<MobEffect> STORMLIGHT = EFFECTS.register("stormlight", () -> new GenericEffect(MobEffectCategory.BENEFICIAL, 0));
//     public static final RegistryObject<MobEffect> SLICKING = EFFECTS.register("slicking", () -> new StormlightEffect(16737535));
//     public static final RegistryObject<MobEffect> STICKING = EFFECTS.register("sticking", () -> new StormlightEffect(6579455));
//     public static final RegistryObject<MobEffect> COHESION = EFFECTS.register("cohesion", () -> new StormlightEffect(16777010));
//     public static final RegistryObject<MobEffect> TENSION = EFFECTS.register("tension", () -> new StormlightEffect(16711780));
//     public static final RegistryObject<MobEffect> GRAVITATION = EFFECTS.register("gravitation",
//                                                                                  () -> new StormlightEffect(6605055).addAttributeModifier(ForgeMod.ENTITY_GRAVITY.get(),
//                                                                                                                                           "a81758d2-c355-11eb-8529-0242ac130003",
//                                                                                                                                           -0.08,
//                                                                                                                                           AttributeModifier.Operation.ADDITION));
// 
// 
//     public static void register() {
//         EFFECTS.register(FMLJavaModLoadingContext.get().getModEventBus());
//     }
// 
// 
//     public static void init(final FMLCommonSetupEvent e) {
//         ArgumentTypes.register("stormlight_ideal", StormlightArgType.IdealType.class, new EmptyArgumentSerializer<>(() -> StormlightArgType.IdealType.INSTANCE));
//         ArgumentTypes.register("stormlight_order", StormlightArgType.OrderType.class, new EmptyArgumentSerializer<>(() -> StormlightArgType.OrderType.INSTANCE));
// 
//         MinecraftForge.EVENT_BUS.register(PowersEventHandler.class);
//     }
// }


import com.legobmw99.stormlight.modules.powers.PowersSetup;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
        if (player.hasEffect(effect)) {
            player.removeEffect(effect);
            return false;
        } else {
            player.addEffect(new MobEffectInstance(effect, MAX_TIME, level, ambient, false, showicon));
            return true;
        }
    }

    public static int increasePermanentEffect(Player player, MobEffect effect, int max) {
        int level = player.hasEffect(effect) ? player.getEffect(effect).getAmplifier() : -1;
        level = level < max ? level + 1 : max;
        player.addEffect(new MobEffectInstance(effect, MAX_TIME, level, true, false, true));
        return level;
    }

    public static int decreasePermanentEffect(Player player, MobEffect effect) {
        if (!player.hasEffect(effect)) {
            return -1;
        }
        int level = player.getEffect(effect).getAmplifier() - 1;
        player.removeEffect(effect);
        if (level >= 0) {
            player.addEffect(new MobEffectInstance(effect, MAX_TIME, level, true, false, true));
        }

        return level;
    }

    public static boolean drainStormlight(LivingEntity entity, int duration) {
// Path: src/main/java/com/legobmw99/stormlight/modules/powers/PowersSetup.java
// public class PowersSetup {
// 
//     public static final DeferredRegister<MobEffect> EFFECTS = DeferredRegister.create(ForgeRegistries.MOB_EFFECTS, Stormlight.MODID);
// 
//     public static final RegistryObject<MobEffect> STORMLIGHT = EFFECTS.register("stormlight", () -> new GenericEffect(MobEffectCategory.BENEFICIAL, 0));
//     public static final RegistryObject<MobEffect> SLICKING = EFFECTS.register("slicking", () -> new StormlightEffect(16737535));
//     public static final RegistryObject<MobEffect> STICKING = EFFECTS.register("sticking", () -> new StormlightEffect(6579455));
//     public static final RegistryObject<MobEffect> COHESION = EFFECTS.register("cohesion", () -> new StormlightEffect(16777010));
//     public static final RegistryObject<MobEffect> TENSION = EFFECTS.register("tension", () -> new StormlightEffect(16711780));
//     public static final RegistryObject<MobEffect> GRAVITATION = EFFECTS.register("gravitation",
//                                                                                  () -> new StormlightEffect(6605055).addAttributeModifier(ForgeMod.ENTITY_GRAVITY.get(),
//                                                                                                                                           "a81758d2-c355-11eb-8529-0242ac130003",
//                                                                                                                                           -0.08,
//                                                                                                                                           AttributeModifier.Operation.ADDITION));
// 
// 
//     public static void register() {
//         EFFECTS.register(FMLJavaModLoadingContext.get().getModEventBus());
//     }
// 
// 
//     public static void init(final FMLCommonSetupEvent e) {
//         ArgumentTypes.register("stormlight_ideal", StormlightArgType.IdealType.class, new EmptyArgumentSerializer<>(() -> StormlightArgType.IdealType.INSTANCE));
//         ArgumentTypes.register("stormlight_order", StormlightArgType.OrderType.class, new EmptyArgumentSerializer<>(() -> StormlightArgType.OrderType.INSTANCE));
// 
//         MinecraftForge.EVENT_BUS.register(PowersEventHandler.class);
//     }
// }


// Path: src/main/java/com/legobmw99/stormlight/modules/powers/effect/EffectHelper.java
import com.legobmw99.stormlight.modules.powers.PowersSetup;
import net.minecraft.world.effect.MobEffect;
import net.minecraft.world.effect.MobEffectInstance;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;

        if (player.hasEffect(effect)) {
            player.removeEffect(effect);
            return false;
        } else {
            player.addEffect(new MobEffectInstance(effect, MAX_TIME, level, ambient, false, showicon));
            return true;
        }
    }

    public static int increasePermanentEffect(Player player, MobEffect effect, int max) {
        int level = player.hasEffect(effect) ? player.getEffect(effect).getAmplifier() : -1;
        level = level < max ? level + 1 : max;
        player.addEffect(new MobEffectInstance(effect, MAX_TIME, level, true, false, true));
        return level;
    }

    public static int decreasePermanentEffect(Player player, MobEffect effect) {
        if (!player.hasEffect(effect)) {
            return -1;
        }
        int level = player.getEffect(effect).getAmplifier() - 1;
        player.removeEffect(effect);
        if (level >= 0) {
            player.addEffect(new MobEffectInstance(effect, MAX_TIME, level, true, false, true));
        }

        return level;
    }

    public static boolean drainStormlight(LivingEntity entity, int duration) {
        MobEffect stormlight = PowersSetup.STORMLIGHT.get();