// 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.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LiquidBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.InputEvent;
import net.minecraftforge.client.event.RenderLevelLastEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;
package com.legobmw99.stormlight.modules.powers.client;



@OnlyIn(Dist.CLIENT)
public class PowerClientEventHandler {

    private static final Minecraft mc = Minecraft.getInstance();
    private static final Map<BlockPos, BlockState> savedStates = new HashMap<>();

    @SubscribeEvent
    public static void onKeyInput(final InputEvent.KeyInputEvent event) {
        if (event.getKey() == PowersClientSetup.firstSurge.getKey().getValue() || event.getKey() == PowersClientSetup.secondSurge.getKey().getValue() ||
            event.getKey() == PowersClientSetup.blade.getKey().getValue()) {
            ClientPowerUtils.acceptInput(event.getAction());
        }
    }

    @SubscribeEvent
    public static void onMouseInput(final InputEvent.MouseInputEvent event) {
        // todo investigate
        // ClientPowerUtils.acceptInput(event.getAction());

    }

    // Heavily inspired by Origins, but not a mixin
    @SubscribeEvent
    public static void renderLast(final RenderLevelLastEvent event) {

// 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/client/PowerClientEventHandler.java
import com.legobmw99.stormlight.modules.powers.PowersSetup;
import net.minecraft.client.Minecraft;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.LiquidBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.InputEvent;
import net.minecraftforge.client.event.RenderLevelLastEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import java.util.stream.Collectors;

package com.legobmw99.stormlight.modules.powers.client;



@OnlyIn(Dist.CLIENT)
public class PowerClientEventHandler {

    private static final Minecraft mc = Minecraft.getInstance();
    private static final Map<BlockPos, BlockState> savedStates = new HashMap<>();

    @SubscribeEvent
    public static void onKeyInput(final InputEvent.KeyInputEvent event) {
        if (event.getKey() == PowersClientSetup.firstSurge.getKey().getValue() || event.getKey() == PowersClientSetup.secondSurge.getKey().getValue() ||
            event.getKey() == PowersClientSetup.blade.getKey().getValue()) {
            ClientPowerUtils.acceptInput(event.getAction());
        }
    }

    @SubscribeEvent
    public static void onMouseInput(final InputEvent.MouseInputEvent event) {
        // todo investigate
        // ClientPowerUtils.acceptInput(event.getAction());

    }

    // Heavily inspired by Origins, but not a mixin
    @SubscribeEvent
    public static void renderLast(final RenderLevelLastEvent event) {

        if (mc.player != null && mc.player.hasEffect(PowersSetup.COHESION.get())) {