/*
 *  Copyright 2025-2026 R3944Realms
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */

package top.r3944realms.eroticdungeongame.content.recipe;

import net.minecraft.client.RecipeBookCategories;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraftforge.registries.RegistryObject;
import top.r3944realms.eroticdungeongame.core.register.EDGItems;

import java.util.function.Supplier;

public class EDGRecipeTypeCategories {
    public static RecipeBookCategories WOODEN_DEVICE;
    public static RecipeBookCategories METAL_DEVICE;
    public static RecipeBookCategories OTHER_DEVICE;
    public static RecipeBookCategories EQUIPMENT;
    public static RecipeBookCategories MISC_THING;
    public static RecipeBookCategories EDG_CRAFTING_SEARCH;


    public static void init() {
        //NOOP
    }
    @SuppressWarnings("UnreachableCode")
    public static void reload() {
        EDG_CRAFTING_SEARCH = RecipeBookCategories.create("edg_crafting_search", Items.COMPASS.getDefaultInstance());
        WOODEN_DEVICE = RecipeBookCategories.create("edg_wooden_device", EDGItems.OAK_SPANISH_DONKEY.get().getDefaultInstance(), EDGItems.OAK_CUFF_POLE.get().getDefaultInstance());
        METAL_DEVICE = RecipeBookCategories.create("edg_metal_device", getOrDefault(EDGItems.IRON_CAGE_ITEM, Items.BARRIER::getDefaultInstance));
        MISC_THING = RecipeBookCategories.create("edg_misc_thing",  getOrDefault(EDGItems.DUNGEON_CRAFTING_TABLE, Items.BARRIER::getDefaultInstance));
        EQUIPMENT = RecipeBookCategories.create("edg_equipment",  getOrDefault(EDGItems.WHIP, Items.DIAMOND_HELMET::getDefaultInstance));
    }
    private static ItemStack getOrDefault(RegistryObject<Item> registryObject,
                                          Supplier<ItemStack> defaultValue) {
        return registryObject.isPresent() ?
                registryObject.get().getDefaultInstance() :
                defaultValue.get();
    }

}
