/*
 *  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.core.register;

import net.minecraft.core.registries.Registries;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.EnchantedBookItem;
import net.minecraft.world.item.enchantment.EnchantmentInstance;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.RegistryObject;
import top.r3944realms.eroticdungeongame.EroticDungeon;

public class EDGCreativeTabs {
    private static final DeferredRegister<CreativeModeTab> CREATIVE_TABS = DeferredRegister.create(Registries.CREATIVE_MODE_TAB, EroticDungeon.MOD_ID);

    public static final RegistryObject<CreativeModeTab> MAIN = CREATIVE_TABS.register("main", () -> CreativeModeTab.builder()
            .title(Component.translatable(EroticDungeon.MOD_ID + ".name"))
            .icon(() -> EDGItems.DUNGEON_CRAFTING_TABLE.get().getDefaultInstance())
            .displayItems((itemDisplayParameters, output) -> {
                output.accept(EDGItems.DUNGEON_CRAFTING_TABLE.get());
                output.accept(EDGItems.DEVICE_KEY.get());
                output.accept(EDGItems.END_ROD_LOVE_MACHINE.get());
                output.accept(EDGItems.LIGHTNING_ROD_LOVE_MACHINE.get());
                for (int i = 1; i <= 5; i++){
                    output.accept(EnchantedBookItem.createForEnchantment(new EnchantmentInstance(EDGEnchantments.CARROT_AND_STICK.get(), i)));
                }
                output.accept(EDGItems.WHIP.get());
                EDGItems.CUFF_BED_ITEMS.values().forEach(i -> output.accept(i.get()));
                EDGItems.RACK_ITEMS.values().forEach(i -> output.accept(i.get()));
                EDGItems.CRUX_ITEMS.values().forEach(i -> output.accept(i.get()));
                EDGItems.X_CROSS_ITEMS.values().forEach(i -> output.accept(i.get()));
                EDGItems.PETRINE_CROSS_ITEMS.values().forEach(i -> output.accept(i.get()));
                EDGItems.SPANISH_DONKEY_ITEMS.values().forEach(i -> output.accept(i.get()));
                EDGItems.PILLORY_ITEMS.values().forEach(i -> output.accept(i.get()));
                EDGItems.WALL_RACK_ITEMS.values().forEach(i -> output.accept(i.get()));
                output.accept(EDGItems.IRON_CAGE_ITEM.get());
                EDGItems.CUFF_POLE_ITEMS.values().forEach(i -> output.accept(i.get()));
                EDGItems.PRONE_BENCH_ITEMS.values().forEach(i -> output.accept(i.get()));
                EDGItems.HANGING_POST_ITEMS.values().forEach(i -> output.accept(i.get()));
            })
            .build()
    );

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