package com.acethewildfire.acesbs;

import com.acethewildfire.acesbs.block.ModBlocks;
import com.acethewildfire.acesbs.entity.ModEntities;
import com.acethewildfire.acesbs.entity.client.CombustibleLemonModel;
import com.acethewildfire.acesbs.entity.client.CombustibleLemonRenderer;
import com.acethewildfire.acesbs.entity.client.FrenModel;
import com.acethewildfire.acesbs.entity.client.FrenRenderer;
import com.acethewildfire.acesbs.screen.ModScreenHandlers;
import com.acethewildfire.acesbs.screen.custom.EntropicEntanglerScreen;
import com.acethewildfire.acesbs.screen.custom.EntropicEvisceratorScreen;
import com.acethewildfire.acesbs.screen.custom.EntropicStabilizerScreen;
import com.acethewildfire.acesbs.util.ModModelPredicates;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.blockrenderlayer.v1.BlockRenderLayerMap;
import net.fabricmc.fabric.api.client.rendering.v1.EntityModelLayerRegistry;
import net.fabricmc.fabric.api.client.rendering.v1.EntityRendererRegistry;
import net.minecraft.client.gui.screen.ingame.HandledScreens;
import net.minecraft.client.render.RenderLayer;

public class AcesBSClient implements ClientModInitializer {
    @Override
    public void onInitializeClient() {
        BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.LEMONWOOD_DOOR, RenderLayer.getTranslucent());
        BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.LEMONWOOD_TRAPDOOR, RenderLayer.getTranslucent());
        BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.CRYSTAL_ENTROPY, RenderLayer.getTranslucent());
        BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.CRYSTAL_ENTROPY_PANE, RenderLayer.getTranslucent());
        BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.TOBACCO_CROP, RenderLayer.getCutout());
        BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.LEMONWOOD_SAPLING, RenderLayer.getCutout());
        BlockRenderLayerMap.INSTANCE.putBlock(ModBlocks.POTTED_LEMONWOOD_SAPLING, RenderLayer.getCutout());

        ModModelPredicates.registerModelPredicates();

        EntityModelLayerRegistry.registerModelLayer(FrenModel.FREN, FrenModel::getTexturedModelData);
        EntityRendererRegistry.register(ModEntities.FREN, FrenRenderer::new);

        EntityModelLayerRegistry.registerModelLayer(CombustibleLemonModel.C_LEMON, CombustibleLemonModel::getTexturedModelData);
        EntityRendererRegistry.register(ModEntities.C_LEMON, CombustibleLemonRenderer::new);

        HandledScreens.register(ModScreenHandlers.ENTROPIC_STABILIZER_SCREEN_HANDLER, EntropicStabilizerScreen::new);
        HandledScreens.register(ModScreenHandlers.ENTROPIC_EVISCERATOR_SCREEN_HANDLER, EntropicEvisceratorScreen::new);
        HandledScreens.register(ModScreenHandlers.ENTROPIC_ENTANGLER_SCREEN_HANDLER, EntropicEntanglerScreen::new);
    }
}
