package ovh.glitchlabs.ornamentum.datagen;

import net.minecraft.core.Direction;
import net.minecraft.data.PackOutput;
import net.minecraft.world.level.block.FaceAttachedHorizontalDirectionalBlock;
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
import net.minecraft.world.level.block.state.properties.AttachFace;
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.neoforged.neoforge.client.model.generators.BlockStateProvider;
import net.neoforged.neoforge.client.model.generators.ConfiguredModel;
import net.neoforged.neoforge.client.model.generators.ModelFile;
import net.neoforged.neoforge.common.data.ExistingFileHelper;
import net.neoforged.neoforge.registries.DeferredBlock;
import ovh.glitchlabs.ornamentum.Ornamentum;
import ovh.glitchlabs.ornamentum.blocks.ModBlocks;

public class ModBlockStateProvider extends BlockStateProvider {
    public ModBlockStateProvider(PackOutput output, ExistingFileHelper exFileHelper) {
        super(output, Ornamentum.MODID, exFileHelper);
    }

    @Override
    protected void registerStatesAndModels() {

        blockWithItem(ModBlocks.POLISHED_OBSIDIAN);
        blockWithItem(ModBlocks.CRACKED_OBSIDIAN_BRICKS);
        blockWithItem(ModBlocks.CRACKED_OBSIDIAN_TILES);
        blockWithItem(ModBlocks.OBSIDIAN_BRICKS);
        blockWithItem(ModBlocks.OBSIDIAN_TILES);

        // FLAGS
        createFlag(ModBlocks.WHITE_FLAG, "white_flag");
        createFlag(ModBlocks.ORANGE_FLAG, "orange_flag");
        createFlag(ModBlocks.MAGENTA_FLAG, "magenta_flag");
        createFlag(ModBlocks.LIGHT_BLUE_FLAG, "light_blue_flag");
        createFlag(ModBlocks.YELLOW_FLAG, "yellow_flag");
        createFlag(ModBlocks.LIME_FLAG, "lime_flag");
        createFlag(ModBlocks.PINK_FLAG, "pink_flag");
        createFlag(ModBlocks.GRAY_FLAG, "gray_flag");
        createFlag(ModBlocks.LIGHT_GRAY_FLAG, "light_gray_flag");
        createFlag(ModBlocks.CYAN_FLAG, "cyan_flag");
        createFlag(ModBlocks.PURPLE_FLAG, "purple_flag");
        createFlag(ModBlocks.BLUE_FLAG, "blue_flag");
        createFlag(ModBlocks.BROWN_FLAG, "brown_flag");
        createFlag(ModBlocks.GREEN_FLAG, "green_flag");
        createFlag(ModBlocks.RED_FLAG, "red_flag");
        createFlag(ModBlocks.BLACK_FLAG, "black_flag");

        createFlag(ModBlocks.AUSTRIA_FLAG, "austria_flag");
        createFlag(ModBlocks.BOUVET_ISLAND_FLAG, "bouvet_island_flag");
        createFlag(ModBlocks.CANADA_FLAG, "canada_flag");
        createFlag(ModBlocks.CHINA_FLAG, "china_flag");
        createFlag(ModBlocks.DENMARK_FLAG, "denmark_flag");
        createFlag(ModBlocks.FINLAND_FLAG, "finland_flag");
        createFlag(ModBlocks.FRANCE_FLAG, "france_flag");
        createFlag(ModBlocks.GERMANY_FLAG, "germany_flag");
        createFlag(ModBlocks.GREECE_FLAG, "greece_flag");
        createFlag(ModBlocks.HUNGARY_FLAG, "hungary_flag");
        createFlag(ModBlocks.ICELAND_FLAG, "iceland_flag");
        createFlag(ModBlocks.INDIA_FLAG, "india_flag");
        createFlag(ModBlocks.IRELAND_FLAG, "ireland_flag");
        createFlag(ModBlocks.ITALY_FLAG, "italy_flag");
        createFlag(ModBlocks.JAPAN_FLAG, "japan_flag");
        createFlag(ModBlocks.LATVIA_FLAG, "latvia_flag");
        createFlag(ModBlocks.NETHERLANDS_FLAG, "netherlands_flag");
        createFlag(ModBlocks.SWEDEN_FLAG, "sweden_flag");
        createFlag(ModBlocks.SWITZERLAND_FLAG, "switzerland_flag");
        createFlag(ModBlocks.UNITED_KINGDOM_FLAG, "united_kingdom_flag");
        createFlag(ModBlocks.UNITED_STATES_FLAG, "united_states_flag");

        createFlag(ModBlocks.AGENDER_FLAG, "agender_flag");
        createFlag(ModBlocks.AROACE_FLAG, "aroace_flag");
        createFlag(ModBlocks.AROMANTIC_FLAG, "aromantic_flag");
        createFlag(ModBlocks.ASEXUAL_FLAG, "asexual_flag");
        createFlag(ModBlocks.BISEXUAL_FLAG, "bisexual_flag");
        createFlag(ModBlocks.DEMIROMANTIC_FLAG, "demiromantic_flag");
        createFlag(ModBlocks.DEMISEXUAL_FLAG, "demisexual_flag");
        createFlag(ModBlocks.GAY_MEN_FLAG, "gay_men_flag");
        createFlag(ModBlocks.GENDERFLUID_FLAG, "genderfluid_flag");
        createFlag(ModBlocks.GENDERQUEER_FLAG, "genderqueer_flag");
        createFlag(ModBlocks.INTERSEX_FLAG, "intersex_flag");
        createFlag(ModBlocks.LESBIAN_FLAG, "lesbian_flag");
        createFlag(ModBlocks.NON_BINARY_FLAG, "non-binary_flag");
        createFlag(ModBlocks.OMNISEXUAL_FLAG, "omnisexual_flag");
        createFlag(ModBlocks.PANSEXUAL_FLAG, "pansexual_flag");
        createFlag(ModBlocks.PRIDE_FLAG, "pride_flag");
        createFlag(ModBlocks.PROGRESS_PRIDE_FLAG, "progress_pride_flag");
        createFlag(ModBlocks.TRANS_FLAG, "trans_flag");

        //pattern blocks

        blockWithItem(ModBlocks.WHITE_PATTERN_BLOCK);
        createStairsAndSlab(ModBlocks.WHITE_PATTERN_BLOCK_STAIRS, ModBlocks.WHITE_PATTERN_BLOCK_SLAB, "white_pattern_block");

        blockWithItem(ModBlocks.ORANGE_PATTERN_BLOCK);
        createStairsAndSlab(ModBlocks.ORANGE_PATTERN_BLOCK_STAIRS, ModBlocks.ORANGE_PATTERN_BLOCK_SLAB, "orange_pattern_block");

        blockWithItem(ModBlocks.MAGENTA_PATTERN_BLOCK);
        createStairsAndSlab(ModBlocks.MAGENTA_PATTERN_BLOCK_STAIRS, ModBlocks.MAGENTA_PATTERN_BLOCK_SLAB, "magenta_pattern_block");

        blockWithItem(ModBlocks.LIGHT_BLUE_PATTERN_BLOCK);
        createStairsAndSlab(ModBlocks.LIGHT_BLUE_PATTERN_BLOCK_STAIRS, ModBlocks.LIGHT_BLUE_PATTERN_BLOCK_SLAB, "light_blue_pattern_block");

        blockWithItem(ModBlocks.YELLOW_PATTERN_BLOCK);
        createStairsAndSlab(ModBlocks.YELLOW_PATTERN_BLOCK_STAIRS, ModBlocks.YELLOW_PATTERN_BLOCK_SLAB, "yellow_pattern_block");

        blockWithItem(ModBlocks.LIME_PATTERN_BLOCK);
        createStairsAndSlab(ModBlocks.LIME_PATTERN_BLOCK_STAIRS, ModBlocks.LIME_PATTERN_BLOCK_SLAB, "lime_pattern_block");

        blockWithItem(ModBlocks.PINK_PATTERN_BLOCK);
        createStairsAndSlab(ModBlocks.PINK_PATTERN_BLOCK_STAIRS, ModBlocks.PINK_PATTERN_BLOCK_SLAB, "pink_pattern_block");

        blockWithItem(ModBlocks.GRAY_PATTERN_BLOCK);
        createStairsAndSlab(ModBlocks.GRAY_PATTERN_BLOCK_STAIRS, ModBlocks.GRAY_PATTERN_BLOCK_SLAB, "gray_pattern_block");

        blockWithItem(ModBlocks.LIGHT_GRAY_PATTERN_BLOCK);
        createStairsAndSlab(ModBlocks.LIGHT_GRAY_PATTERN_BLOCK_STAIRS, ModBlocks.LIGHT_GRAY_PATTERN_BLOCK_SLAB, "light_gray_pattern_block");

        blockWithItem(ModBlocks.CYAN_PATTERN_BLOCK);
        createStairsAndSlab(ModBlocks.CYAN_PATTERN_BLOCK_STAIRS, ModBlocks.CYAN_PATTERN_BLOCK_SLAB, "cyan_pattern_block");

        blockWithItem(ModBlocks.PURPLE_PATTERN_BLOCK);
        createStairsAndSlab(ModBlocks.PURPLE_PATTERN_BLOCK_STAIRS, ModBlocks.PURPLE_PATTERN_BLOCK_SLAB, "purple_pattern_block");

        blockWithItem(ModBlocks.BLUE_PATTERN_BLOCK);
        createStairsAndSlab(ModBlocks.BLUE_PATTERN_BLOCK_STAIRS, ModBlocks.BLUE_PATTERN_BLOCK_SLAB, "blue_pattern_block");

        blockWithItem(ModBlocks.BROWN_PATTERN_BLOCK);
        createStairsAndSlab(ModBlocks.BROWN_PATTERN_BLOCK_STAIRS, ModBlocks.BROWN_PATTERN_BLOCK_SLAB, "brown_pattern_block");

        blockWithItem(ModBlocks.GREEN_PATTERN_BLOCK);
        createStairsAndSlab(ModBlocks.GREEN_PATTERN_BLOCK_STAIRS, ModBlocks.GREEN_PATTERN_BLOCK_SLAB, "green_pattern_block");

        blockWithItem(ModBlocks.BLACK_PATTERN_BLOCK);
        createStairsAndSlab(ModBlocks.BLACK_PATTERN_BLOCK_STAIRS, ModBlocks.BLACK_PATTERN_BLOCK_SLAB, "black_pattern_block");

        blockWithItem(ModBlocks.RED_PATTERN_BLOCK);
        createStairsAndSlab(ModBlocks.RED_PATTERN_BLOCK_STAIRS, ModBlocks.RED_PATTERN_BLOCK_SLAB, "red_pattern_block");

        blockWithItem(ModBlocks.POOL_TILES);
        blockWithItem(ModBlocks.POOL_TILES1);

        blockWithItem(ModBlocks.MESH_IRON);

        //GRATES
        blockWithItem(ModBlocks.IRON_GRATE);
        blockWithItem(ModBlocks.GOLD_GRATE);
        blockWithItem(ModBlocks.DIAMOND_GRATE);
        blockWithItem(ModBlocks.NETHERITE_GRATE);
        blockWithItem(ModBlocks.AMETHYST_GRATE);
        blockWithItem(ModBlocks.OBSIDIAN_GRATE);

        // Glow Block
        blockWithItem(ModBlocks.LIME_GLOW_BLOCK);
        blockWithItem(ModBlocks.WHITE_GLOW_BLOCK);
        blockWithItem(ModBlocks.GRAY_GLOW_BLOCK);
        blockWithItem(ModBlocks.LIGHT_GRAY_GLOW_BLOCK);
        blockWithItem(ModBlocks.BLACK_GLOW_BLOCK);
        blockWithItem(ModBlocks.BROWN_GLOW_BLOCK);
        blockWithItem(ModBlocks.RED_GLOW_BLOCK);
        blockWithItem(ModBlocks.ORANGE_GLOW_BLOCK);
        blockWithItem(ModBlocks.YELLOW_GLOW_BLOCK);
        blockWithItem(ModBlocks.GREEN_GLOW_BLOCK);
        blockWithItem(ModBlocks.CYAN_GLOW_BLOCK);
        blockWithItem(ModBlocks.LIGHT_BLUE_GLOW_BLOCK);
        blockWithItem(ModBlocks.BLUE_GLOW_BLOCK);
        blockWithItem(ModBlocks.PURPLE_GLOW_BLOCK);
        blockWithItem(ModBlocks.MAGENTA_GLOW_BLOCK);
        blockWithItem(ModBlocks.PINK_GLOW_BLOCK);

        // GLOW BLOCK STAIRS/SLABS
        createStairsAndSlab(ModBlocks.LIME_GLOW_BLOCK_STAIRS, ModBlocks.LIME_GLOW_BLOCK_SLAB, "lime_glow_block");
        createStairsAndSlab(ModBlocks.WHITE_GLOW_BLOCK_STAIRS, ModBlocks.WHITE_GLOW_BLOCK_SLAB, "white_glow_block");
        createStairsAndSlab(ModBlocks.LIGHT_GRAY_GLOW_BLOCK_STAIRS, ModBlocks.LIGHT_GRAY_GLOW_BLOCK_SLAB, "light_gray_glow_block");
        createStairsAndSlab(ModBlocks.GRAY_GLOW_BLOCK_STAIRS, ModBlocks.GRAY_GLOW_BLOCK_SLAB, "gray_glow_block");
        createStairsAndSlab(ModBlocks.BLACK_GLOW_BLOCK_STAIRS, ModBlocks.BLACK_GLOW_BLOCK_SLAB, "black_glow_block");
        createStairsAndSlab(ModBlocks.BROWN_GLOW_BLOCK_STAIRS, ModBlocks.BROWN_GLOW_BLOCK_SLAB, "brown_glow_block");
        createStairsAndSlab(ModBlocks.RED_GLOW_BLOCK_STAIRS, ModBlocks.RED_GLOW_BLOCK_SLAB, "red_glow_block");
        createStairsAndSlab(ModBlocks.ORANGE_GLOW_BLOCK_STAIRS, ModBlocks.ORANGE_GLOW_BLOCK_SLAB, "orange_glow_block");
        createStairsAndSlab(ModBlocks.YELLOW_GLOW_BLOCK_STAIRS, ModBlocks.YELLOW_GLOW_BLOCK_SLAB, "yellow_glow_block");
        createStairsAndSlab(ModBlocks.GREEN_GLOW_BLOCK_STAIRS, ModBlocks.GREEN_GLOW_BLOCK_SLAB, "green_glow_block");
        createStairsAndSlab(ModBlocks.CYAN_GLOW_BLOCK_STAIRS, ModBlocks.CYAN_GLOW_BLOCK_SLAB, "cyan_glow_block");
        createStairsAndSlab(ModBlocks.LIGHT_BLUE_GLOW_BLOCK_STAIRS, ModBlocks.LIGHT_BLUE_GLOW_BLOCK_SLAB, "light_blue_glow_block");
        createStairsAndSlab(ModBlocks.BLUE_GLOW_BLOCK_STAIRS, ModBlocks.BLUE_GLOW_BLOCK_SLAB, "blue_glow_block");
        createStairsAndSlab(ModBlocks.PURPLE_GLOW_BLOCK_STAIRS, ModBlocks.PURPLE_GLOW_BLOCK_SLAB, "purple_glow_block");
        createStairsAndSlab(ModBlocks.MAGENTA_GLOW_BLOCK_STAIRS, ModBlocks.MAGENTA_GLOW_BLOCK_SLAB, "magenta_glow_block");
        createStairsAndSlab(ModBlocks.PINK_GLOW_BLOCK_STAIRS, ModBlocks.PINK_GLOW_BLOCK_SLAB, "pink_glow_block");

        //GLOW GLASS (use vanilla stained glass textures)
        blockWithVanillaTexture(ModBlocks.LIME_GLOW_STAINED_GLASS, "lime_stained_glass");
        blockWithVanillaTexture(ModBlocks.WHITE_GLOW_STAINED_GLASS, "white_stained_glass");
        blockWithVanillaTexture(ModBlocks.GRAY_GLOW_STAINED_GLASS, "gray_stained_glass");
        blockWithVanillaTexture(ModBlocks.LIGHT_GRAY_GLOW_STAINED_GLASS, "light_gray_stained_glass");
        blockWithVanillaTexture(ModBlocks.BLACK_GLOW_STAINED_GLASS, "black_stained_glass");
        blockWithVanillaTexture(ModBlocks.BROWN_GLOW_STAINED_GLASS, "brown_stained_glass");
        blockWithVanillaTexture(ModBlocks.RED_GLOW_STAINED_GLASS, "red_stained_glass");
        blockWithVanillaTexture(ModBlocks.ORANGE_GLOW_STAINED_GLASS, "orange_stained_glass");
        blockWithVanillaTexture(ModBlocks.YELLOW_GLOW_STAINED_GLASS, "yellow_stained_glass");
        blockWithVanillaTexture(ModBlocks.GREEN_GLOW_STAINED_GLASS, "green_stained_glass");
        blockWithVanillaTexture(ModBlocks.CYAN_GLOW_STAINED_GLASS, "cyan_stained_glass");
        blockWithVanillaTexture(ModBlocks.LIGHT_BLUE_GLOW_STAINED_GLASS, "light_blue_stained_glass");
        blockWithVanillaTexture(ModBlocks.BLUE_GLOW_STAINED_GLASS, "blue_stained_glass");
        blockWithVanillaTexture(ModBlocks.PURPLE_GLOW_STAINED_GLASS, "purple_stained_glass");
        blockWithVanillaTexture(ModBlocks.MAGENTA_GLOW_STAINED_GLASS, "magenta_stained_glass");
        blockWithVanillaTexture(ModBlocks.PINK_GLOW_STAINED_GLASS, "pink_stained_glass");

        // WOOL STAIRS & SLABS (use vanilla wool textures)
        createWoolStairsAndSlab(ModBlocks.WHITE_WOOL_STAIRS, ModBlocks.WHITE_WOOL_SLAB, "white_wool");
        createWoolStairsAndSlab(ModBlocks.ORANGE_WOOL_STAIRS, ModBlocks.ORANGE_WOOL_SLAB, "orange_wool");
        createWoolStairsAndSlab(ModBlocks.MAGENTA_WOOL_STAIRS, ModBlocks.MAGENTA_WOOL_SLAB, "magenta_wool");
        createWoolStairsAndSlab(ModBlocks.LIGHT_BLUE_WOOL_STAIRS, ModBlocks.LIGHT_BLUE_WOOL_SLAB, "light_blue_wool");
        createWoolStairsAndSlab(ModBlocks.YELLOW_WOOL_STAIRS, ModBlocks.YELLOW_WOOL_SLAB, "yellow_wool");
        createWoolStairsAndSlab(ModBlocks.LIME_WOOL_STAIRS, ModBlocks.LIME_WOOL_SLAB, "lime_wool");
        createWoolStairsAndSlab(ModBlocks.PINK_WOOL_STAIRS, ModBlocks.PINK_WOOL_SLAB, "pink_wool");
        createWoolStairsAndSlab(ModBlocks.GRAY_WOOL_STAIRS, ModBlocks.GRAY_WOOL_SLAB, "gray_wool");
        createWoolStairsAndSlab(ModBlocks.LIGHT_GRAY_WOOL_STAIRS, ModBlocks.LIGHT_GRAY_WOOL_SLAB, "light_gray_wool");
        createWoolStairsAndSlab(ModBlocks.CYAN_WOOL_STAIRS, ModBlocks.CYAN_WOOL_SLAB, "cyan_wool");
        createWoolStairsAndSlab(ModBlocks.PURPLE_WOOL_STAIRS, ModBlocks.PURPLE_WOOL_SLAB, "purple_wool");
        createWoolStairsAndSlab(ModBlocks.BLUE_WOOL_STAIRS, ModBlocks.BLUE_WOOL_SLAB, "blue_wool");
        createWoolStairsAndSlab(ModBlocks.BROWN_WOOL_STAIRS, ModBlocks.BROWN_WOOL_SLAB, "brown_wool");
        createWoolStairsAndSlab(ModBlocks.GREEN_WOOL_STAIRS, ModBlocks.GREEN_WOOL_SLAB, "green_wool");
        createWoolStairsAndSlab(ModBlocks.RED_WOOL_STAIRS, ModBlocks.RED_WOOL_SLAB, "red_wool");
        createWoolStairsAndSlab(ModBlocks.BLACK_WOOL_STAIRS, ModBlocks.BLACK_WOOL_SLAB, "black_wool");

        createStairsAndSlab(ModBlocks.POOL_TILES_STAIRS, ModBlocks.POOL_TILES_SLAB, "pool_tiles");
        createStairsAndSlab(ModBlocks.POOL_TILES1_STAIRS, ModBlocks.POOL_TILES1_SLAB, "pool_tiles1");

        // COLORED BRICKS
        blockWithItem(ModBlocks.WHITE_BRICKS);
        blockWithItem(ModBlocks.ORANGE_BRICKS);
        blockWithItem(ModBlocks.MAGENTA_BRICKS);
        blockWithItem(ModBlocks.LIGHT_BLUE_BRICKS);
        blockWithItem(ModBlocks.YELLOW_BRICKS);
        blockWithItem(ModBlocks.LIME_BRICKS);
        blockWithItem(ModBlocks.PINK_BRICKS);
        blockWithItem(ModBlocks.GRAY_BRICKS);
        blockWithItem(ModBlocks.LIGHT_GRAY_BRICKS);
        blockWithItem(ModBlocks.CYAN_BRICKS);
        blockWithItem(ModBlocks.PURPLE_BRICKS);
        blockWithItem(ModBlocks.BLUE_BRICKS);
        blockWithItem(ModBlocks.BROWN_BRICKS);
        blockWithItem(ModBlocks.GREEN_BRICKS);
        blockWithItem(ModBlocks.RED_BRICKS);
        blockWithItem(ModBlocks.BLACK_BRICKS);

        createStairsAndSlab(ModBlocks.WHITE_BRICKS_STAIRS, ModBlocks.WHITE_BRICKS_SLAB, "white_bricks");
        createStairsAndSlab(ModBlocks.ORANGE_BRICKS_STAIRS, ModBlocks.ORANGE_BRICKS_SLAB, "orange_bricks");
        createStairsAndSlab(ModBlocks.MAGENTA_BRICKS_STAIRS, ModBlocks.MAGENTA_BRICKS_SLAB, "magenta_bricks");
        createStairsAndSlab(ModBlocks.LIGHT_BLUE_BRICKS_STAIRS, ModBlocks.LIGHT_BLUE_BRICKS_SLAB, "light_blue_bricks");
        createStairsAndSlab(ModBlocks.YELLOW_BRICKS_STAIRS, ModBlocks.YELLOW_BRICKS_SLAB, "yellow_bricks");
        createStairsAndSlab(ModBlocks.LIME_BRICKS_STAIRS, ModBlocks.LIME_BRICKS_SLAB, "lime_bricks");
        createStairsAndSlab(ModBlocks.PINK_BRICKS_STAIRS, ModBlocks.PINK_BRICKS_SLAB, "pink_bricks");
        createStairsAndSlab(ModBlocks.GRAY_BRICKS_STAIRS, ModBlocks.GRAY_BRICKS_SLAB, "gray_bricks");
        createStairsAndSlab(ModBlocks.LIGHT_GRAY_BRICKS_STAIRS, ModBlocks.LIGHT_GRAY_BRICKS_SLAB, "light_gray_bricks");
        createStairsAndSlab(ModBlocks.CYAN_BRICKS_STAIRS, ModBlocks.CYAN_BRICKS_SLAB, "cyan_bricks");
        createStairsAndSlab(ModBlocks.PURPLE_BRICKS_STAIRS, ModBlocks.PURPLE_BRICKS_SLAB, "purple_bricks");
        createStairsAndSlab(ModBlocks.BLUE_BRICKS_STAIRS, ModBlocks.BLUE_BRICKS_SLAB, "blue_bricks");
        createStairsAndSlab(ModBlocks.BROWN_BRICKS_STAIRS, ModBlocks.BROWN_BRICKS_SLAB, "brown_bricks");
        createStairsAndSlab(ModBlocks.GREEN_BRICKS_STAIRS, ModBlocks.GREEN_BRICKS_SLAB, "green_bricks");
        createStairsAndSlab(ModBlocks.RED_BRICKS_STAIRS, ModBlocks.RED_BRICKS_SLAB, "red_bricks");
        createStairsAndSlab(ModBlocks.BLACK_BRICKS_STAIRS, ModBlocks.BLACK_BRICKS_SLAB, "black_bricks");

        blockWithItem(ModBlocks.AMETIST_BRICKS);
        blockWithItem(ModBlocks.PURPUR_BRICKS);
        blockWithItem(ModBlocks.SMOOTH_BASALT_BRICKS);
        blockWithItem(ModBlocks.POLISHED_ANDESITE_BRICKS);
        blockWithItem(ModBlocks.POLISHED_DIORITE_BRICKS);
        blockWithItem(ModBlocks.POLISHED_GRANITE_BRICKS);

        createStairsAndSlab(ModBlocks.AMETIST_BRICKS_STAIRS, ModBlocks.AMETIST_BRICKS_SLAB, "ametist_bricks");
        createStairsAndSlab(ModBlocks.PURPUR_BRICKS_STAIRS, ModBlocks.PURPUR_BRICKS_SLAB, "purpur_bricks");
        createStairsAndSlab(ModBlocks.SMOOTH_BASALT_BRICKS_STAIRS, ModBlocks.SMOOTH_BASALT_BRICKS_SLAB, "smooth_basalt_bricks");
        createStairsAndSlab(ModBlocks.POLISHED_ANDESITE_BRICKS_STAIRS, ModBlocks.POLISHED_ANDESITE_BRICKS_SLAB, "polished_andesite_bricks");
        createStairsAndSlab(ModBlocks.POLISHED_DIORITE_BRICKS_STAIRS, ModBlocks.POLISHED_DIORITE_BRICKS_SLAB, "polished_diorite_bricks");
        createStairsAndSlab(ModBlocks.POLISHED_GRANITE_BRICKS_STAIRS, ModBlocks.POLISHED_GRANITE_BRICKS_SLAB, "polished_granite_bricks");


    }

