package gvclib.event;

import gvclib.mod_GVCLib;
import net.minecraft.sounds.SoundEvent;

import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegisterEvent;
import net.minecraftforge.registries.RegistryObject;

/**
 * Registers this mod's {@link SoundEvent}s.
 *
 * @author Choonster
 */
public class GVCSoundEvent {

    public static final DeferredRegister<SoundEvent> SOUND_EVENTS =
            DeferredRegister.create(ForgeRegistries.SOUND_EVENTS, mod_GVCLib.MOD_ID);

    public static RegistryObject<SoundEvent> fire_rifle = registerSound("fire_rifle");
    public static RegistryObject<SoundEvent> fire_rifle2 = registerSound("fire_rifle2");
    public static RegistryObject<SoundEvent> fire_rifle3 = registerSound("fire_rifle3");
    public static RegistryObject<SoundEvent> fire_rifle4 = registerSound("fire_rifle4");
    public static RegistryObject<SoundEvent> fire_rifle5 = registerSound("fire_rifle5");
    public static RegistryObject<SoundEvent> fire_rifle_ak = registerSound("fire_rifle_ak");
    public static RegistryObject<SoundEvent> fire_hg = registerSound("fire_hg");
    public static RegistryObject<SoundEvent> fire_hg2 = registerSound("fire_hg2");
    public static RegistryObject<SoundEvent> fire_mg = registerSound("fire_mg");
    public static RegistryObject<SoundEvent> fire_mg2 = registerSound("fire_mg2");
    public static RegistryObject<SoundEvent> fire_lmg = registerSound("fire_lmg");
    public static RegistryObject<SoundEvent> fire_hmg = registerSound("fire_hmg");
    public static RegistryObject<SoundEvent> fire_arrow = registerSound("fire_arrow");
    public static RegistryObject<SoundEvent> fire_supu = registerSound("fire_supu");
    public static RegistryObject<SoundEvent> fire_cannon = registerSound("fire_cannon");
    public static RegistryObject<SoundEvent> fire_cannon2 = registerSound("fire_cannon2");
    public static RegistryObject<SoundEvent> fire_rail = registerSound("fire_rail");
    public static RegistryObject<SoundEvent> fire_amr = registerSound("fire_amr");
    public static RegistryObject<SoundEvent> fire_missile = registerSound("fire_missile");
    public static RegistryObject<SoundEvent> fire_roket = registerSound("fire_roket");
    public static RegistryObject<SoundEvent> fire_grenade = registerSound("fire_grenade");
    public static RegistryObject<SoundEvent> fire_gl = registerSound("fire_gl");
    public static RegistryObject<SoundEvent> fire_20mm = registerSound("fire_20mm");
    public static RegistryObject<SoundEvent> fire_30mm = registerSound("fire_30mm");
    public static RegistryObject<SoundEvent> fire_havrycannon = registerSound("fire_havrycannon");
    public static RegistryObject<SoundEvent> fire_fire = registerSound("fire_fire");
    public static RegistryObject<SoundEvent> throw_grenade = registerSound("throw_grenade");
    public static RegistryObject<SoundEvent> reload_cannon = registerSound("reload_cannon");
    public static RegistryObject<SoundEvent> reload_rail = registerSound("reload_rail");
    public static RegistryObject<SoundEvent> reload_mg = registerSound("reload_mg");
    public static RegistryObject<SoundEvent> reload_mag = registerSound("reload_mag");
    public static RegistryObject<SoundEvent> reload_clip = registerSound("reload_clip");
    public static RegistryObject<SoundEvent> reload_cocking = registerSound("reload_cocking");
    public static RegistryObject<SoundEvent> reload_shell = registerSound("reload_shell");
    public static RegistryObject<SoundEvent> sound_tank = registerSound("sound_tank");
    public static RegistryObject<SoundEvent> sound_car = registerSound("sound_car");
    public static RegistryObject<SoundEvent> sound_heli = registerSound("sound_heli");
    public static RegistryObject<SoundEvent> sound_pera = registerSound("sound_pera");
    public static RegistryObject<SoundEvent> sound_call = registerSound("sound_call");
    public static RegistryObject<SoundEvent> sound_jet1 = registerSound("sound_jet1");
    public static RegistryObject<SoundEvent> sound_jet2 = registerSound("sound_jet2");
    public static RegistryObject<SoundEvent> sound_lock = registerSound("sound_lock");
    public static RegistryObject<SoundEvent> sound_fall_shell = registerSound("sound_fall_shell");
    public static RegistryObject<SoundEvent> sound_robo_step = registerSound("sound_robo_step");
    public static RegistryObject<SoundEvent> sound_robo_boost = registerSound("sound_robo_boost");
    public static RegistryObject<SoundEvent> sound_hit = registerSound("sound_hit");



