package dev.micle.firefly_bush_backport.data.client;

import dev.micle.firefly_bush_backport.FireflyBushBackport;
import dev.micle.firefly_bush_backport.block.ModBlocks;
import net.minecraft.data.DataGenerator;
import net.minecraft.world.level.block.Block;
import net.minecraftforge.client.model.generators.BlockStateProvider;
import net.minecraftforge.common.data.ExistingFileHelper;
import net.minecraftforge.registries.RegistryObject;

import java.util.Objects;

public class ModBlockStateProvider extends BlockStateProvider {
    public ModBlockStateProvider(DataGenerator generator, ExistingFileHelper existingFileHelper) {
        super(generator.getPackOutput(), FireflyBushBackport.MOD_ID, existingFileHelper);
    }

    @Override
    protected void registerStatesAndModels() {
        crossEmissiveBlock(ModBlocks.FIREFLY_BUSH);
    }

    private void crossEmissiveBlock(RegistryObject<Block> block) {
        String name = Objects.requireNonNull(block.getId()).getPath();
        simpleBlock(block.get(), models()
                .withExistingParent(name, "block/cross_emissive")
                .texture("cross", "block/" + name)
                .texture("cross_emissive", "block/" + name + "_emissive")
                .renderType("cutout")
        );
    }
}