    private void createStairsAndSlab(DeferredBlock<?> stairsDeferred, DeferredBlock<?> slabDeferred, String textureName) {
        // Textur kommt aus dem EIGENEN Mod-Namespace: assets/ornamentum/textures/block/<textureName>.png
        var tex = modLoc("block/" + textureName);

        // SLAB MODELS
        String slabPath = slabDeferred.getId().getPath();
        String slabTopPath = slabPath + "_top";
        String doublePath = "double_" + slabPath;

        ModelFile slab = models().withExistingParent(slabPath, mcLoc("block/slab"))
                .texture("bottom", tex)
                .texture("top", tex)
                .texture("side", tex);

        ModelFile slabTop = models().withExistingParent(slabTopPath, mcLoc("block/slab_top"))
                .texture("bottom", tex)
                .texture("top", tex)
                .texture("side", tex);

        ModelFile doubleSlab = models().withExistingParent(doublePath, mcLoc("block/cube_all"))
                .texture("all", tex);

        // STAIRS MODELS
        String stairsPath = stairsDeferred.getId().getPath();
        String stairsInnerPath = stairsPath + "_inner";
        String stairsOuterPath = stairsPath + "_outer";

        ModelFile stairs = models().withExistingParent(stairsPath, mcLoc("block/stairs"))
                .texture("bottom", tex)
                .texture("top", tex)
                .texture("side", tex);

        ModelFile stairsInner = models().withExistingParent(stairsInnerPath, mcLoc("block/inner_stairs"))
                .texture("bottom", tex)
                .texture("top", tex)
                .texture("side", tex);

        ModelFile stairsOuter = models().withExistingParent(stairsOuterPath, mcLoc("block/outer_stairs"))
                .texture("bottom", tex)
                .texture("top", tex)
                .texture("side", tex);

        // Blockstates + Modelle generieren
        slabBlock((net.minecraft.world.level.block.SlabBlock) slabDeferred.get(), slab, slabTop, doubleSlab);
        stairsBlock((net.minecraft.world.level.block.StairBlock) stairsDeferred.get(), stairs, stairsInner, stairsOuter);

        // Item-Modelle manuell auf die generierten Block-Modelle zeigen lassen
        itemModels().withExistingParent(slabPath, modLoc("block/" + slabPath));
        itemModels().withExistingParent(stairsPath, modLoc("block/" + stairsPath));
    }

