package com.r3944realms.modernlifepatch.content.blocks;

import com.dairymoose.modernlife.blocks.BarrierBlock;
import com.r3944realms.modernlifepatch.ModernLifePatch;
import com.r3944realms.modernlifepatch.content.blocks.type.NumberBlock;
import com.r3944realms.modernlifepatch.content.blocks.type.mirror.MirrorBlock;
import com.r3944realms.modernlifepatch.content.blocks.type.mirror.MirrorPart;
import com.r3944realms.modernlifepatch.content.item.ModItems;
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.Blocks;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;

import java.util.Collection;

public class ModBlocks {
    private static final DeferredRegister<Block> BLOCKS
            = DeferredRegister.create(ForgeRegistries.BLOCKS, ModernLifePatch.MOD_ID);
    public static final RegistryObject<MirrorBlock> MIRROR = BLOCKS.register("mirror",
            () -> new MirrorBlock(BlockBehaviour.Properties.copy(Blocks.GLASS), MirrorPart.MirrorType.COMMON_MIRROR));
    public static final RegistryObject<MirrorBlock> TALL_MIRROR = BLOCKS.register("tall_mirror",
            () -> new MirrorBlock(BlockBehaviour.Properties.copy(Blocks.GLASS), MirrorPart.MirrorType.TELL_MIRROR));
    public static final RegistryObject<MirrorBlock> LARGE_MIRROR= BLOCKS.register("large_mirror",
            () -> new MirrorBlock(BlockBehaviour.Properties.copy(Blocks.GLASS), MirrorPart.MirrorType.LARGE_MIRROR));
    public static final RegistryObject<MirrorBlock> MASSIVE_MIRROR = BLOCKS.register("massive_mirror" ,
            () -> new MirrorBlock(BlockBehaviour.Properties.copy(Blocks.GLASS), MirrorPart.MirrorType.MASSIVE_MIRROR));
    //BARRIER
    public static final RegistryObject<Block> LIGHT_GRAY_CONCRETE_BARRIER = BLOCKS.register("light_gray_concrete_barrier",
            () -> new BarrierBlock(BlockBehaviour.Properties.copy(Blocks.LIGHT_GRAY_CONCRETE)));
    public static final RegistryObject<Block> WHITE_CONCRETE_BARRIER = BLOCKS.register("white_concrete_barrier",
            () -> new BarrierBlock(BlockBehaviour.Properties.copy(Blocks.WHITE_CONCRETE)));
    public static final RegistryObject<Block> ORANGE_CONCRETE_BARRIER = BLOCKS.register("orange_concrete_barrier",
            () -> new BarrierBlock(BlockBehaviour.Properties.copy(Blocks.ORANGE_CONCRETE)));
    public static final RegistryObject<Block> MAGENTA_CONCRETE_BARRIER = BLOCKS.register("magenta_concrete_barrier",
            () -> new BarrierBlock(BlockBehaviour.Properties.copy(Blocks.MAGENTA_CONCRETE)));
    public static final RegistryObject<Block> LIGHT_BLUE_CONCRETE_BARRIER = BLOCKS.register("light_blue_concrete_barrier",
            () -> new BarrierBlock(BlockBehaviour.Properties.copy(Blocks.LIGHT_BLUE_CONCRETE)));
    public static final RegistryObject<Block> YELLOW_CONCRETE_BARRIER = BLOCKS.register("yellow_concrete_barrier",
            () -> new BarrierBlock(BlockBehaviour.Properties.copy(Blocks.YELLOW_CONCRETE)));
    public static final RegistryObject<Block> LIME_CONCRETE_BARRIER = BLOCKS.register("lime_concrete_barrier",
            () -> new BarrierBlock(BlockBehaviour.Properties.copy(Blocks.LIME_CONCRETE)));
    public static final RegistryObject<Block> PINK_CONCRETE_BARRIER = BLOCKS.register("pink_concrete_barrier",
            () -> new BarrierBlock(BlockBehaviour.Properties.copy(Blocks.PINK_CONCRETE)));
    public static final RegistryObject<Block> GRAY_CONCRETE_BARRIER = BLOCKS.register("gray_concrete_barrier",
            () -> new BarrierBlock(BlockBehaviour.Properties.copy(Blocks.GRAY_CONCRETE)));
    public static final RegistryObject<Block> CYAN_CONCRETE_BARRIER = BLOCKS.register("cyan_concrete_barrier",
            () -> new BarrierBlock(BlockBehaviour.Properties.copy(Blocks.CYAN_CONCRETE)));
    public static final RegistryObject<Block> PURPLE_CONCRETE_BARRIER = BLOCKS.register("purple_concrete_barrier",
            () -> new BarrierBlock(BlockBehaviour.Properties.copy(Blocks.PURPLE_CONCRETE)));
    public static final RegistryObject<Block> BLUE_CONCRETE_BARRIER = BLOCKS.register("blue_concrete_barrier",
            () -> new BarrierBlock(BlockBehaviour.Properties.copy(Blocks.BLUE_CONCRETE)));
    public static final RegistryObject<Block> BROWN_CONCRETE_BARRIER = BLOCKS.register("brown_concrete_barrier",
            () -> new BarrierBlock(BlockBehaviour.Properties.copy(Blocks.BROWN_CONCRETE)));
    public static final RegistryObject<Block> GREEN_CONCRETE_BARRIER = BLOCKS.register("green_concrete_barrier",
            () -> new BarrierBlock(BlockBehaviour.Properties.copy(Blocks.GREEN_CONCRETE)));
    public static final RegistryObject<Block> RED_CONCRETE_BARRIER = BLOCKS.register("red_concrete_barrier",
            () -> new BarrierBlock(BlockBehaviour.Properties.copy(Blocks.RED_CONCRETE)));
    public static final RegistryObject<Block> BLACK_CONCRETE_BARRIER = BLOCKS.register("black_concrete_barrier",
            () -> new BarrierBlock(BlockBehaviour.Properties.copy(Blocks.BLACK_CONCRETE)));
    //NUMBER
    public static final RegistryObject<Block> NULL_BLOCK = BLOCKS.register("null_block",
            () -> new NumberBlock(BlockBehaviour.Properties.copy(Blocks.STONE)));
    public static final RegistryObject<Block> ONE_BLOCK = BLOCKS.register("one_block",
            () -> new NumberBlock(BlockBehaviour.Properties.copy(Blocks.STONE)));
    public static final RegistryObject<Block> TWO_BLOCK = BLOCKS.register("two_block",
            () -> new NumberBlock(BlockBehaviour.Properties.copy(Blocks.STONE)));
    public static final RegistryObject<Block> THREE_BLOCK = BLOCKS.register("three_block",
            () -> new NumberBlock(BlockBehaviour.Properties.copy(Blocks.STONE)));
    public static final RegistryObject<Block> FOUR_BLOCK = BLOCKS.register("four_block",
            () -> new NumberBlock(BlockBehaviour.Properties.copy(Blocks.STONE)));
    public static final RegistryObject<Block> FIVE_BLOCK = BLOCKS.register("five_block",
            () -> new NumberBlock(BlockBehaviour.Properties.copy(Blocks.STONE)));
    public static final RegistryObject<Block> SIX_BLOCK = BLOCKS.register("six_block",
            () -> new NumberBlock(BlockBehaviour.Properties.copy(Blocks.STONE)));
    public static final RegistryObject<Block> SEVEN_BLOCK = BLOCKS.register("seven_block",
            () -> new NumberBlock(BlockBehaviour.Properties.copy(Blocks.STONE)));
    public static final RegistryObject<Block> EIGHT_BLOCK = BLOCKS.register("eight_block",
            () -> new NumberBlock(BlockBehaviour.Properties.copy(Blocks.STONE)));
    public static final RegistryObject<Block> NINE_BLOCK = BLOCKS.register("nine_block",
            () -> new NumberBlock(BlockBehaviour.Properties.copy(Blocks.STONE)));
    public static final RegistryObject<Block> ZERO_BLOCK = BLOCKS.register("zero_block",
            () -> new NumberBlock(BlockBehaviour.Properties.copy(Blocks.STONE)));
    @SuppressWarnings("UnusedReturnValue")
    public static <T extends Block> RegistryObject<BlockItem> registerBlockItem(String name , RegistryObject<T> block){
        return ModItems.register(name,() -> new BlockItem(block.get(),new Item.Properties()));
    }
    public static Collection<RegistryObject<Block>> getEntries() {
        return BLOCKS.getEntries();
    }
    public static void register(IEventBus bus) {
        BLOCKS.register(bus);
    }
}
