// Path: src/main/java/com/legobmw99/allomancy/modules/powers/client/PowersClientSetup.java
// public class PowersClientSetup {
//     public static final DeferredRegister<ParticleType<?>> PARTICLES = DeferredRegister.create(ForgeRegistries.PARTICLE_TYPES, Allomancy.MODID);
//     public static final RegistryObject<ParticleType<SoundParticleData>> SOUND_PARTICLE_TYPE = PARTICLES.register("sound_particle",
//                                                                                                                  () -> new ParticleType<>(true, SoundParticleData.DESERIALIZER) {
//                                                                                                                      @Override
//                                                                                                                      public Codec<SoundParticleData> codec() {
//                                                                                                                          return null;
//                                                                                                                      }
//                                                                                                                  });
//     @OnlyIn(Dist.CLIENT)
//     public static KeyMapping hud;
// 
//     @OnlyIn(Dist.CLIENT)
//     public static KeyMapping burn;
// 
//     public static boolean enable_more_keybinds;
// 
//     @OnlyIn(Dist.CLIENT)
//     public static KeyMapping[] powers;
// 
//     public static void initKeyBindings() {
//         burn = new KeyMapping("key.burn", GLFW.GLFW_KEY_V, "key.categories.allomancy");
//         hud = new KeyMapping("key.hud", GLFW.GLFW_KEY_UNKNOWN, "key.categories.allomancy");
//         ClientRegistry.registerKeyBinding(burn);
//         ClientRegistry.registerKeyBinding(hud);
// 
//         enable_more_keybinds = PowersConfig.enable_more_keybinds.get();
// 
//         if (enable_more_keybinds) {
//             powers = new KeyMapping[Metal.values().length];
//             for (int i = 0; i < powers.length; i++) {
//                 powers[i] = new KeyMapping("metals." + Metal.getMetal(i).name().toLowerCase(), GLFW.GLFW_KEY_UNKNOWN, "key.categories.allomancy");
//                 ClientRegistry.registerKeyBinding(powers[i]);
//             }
//         }
// 
//     }
// 
//     public static void register() {
//         PARTICLES.register(FMLJavaModLoadingContext.get().getModEventBus());
//     }
// 
//     @SubscribeEvent(priority = EventPriority.LOWEST)
//     public static void registerParticle(ParticleFactoryRegisterEvent event) {
//         Allomancy.LOGGER.info("Allomancy: Registering custom particles");
//         Minecraft.getInstance().particleEngine.register(PowersClientSetup.SOUND_PARTICLE_TYPE.get(), SoundParticle.Factory::new);
//     }
// 
// }


import com.legobmw99.allomancy.modules.powers.client.PowersClientSetup;
import com.mojang.brigadier.StringReader;
import net.minecraft.core.Registry;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.sounds.SoundSource;
package com.legobmw99.allomancy.modules.powers.client.particle;


public class SoundParticleData implements ParticleOptions {


    public static final ParticleOptions.Deserializer<SoundParticleData> DESERIALIZER = new ParticleOptions.Deserializer<>() {

        @Override
        public SoundParticleData fromCommand(ParticleType<SoundParticleData> particleTypeIn, StringReader reader) {
            return new SoundParticleData(SoundSource.AMBIENT);
        }

        @Override
        public SoundParticleData fromNetwork(ParticleType<SoundParticleData> particleTypeIn, FriendlyByteBuf buffer) {
            return new SoundParticleData(buffer.readEnum(SoundSource.class));
        }
    };
    private final SoundSource type;

    public SoundParticleData(SoundSource type) {
        this.type = type;
    }

    protected SoundSource getSoundType() {
        return this.type;
    }

    @Override
    public ParticleType<?> getType() {
// Path: src/main/java/com/legobmw99/allomancy/modules/powers/client/PowersClientSetup.java
// public class PowersClientSetup {
//     public static final DeferredRegister<ParticleType<?>> PARTICLES = DeferredRegister.create(ForgeRegistries.PARTICLE_TYPES, Allomancy.MODID);
//     public static final RegistryObject<ParticleType<SoundParticleData>> SOUND_PARTICLE_TYPE = PARTICLES.register("sound_particle",
//                                                                                                                  () -> new ParticleType<>(true, SoundParticleData.DESERIALIZER) {
//                                                                                                                      @Override
//                                                                                                                      public Codec<SoundParticleData> codec() {
//                                                                                                                          return null;
//                                                                                                                      }
//                                                                                                                  });
//     @OnlyIn(Dist.CLIENT)
//     public static KeyMapping hud;
// 
//     @OnlyIn(Dist.CLIENT)
//     public static KeyMapping burn;
// 
//     public static boolean enable_more_keybinds;
// 
//     @OnlyIn(Dist.CLIENT)
//     public static KeyMapping[] powers;
// 
//     public static void initKeyBindings() {
//         burn = new KeyMapping("key.burn", GLFW.GLFW_KEY_V, "key.categories.allomancy");
//         hud = new KeyMapping("key.hud", GLFW.GLFW_KEY_UNKNOWN, "key.categories.allomancy");
//         ClientRegistry.registerKeyBinding(burn);
//         ClientRegistry.registerKeyBinding(hud);
// 
//         enable_more_keybinds = PowersConfig.enable_more_keybinds.get();
// 
//         if (enable_more_keybinds) {
//             powers = new KeyMapping[Metal.values().length];
//             for (int i = 0; i < powers.length; i++) {
//                 powers[i] = new KeyMapping("metals." + Metal.getMetal(i).name().toLowerCase(), GLFW.GLFW_KEY_UNKNOWN, "key.categories.allomancy");
//                 ClientRegistry.registerKeyBinding(powers[i]);
//             }
//         }
// 
//     }
// 
//     public static void register() {
//         PARTICLES.register(FMLJavaModLoadingContext.get().getModEventBus());
//     }
// 
//     @SubscribeEvent(priority = EventPriority.LOWEST)
//     public static void registerParticle(ParticleFactoryRegisterEvent event) {
//         Allomancy.LOGGER.info("Allomancy: Registering custom particles");
//         Minecraft.getInstance().particleEngine.register(PowersClientSetup.SOUND_PARTICLE_TYPE.get(), SoundParticle.Factory::new);
//     }
// 
// }


// Path: src/main/java/com/legobmw99/allomancy/modules/powers/client/particle/SoundParticleData.java
import com.legobmw99.allomancy.modules.powers.client.PowersClientSetup;
import com.mojang.brigadier.StringReader;
import net.minecraft.core.Registry;
import net.minecraft.core.particles.ParticleOptions;
import net.minecraft.core.particles.ParticleType;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.sounds.SoundSource;

package com.legobmw99.allomancy.modules.powers.client.particle;


public class SoundParticleData implements ParticleOptions {


    public static final ParticleOptions.Deserializer<SoundParticleData> DESERIALIZER = new ParticleOptions.Deserializer<>() {

        @Override
        public SoundParticleData fromCommand(ParticleType<SoundParticleData> particleTypeIn, StringReader reader) {
            return new SoundParticleData(SoundSource.AMBIENT);
        }

        @Override
        public SoundParticleData fromNetwork(ParticleType<SoundParticleData> particleTypeIn, FriendlyByteBuf buffer) {
            return new SoundParticleData(buffer.readEnum(SoundSource.class));
        }
    };
    private final SoundSource type;

    public SoundParticleData(SoundSource type) {
        this.type = type;
    }

    protected SoundSource getSoundType() {
        return this.type;
    }

    @Override
    public ParticleType<?> getType() {
        return PowersClientSetup.SOUND_PARTICLE_TYPE.get();