    private void createWoolStairsAndSlab(DeferredBlock<?> stairsDeferred, DeferredBlock<?> slabDeferred, String vanillaTextureName) {
        // textures come from vanilla namespace (minecraft:block/<vanillaTextureName>)
        String tex = "block/" + vanillaTextureName;

        // SLAB MODELS
        String slabPath = slabDeferred.getId().getPath();
        String slabTopPath = slabPath + "_top";
        String doublePath = "double_" + slabPath;

        ModelFile slab = models().withExistingParent(slabPath, mcLoc("block/slab"))
                .texture("bottom", mcLoc(tex))
                .texture("top", mcLoc(tex))
                .texture("side", mcLoc(tex));

        ModelFile slabTop = models().withExistingParent(slabTopPath, mcLoc("block/slab_top"))
                .texture("bottom", mcLoc(tex))
                .texture("top", mcLoc(tex))
                .texture("side", mcLoc(tex));

        ModelFile doubleSlab = models().withExistingParent(doublePath, mcLoc("block/cube_all"))
                .texture("all", mcLoc(tex));

        // STAIRS MODELS
        String stairsPath = stairsDeferred.getId().getPath();
        String stairsInnerPath = stairsPath + "_inner";
        String stairsOuterPath = stairsPath + "_outer";

        ModelFile stairs = models().withExistingParent(stairsPath, mcLoc("block/stairs"))
                .texture("bottom", mcLoc(tex))
                .texture("top", mcLoc(tex))
                .texture("side", mcLoc(tex));

        ModelFile stairsInner = models().withExistingParent(stairsInnerPath, mcLoc("block/inner_stairs"))
                .texture("bottom", mcLoc(tex))
                .texture("top", mcLoc(tex))
                .texture("side", mcLoc(tex));

        ModelFile stairsOuter = models().withExistingParent(stairsOuterPath, mcLoc("block/outer_stairs"))
                .texture("bottom", mcLoc(tex))
                .texture("top", mcLoc(tex))
                .texture("side", mcLoc(tex));

        // Generate slabBlock blockstate with all variants
        slabBlock((net.minecraft.world.level.block.SlabBlock) slabDeferred.get(), slab, slabTop, doubleSlab);

        // Generate stairsBlock blockstate with all variants (straight, inner, outer)
        stairsBlock((net.minecraft.world.level.block.StairBlock) stairsDeferred.get(), stairs, stairsInner, stairsOuter);

        // slabBlock() and stairsBlock() only generate blockstates/blockmodels, NOT item models.
        // Register the item models manually, pointing at the already-generated block models.
        itemModels().withExistingParent(slabPath, modLoc("block/" + slabPath));
        itemModels().withExistingParent(stairsPath, modLoc("block/" + stairsPath));
    }

