package studio.halbear.hem_custom.registry.EventHandlers;

import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.RenderTypeLookup;
import net.minecraft.client.renderer.entity.EntityRenderer;
import net.minecraft.client.renderer.entity.EntityRendererManager;
import net.minecraft.client.renderer.entity.MobRenderer;
import net.minecraft.entity.Entity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.fml.client.registry.RenderingRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
import net.minecraft.block.Block;
import studio.halbear.hem_custom.registry.ModEntities;
import studio.halbear.hem_custom.registry.ModStatics;
import studio.halbear.hem_custom.vehicles.Renderer.AeroplaneRenderer;
import studio.halbear.hem_custom.vehicles.Renderer.AirboatRenderer;

@Mod.EventBusSubscriber(modid = ModStatics.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD, value = Dist.CLIENT)
public class ClientEventHandler {
    @SafeVarargs
    public static void SetCollectionRenderType(RenderType type, RegistryObject<Block>... blocks_list) { //hal
        for (RegistryObject<Block> blockRegistryObject : blocks_list) {
            RenderTypeLookup.setRenderLayer(blockRegistryObject.get(), type);
        }
    }

    @SubscribeEvent
    public static void init(final FMLClientSetupEvent event) {
        RenderingRegistry.registerEntityRenderingHandler(ModEntities.AEROPLANE, AeroplaneRenderer::new);
        RenderingRegistry.registerEntityRenderingHandler(ModEntities.AIRBOAT, AirboatRenderer::new);
    }
}
