package com.r3944realms.modernlifepatch.datagen.provider;

import com.r3944realms.modernlifepatch.ModernLifePatch;
import com.r3944realms.modernlifepatch.content.blocks.ModBlocks;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.PackOutput;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.client.model.generators.BlockModelProvider;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.registries.ForgeRegistries;

import java.util.Objects;

public class ModBlockModelProvider extends BlockModelProvider {
    private static final ResourceLocation MODERN_LIFE_BARRIER = new ResourceLocation(ModernLifePatch.MOD_ID, "block/barrier");
    public ModBlockModelProvider(PackOutput packOutput, ExistingFileHelper existingFileHelper) {
        super(packOutput, ModernLifePatch.MOD_ID, existingFileHelper);
    }

    @Override
    protected void registerModels() {
        registerBarrierModel(ModBlocks.LIGHT_GRAY_CONCRETE_BARRIER.get(), new ResourceLocation("block/light_gray_concrete"));
        registerBarrierModel(ModBlocks.WHITE_CONCRETE_BARRIER.get(), new ResourceLocation("block/white_concrete"));
        registerBarrierModel(ModBlocks.ORANGE_CONCRETE_BARRIER.get(), new ResourceLocation("block/orange_concrete"));
        registerBarrierModel(ModBlocks.MAGENTA_CONCRETE_BARRIER.get(), new ResourceLocation("block/magenta_concrete"));
        registerBarrierModel(ModBlocks.LIGHT_BLUE_CONCRETE_BARRIER.get(), new ResourceLocation("block/light_blue_concrete"));
        registerBarrierModel(ModBlocks.YELLOW_CONCRETE_BARRIER.get(), new ResourceLocation("block/yellow_concrete"));
        registerBarrierModel(ModBlocks.LIME_CONCRETE_BARRIER.get(), new ResourceLocation("block/lime_concrete"));
        registerBarrierModel(ModBlocks.PINK_CONCRETE_BARRIER.get(), new ResourceLocation("block/pink_concrete"));
        registerBarrierModel(ModBlocks.GRAY_CONCRETE_BARRIER.get(), new ResourceLocation("block/gray_concrete"));
        registerBarrierModel(ModBlocks.CYAN_CONCRETE_BARRIER.get(), new ResourceLocation("block/cyan_concrete"));
        registerBarrierModel(ModBlocks.PURPLE_CONCRETE_BARRIER.get(), new ResourceLocation("block/purple_concrete"));
        registerBarrierModel(ModBlocks.BLUE_CONCRETE_BARRIER.get(), new ResourceLocation("block/blue_concrete"));
        registerBarrierModel(ModBlocks.BROWN_CONCRETE_BARRIER.get(), new ResourceLocation("block/brown_concrete"));
        registerBarrierModel(ModBlocks.GREEN_CONCRETE_BARRIER.get(), new ResourceLocation("block/green_concrete"));
        registerBarrierModel(ModBlocks.RED_CONCRETE_BARRIER.get(), new ResourceLocation("block/red_concrete"));
        registerBarrierModel(ModBlocks.BLACK_CONCRETE_BARRIER.get(), new ResourceLocation("block/black_concrete"));
    }
    public void registerBarrierModel(Block barrierBlock, ResourceLocation vanillaBlock) {
        withExistingParent(
                Objects.requireNonNull(
                        ForgeRegistries.BLOCKS.getKey(barrierBlock)).getPath(),
                MODERN_LIFE_BARRIER)
                .texture("0", Objects.requireNonNull(
                        vanillaBlock))
                .texture("particle",Objects.requireNonNull(
                        vanillaBlock));
    }
}