    public static void register(IEventBus eventBus) {
        SOUND_EVENTS.register(eventBus);
    }


    public static SoundEvent getSound(String soundbase) {
        SoundEvent sound = fire_hg.get();
        if(soundbase.equals("fire_rifle"))sound = fire_rifle.get();
        if(soundbase.equals("fire_rifle2"))sound = fire_rifle2.get();
        if(soundbase.equals("fire_rifle3"))sound = fire_rifle3.get();
        if(soundbase.equals("fire_rifle4"))sound = fire_rifle4.get();
        if(soundbase.equals("fire_rifle5"))sound = fire_rifle5.get();
        if(soundbase.equals("fire_rifle_ak"))sound = fire_rifle_ak.get();
        if(soundbase.equals("fire_hg"))sound = fire_hg.get();
        if(soundbase.equals("fire_hg2"))sound = fire_hg2.get();
        if(soundbase.equals("fire_mg"))sound = fire_mg.get();
        if(soundbase.equals("fire_mg2"))sound = fire_mg2.get();
        if(soundbase.equals("fire_lmg"))sound = fire_lmg.get();
        if(soundbase.equals("fire_hmg"))sound = fire_hmg.get();
        if(soundbase.equals("fire_arrow"))sound = fire_arrow.get();
        if(soundbase.equals("fire_supu"))sound = fire_supu.get();
        if(soundbase.equals("fire_cannon"))sound = fire_cannon.get();
        if(soundbase.equals("fire_cannon2"))sound = fire_cannon2.get();
        if(soundbase.equals("fire_rail"))sound = fire_rail.get();
        if(soundbase.equals("fire_amr"))sound = fire_amr.get();
        if(soundbase.equals("fire_missile"))sound = fire_missile.get();
        if(soundbase.equals("fire_roket"))sound = fire_roket.get();
        if(soundbase.equals("fire_grenade"))sound = fire_grenade.get();
        if(soundbase.equals("fire_gl"))sound = fire_gl.get();
        if(soundbase.equals("fire_20mm"))sound = fire_20mm.get();
        if(soundbase.equals("fire_30mm"))sound = fire_30mm.get();
        if(soundbase.equals("fire_havrycannon"))sound = fire_havrycannon.get();
        if(soundbase.equals("fire_fire"))sound = fire_fire.get();
        if(soundbase.equals("throw_grenade"))sound = throw_grenade.get();
        if(soundbase.equals("reload_cannon"))sound = reload_cannon.get();
        if(soundbase.equals("reload_rail"))sound = reload_rail.get();
        if(soundbase.equals("reload_mg"))sound = reload_mg.get();
        if(soundbase.equals("reload_mag"))sound = reload_mag.get();
        if(soundbase.equals("reload_clip"))sound = reload_clip.get();
        if(soundbase.equals("reload_cocking"))sound = reload_cocking.get();
        if(soundbase.equals("reload_shell"))sound = reload_shell.get();
        if(soundbase.equals("sound_tank"))sound = sound_tank.get();
        if(soundbase.equals("sound_car"))sound = sound_car.get();
        if(soundbase.equals("sound_heli"))sound = sound_heli.get();
        if(soundbase.equals("sound_pera"))sound = sound_pera.get();
        if(soundbase.equals("sound_call"))sound = sound_call.get();
        if(soundbase.equals("sound_jet1"))sound = sound_jet1.get();
        if(soundbase.equals("sound_jet2"))sound = sound_jet2.get();
        if(soundbase.equals("sound_lock"))sound = sound_lock.get();
        if(soundbase.equals("sound_fall_shell"))sound = sound_fall_shell.get();
        if(soundbase.equals("sound_robo_step"))sound = sound_robo_step.get();
        if(soundbase.equals("sound_robo_boost"))sound = sound_robo_boost.get();
        if(soundbase.equals("sound_hit"))sound = sound_hit.get();
        return sound;
    }


    private static RegistryObject<SoundEvent> registerSound(String soundName) {
        return SOUND_EVENTS.register(soundName, () -> new SoundEvent(new ResourceLocation(mod_GVCLib.MOD_ID, soundName)));
    }

    /**
     * Register a {@link SoundEvent}.
     *
     * @param soundName The SoundEvent's name without the testmod3 prefix
     * @return The SoundEvent
     */
    /*private static SoundEvent registerSound(String soundName, SoundEvent event) {
        ResourceLocation soundID = new ResourceLocation(mod_ClassicGuns.MOD_ID, soundName);
        //return new SoundEvent(soundID).setRegistryName(soundID);
        ForgeRegistries.SOUND_EVENTS.register(new ResourceLocation(mod_ClassicGuns.MOD_ID, soundName), event);
        return event;
    }*/


}