package top.r3944realms.lib39.core.register;

import net.minecraft.core.Registry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.sounds.SoundEvent;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import top.r3944realms.lib39.Lib39;

import java.util.function.Supplier;

/**
 * The type Lib 39 sound events.
 */
public class FabricLib39SoundEvents {
    /**
     * Init.
     */
    public static void init() {
        Lib39SoundEvents.DUCK_TOY = register("duck_toy", SoundEvent.createFixedRangeEvent(Lib39SoundEvents.RL_DUCK_TOY, 32.0f));
    }

    /**
     * Register @ not null supplier.
     *
     * @param <T>        the type parameter
     * @param path       the path
     * @param soundEvent the sound event
     * @return the @ not null supplier
     */
    @Contract(pure = true)
    public static <T extends SoundEvent> @NotNull Supplier<T> register(String path, T soundEvent) {
        T register = Registry.register(BuiltInRegistries.SOUND_EVENT, Lib39.rl(path), soundEvent);
        return () -> register;
    }
}
