package com.r3944realms.leashedplayer.content.sounds;

import com.r3944realms.leashedplayer.LeashedPlayer;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.neoforged.bus.api.IEventBus;
import net.neoforged.neoforge.registries.DeferredHolder;
import net.neoforged.neoforge.registries.DeferredRegister;

import java.util.function.Supplier;

public class ModSoundRegister {
    public static DeferredRegister<SoundEvent> SOUNDS = DeferredRegister.create(BuiltInRegistries.SOUND_EVENT, LeashedPlayer.MOD_ID);
    public static ResourceLocation RL_FOX_MUSIC = ResourceLocation.fromNamespaceAndPath(LeashedPlayer.MOD_ID, "music/what_does_the_fox_say");
    public static final DeferredHolder<SoundEvent, SoundEvent> FOX_MUSIC =
            ModSoundRegister.register("what_does_the_fox_say", () -> SoundEvent.createFixedRangeEvent(
                    RL_FOX_MUSIC,
                    128
            ));

    public static DeferredHolder<SoundEvent, SoundEvent> register(String name, Supplier<SoundEvent> supplier){
        return SOUNDS.register(name, supplier);

    }
    public static void register(IEventBus modBus){
        SOUNDS.register(modBus);
    }
    public static String getJukeboxSongTranslateKey(String name) {
        return "jukebox_song." + LeashedPlayer.MOD_ID + "." + name;
    }
    public static String getSubTitleTranslateKey(String name) {
        return "sound." + LeashedPlayer.MOD_ID + ".subtitle." + name;
    }
}
