package su.a71.new_soviet.registration;

import net.fabricmc.fabric.api.itemgroup.v1.FabricItemGroup;
import net.minecraft.entity.effect.StatusEffectInstance;
import net.minecraft.entity.effect.StatusEffects;
import net.minecraft.item.*;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;
import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
import net.minecraft.util.Rarity;

import su.a71.new_soviet.Materials.NSE_ToolMaterials;
import su.a71.new_soviet.items.CigaretteItem;
import su.a71.new_soviet.items.DiceItem;
import su.a71.new_soviet.items.RakeItem;

public class NSE_Items extends NSE_BaseRegistration {
    // Like an iron axe but a hoe and slightly faster (-2.8f vs -3.1f) and a bit weaker (6 vs 6.5 damage)
    public static final ToolItem SICKLE = new HoeItem(ToolMaterials.IRON, 6, -2.8F, new Item.Settings());
    // Like a hoe but... wait is this just a sickle upgrade?
    public static final RakeItem RAKE = new RakeItem(NSE_ToolMaterials.IRON_FOR_RAKE, 6, -2.6F, new Item.Settings());

    public static final FoodComponent CONCENTRATE_FC = (new FoodComponent.Builder()).hunger(5).saturationModifier(1.0F).alwaysEdible().build();
    public static final Item CONCENTRATE = new Item(new Item.Settings().food(CONCENTRATE_FC));
    public static final FoodComponent COCONUT_FC = (new FoodComponent.Builder()).hunger(4).saturationModifier(1.2F).statusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 100, 1), 1.0F).statusEffect(new StatusEffectInstance(StatusEffects.ABSORPTION, 2400, 0), 1.0F).alwaysEdible().build();
    public static final Item COCONUT = new Item(new Item.Settings().food(COCONUT_FC).rarity(Rarity.EPIC));

    public static final DiceItem DICE_D6 = new DiceItem(6, "item.new_soviet.dice_d6.tooltip", new Item.Settings().maxCount(6));
    public static final DiceItem DICE_D4 = new DiceItem(4, "item.new_soviet.dice_d4.tooltip", new Item.Settings().maxCount(6));
    public static final DiceItem DICE_D20 = new DiceItem(20, "item.new_soviet.dice_d20.tooltip", new Item.Settings().maxCount(6));

    public static final Item LIGHT_BULB = new Item(new Item.Settings());

    public static final Item CIGARETTE_BUTT = new Item(new Item.Settings());
    public static final CigaretteItem CIGARETTE = new CigaretteItem(200, NSE_Items.CIGARETTE_BUTT, "item.new_soviet.tooltip.salute", new Item.Settings());
//    public static final MusicDiscItem BATTLE_IS_GOING_AGAIN = new MusicDiscItem(1, NSE_Sounds.MUSIC_LENIN, 123)

    private static final ItemGroup NSE_ITEMS_TAB = FabricItemGroup.builder()
            .icon(() -> new ItemStack(SICKLE))
            .displayName(Text.translatable("itemGroup.new_soviet.items"))
            .build();

    public static void init() {
        Registry.register(Registries.ITEM_GROUP, new Identifier("new_soviet", "items"), NSE_ITEMS_TAB);
        registerItem("sickle", () -> SICKLE, NSE_ITEMS_TAB);
        registerItem("rake", () -> RAKE, NSE_ITEMS_TAB);
        registerItem("concentrate", () -> CONCENTRATE, NSE_ITEMS_TAB);
        registerItem("coconut", () -> COCONUT, null);
        registerItem("dice_d6", () -> DICE_D6, NSE_ITEMS_TAB);
        registerItem("dice_d4", () -> DICE_D4, NSE_ITEMS_TAB);
        registerItem("dice_d20", () -> DICE_D20, NSE_ITEMS_TAB);
        registerItem("light_bulb_item", () -> LIGHT_BULB, NSE_ITEMS_TAB);
        registerItem("cigarette", ()-> CIGARETTE, NSE_ITEMS_TAB);
        registerItem("cigarette_butt", ()-> CIGARETTE_BUTT, NSE_ITEMS_TAB);
    }
}
