package com.r3944realms.leashedplayer.datagen.provider.attributes;

import com.r3944realms.leashedplayer.LeashedPlayer;
import com.r3944realms.leashedplayer.content.sounds.ModSoundRegister;
import net.minecraft.Util;
import net.minecraft.core.Holder;
import net.minecraft.core.registries.Registries;
import net.minecraft.data.worldgen.BootstrapContext;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceKey;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.world.item.JukeboxSong;

public class ModJukeboxSongs {
    public static ResourceKey<JukeboxSong> FOX_MUSIC = create("what_does_the_fox_say");

    public static void bootstrap(BootstrapContext<JukeboxSong> pContext) {
        JukeboxSongBootstrap(pContext);
    }

    public static void JukeboxSongBootstrap(BootstrapContext<JukeboxSong> pContext) {
        register(pContext, FOX_MUSIC, ModSoundRegister.FOX_MUSIC, 121, 15);

    }

    private static void register(
            BootstrapContext<JukeboxSong> pContext, ResourceKey<JukeboxSong> pKey, Holder<SoundEvent> pSoundEvent, int pLengthInSeconds, int pComparatorOutput
    ) {
        pContext.register(
                pKey,
                new JukeboxSong(pSoundEvent, Component.translatable(Util.makeDescriptionId("jukebox_song", pKey.location())), (float)pLengthInSeconds, pComparatorOutput)
        );
    }
    private static ResourceKey<JukeboxSong> create(String pName) {
        return ResourceKey.create(Registries.JUKEBOX_SONG, ResourceLocation.fromNamespaceAndPath(LeashedPlayer.MOD_ID, pName));
    }

}