    private void blockWithItem(DeferredBlock<?> deferredBlock) {
        simpleBlockWithItem(deferredBlock.get(), cubeAll(deferredBlock.get()));
    }

    private void blockWithVanillaTexture(DeferredBlock<?> deferredBlock, String vanillaTextureName) {
        ModelFile model = models().cubeAll(deferredBlock.getId().getPath(), mcLoc("block/" + vanillaTextureName));
        simpleBlockWithItem(deferredBlock.get(), model);
    }

    private void createFlag(DeferredBlock<?> block, String textureName) {

        String name = block.getId().getPath();


        ModelFile floor =
                models()
                        .withExistingParent(
                                name,
                                modLoc("block/template_flag")
                        )
                        .texture(
                                "2",
                                modLoc("block/flags/" + textureName)
                        );


        ModelFile wall =
                models()
                        .withExistingParent(
                                name + "_wall",
                                modLoc("block/template_flag_wall")
                        )
                        .texture(
                                "2",
                                modLoc("block/flags/" + textureName)
                        );


        ModelFile ceiling =
                models()
                        .withExistingParent(
                                name + "_ceiling",
                                modLoc("block/template_flag_ceiling")
                        )
                        .texture(
                                "2",
                                modLoc("block/flags/" + textureName)
                        );

        getVariantBuilder(block.get())
                .forAllStates(state -> {
                    Direction direction =
                            state.getValue(HorizontalDirectionalBlock.FACING);

                    AttachFace face =
                            state.getValue(
                                    BlockStateProperties.ATTACH_FACE
                            );

                    ModelFile model = switch (face) {
                        case WALL -> wall;
                        case CEILING -> ceiling;
                        default -> floor;
                    };


                    return ConfiguredModel.builder()
                            .modelFile(model)
                            .rotationY(
                                    switch(direction) {
                                        case NORTH -> 0;
                                        case EAST -> 90;
                                        case SOUTH -> 180;
                                        case WEST -> 270;
                                        default -> 0;
                                    }
                            ).build();
                });
        simpleBlockItem(
                block.get(),
                floor
        );


    }
}