package net.halbear.aotg.registries;

import net.halbear.aotg.AgeoftheGods;
import net.minecraft.tags.BlockTags;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.neoforged.neoforge.registries.DeferredBlock;
import net.neoforged.neoforge.registries.DeferredItem;
import net.neoforged.neoforge.registries.DeferredRegister;

import java.util.function.Function;

import static net.halbear.aotg.registries.ModBlocks.*;

public class ModItems {
    public static final DeferredRegister.Items ITEMS = DeferredRegister.createItems(AgeoftheGods.MODID);
    public static final DeferredItem<BlockItem> LIMESTONE_ITEM = ITEMS.registerSimpleBlockItem("limestone_block", LIMESTONE_BLOCK);
    public static final DeferredItem<BlockItem> SHALE_ITEM = ITEMS.registerSimpleBlockItem("shale_block", SHALE_BLOCK);
    public static final DeferredItem<BlockItem> SHALE_GRASS_ITEM = ITEMS.registerSimpleBlockItem("shale_grass_block", SHALE_GRASS_BLOCK);
    public static final DeferredItem<BlockItem> LIMESTONE_GRASS_ITEM = ITEMS.registerSimpleBlockItem("limestone_grass_block", LIMESTONE_GRASS_BLOCK);
    public static final DeferredItem<BlockItem> OLIVE_LEAVES_ITEM = ITEMS.registerSimpleBlockItem("olive_leaves", OLIVE_LEAVES);
    public static final DeferredItem<BlockItem> OLIVE_LOG_ITEM = ITEMS.registerSimpleBlockItem("olive_log", OLIVE_LOG);
    public static final DeferredItem<BlockItem> ALLOY_FURNACE_ITEM = ITEMS.registerSimpleBlockItem("alloy_furnace", ALLOY_FURNACE);
    public static final DeferredItem<BlockItem> FORGE_WORKBENCH_ITEM = ITEMS.registerSimpleBlockItem("forge", FORGE_WORKBENCH);

    public static final DeferredItem<Item> FLUID_INDICATOR_ITEM = RegisterItem("fluid_indicator_debug_item", properties -> new Item(properties
            .fireResistant()
    ));

    public static final DeferredItem<Item> ZINC_INGOT = RegisterItem("zinc_ingot", Item::new);
    public static final DeferredItem<Item> TIN_INGOT = RegisterItem("tin_ingot", Item::new);
    public static final DeferredItem<Item> ELECTRUM_INGOT = RegisterItem("electrum_ingot", Item::new);
    public static final DeferredItem<Item> BRONZE_INGOT = RegisterItem("bronze_ingot", Item::new);
    public static final DeferredItem<Item> ORICHALCUM_INGOT = RegisterItem("orichalcum_ingot", Item::new);
    public static final DeferredItem<Item> HEPATIZON_INGOT = RegisterItem("hepatizon_ingot", Item::new);
    public static final DeferredItem<Item> SILVER_INGOT = RegisterItem("silver_ingot", Item::new);
    public static final DeferredItem<Item> HARDENED_SLAG = RegisterItem("slag", Item::new);

    public static final DeferredItem<Item> XIPHOS_SWORD = RegisterItem("xiphos",
            properties -> new Item(properties
                    .tool(ModTiers.SWORD_TIER,
                            BlockTags.SWORD_EFFICIENT,
                            3.0f,
                            -2.4f,
                            1.0f
                    ).durability(1900)
            )
    );

    private static <T extends Item> DeferredItem<T> RegisterItem(String Name, Function<Item.Properties, T> function){
        DeferredItem<T> newBlock = ITEMS.registerItem(Name, function);
        return newBlock;
    }
}
