package net.minecraft.client.renderer;

import net.minecraft.Util;
import com.google.common.collect.Maps;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.material.Fluids;
import java.util.HashMap;
import net.minecraft.world.level.material.FluidState;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.client.Minecraft;
import net.minecraft.world.level.block.LeavesBlock;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Fluid;
import net.minecraft.world.level.block.Block;
import java.util.Map;

public class ItemBlockRenderTypes {
    private static final Map<Block, RenderType> TYPE_BY_BLOCK;
    private static final Map<Fluid, RenderType> TYPE_BY_FLUID;
    private static boolean renderCutout;
    
    public static RenderType getChunkRenderType(final BlockState cfj) {
        final Block bvr2 = cfj.getBlock();
        if (bvr2 instanceof LeavesBlock) {
            return ItemBlockRenderTypes.renderCutout ? RenderType.cutoutMipped() : RenderType.solid();
        }
        final RenderType ech3 = ItemBlockRenderTypes.TYPE_BY_BLOCK.get(bvr2);
        if (ech3 != null) {
            return ech3;
        }
        return RenderType.solid();
    }
    
    public static RenderType getMovingBlockRenderType(final BlockState cfj) {
        final Block bvr2 = cfj.getBlock();
        if (bvr2 instanceof LeavesBlock) {
            return ItemBlockRenderTypes.renderCutout ? RenderType.cutoutMipped() : RenderType.solid();
        }
        final RenderType ech3 = ItemBlockRenderTypes.TYPE_BY_BLOCK.get(bvr2);
        if (ech3 == null) {
            return RenderType.solid();
        }
        if (ech3 == RenderType.translucent()) {
            return RenderType.translucentMovingBlock();
        }
        return ech3;
    }
    
    public static RenderType getRenderType(final BlockState cfj, final boolean boolean2) {
        final RenderType ech3 = getChunkRenderType(cfj);
        if (ech3 != RenderType.translucent()) {
            return Sheets.cutoutBlockSheet();
        }
        if (!Minecraft.useShaderTransparency()) {
            return Sheets.translucentCullBlockSheet();
        }
        return boolean2 ? Sheets.translucentCullBlockSheet() : Sheets.translucentItemSheet();
    }
    
    public static RenderType getRenderType(final ItemStack bki, final boolean boolean2) {
        final Item bke3 = bki.getItem();
        if (bke3 instanceof BlockItem) {
            final Block bvr4 = ((BlockItem)bke3).getBlock();
            return getRenderType(bvr4.defaultBlockState(), boolean2);
        }
        return boolean2 ? Sheets.translucentCullBlockSheet() : Sheets.translucentItemSheet();
    }
    
    public static RenderType getRenderLayer(final FluidState cxa) {
        final RenderType ech2 = ItemBlockRenderTypes.TYPE_BY_FLUID.get(cxa.getType());
        if (ech2 != null) {
            return ech2;
        }
        return RenderType.solid();
    }
    
    public static void setFancy(final boolean boolean1) {
        ItemBlockRenderTypes.renderCutout = boolean1;
    }
    
    static {
        final RenderType ech2;
        final RenderType ech3;
        final RenderType ech4;
        final RenderType ech5;
        TYPE_BY_BLOCK = Util.<Map<Block, RenderType>>make(Maps.newHashMap(), hashMap -> {
            ech2 = RenderType.tripwire();
            hashMap.put(Blocks.TRIPWIRE, ech2);
            ech3 = RenderType.cutoutMipped();
            hashMap.put(Blocks.GRASS_BLOCK, ech3);
            hashMap.put(Blocks.IRON_BARS, ech3);
            hashMap.put(Blocks.GLASS_PANE, ech3);
            hashMap.put(Blocks.TRIPWIRE_HOOK, ech3);
            hashMap.put(Blocks.HOPPER, ech3);
            hashMap.put(Blocks.CHAIN, ech3);
            hashMap.put(Blocks.JUNGLE_LEAVES, ech3);
            hashMap.put(Blocks.OAK_LEAVES, ech3);
            hashMap.put(Blocks.SPRUCE_LEAVES, ech3);
            hashMap.put(Blocks.ACACIA_LEAVES, ech3);
            hashMap.put(Blocks.BIRCH_LEAVES, ech3);
            hashMap.put(Blocks.DARK_OAK_LEAVES, ech3);
            ech4 = RenderType.cutout();
            hashMap.put(Blocks.OAK_SAPLING, ech4);
            hashMap.put(Blocks.SPRUCE_SAPLING, ech4);
            hashMap.put(Blocks.BIRCH_SAPLING, ech4);
            hashMap.put(Blocks.JUNGLE_SAPLING, ech4);
            hashMap.put(Blocks.ACACIA_SAPLING, ech4);
            hashMap.put(Blocks.DARK_OAK_SAPLING, ech4);
            hashMap.put(Blocks.GLASS, ech4);
            hashMap.put(Blocks.WHITE_BED, ech4);
            hashMap.put(Blocks.ORANGE_BED, ech4);
            hashMap.put(Blocks.MAGENTA_BED, ech4);
            hashMap.put(Blocks.LIGHT_BLUE_BED, ech4);
            hashMap.put(Blocks.YELLOW_BED, ech4);
            hashMap.put(Blocks.LIME_BED, ech4);
            hashMap.put(Blocks.PINK_BED, ech4);
            hashMap.put(Blocks.GRAY_BED, ech4);
            hashMap.put(Blocks.LIGHT_GRAY_BED, ech4);
            hashMap.put(Blocks.CYAN_BED, ech4);
            hashMap.put(Blocks.PURPLE_BED, ech4);
            hashMap.put(Blocks.BLUE_BED, ech4);
            hashMap.put(Blocks.BROWN_BED, ech4);
            hashMap.put(Blocks.GREEN_BED, ech4);
            hashMap.put(Blocks.RED_BED, ech4);
            hashMap.put(Blocks.BLACK_BED, ech4);
            hashMap.put(Blocks.POWERED_RAIL, ech4);
            hashMap.put(Blocks.DETECTOR_RAIL, ech4);
            hashMap.put(Blocks.COBWEB, ech4);
            hashMap.put(Blocks.GRASS, ech4);
            hashMap.put(Blocks.FERN, ech4);
            hashMap.put(Blocks.DEAD_BUSH, ech4);
            hashMap.put(Blocks.SEAGRASS, ech4);
            hashMap.put(Blocks.TALL_SEAGRASS, ech4);
            hashMap.put(Blocks.DANDELION, ech4);
            hashMap.put(Blocks.POPPY, ech4);
            hashMap.put(Blocks.BLUE_ORCHID, ech4);
            hashMap.put(Blocks.ALLIUM, ech4);
            hashMap.put(Blocks.AZURE_BLUET, ech4);
            hashMap.put(Blocks.RED_TULIP, ech4);
            hashMap.put(Blocks.ORANGE_TULIP, ech4);
            hashMap.put(Blocks.WHITE_TULIP, ech4);
            hashMap.put(Blocks.PINK_TULIP, ech4);
            hashMap.put(Blocks.OXEYE_DAISY, ech4);
            hashMap.put(Blocks.CORNFLOWER, ech4);
            hashMap.put(Blocks.WITHER_ROSE, ech4);
            hashMap.put(Blocks.LILY_OF_THE_VALLEY, ech4);
            hashMap.put(Blocks.BROWN_MUSHROOM, ech4);
            hashMap.put(Blocks.RED_MUSHROOM, ech4);
            hashMap.put(Blocks.TORCH, ech4);
            hashMap.put(Blocks.WALL_TORCH, ech4);
            hashMap.put(Blocks.SOUL_TORCH, ech4);
            hashMap.put(Blocks.SOUL_WALL_TORCH, ech4);
            hashMap.put(Blocks.FIRE, ech4);
            hashMap.put(Blocks.SOUL_FIRE, ech4);
            hashMap.put(Blocks.SPAWNER, ech4);
            hashMap.put(Blocks.REDSTONE_WIRE, ech4);
            hashMap.put(Blocks.WHEAT, ech4);
            hashMap.put(Blocks.OAK_DOOR, ech4);
            hashMap.put(Blocks.LADDER, ech4);
            hashMap.put(Blocks.RAIL, ech4);
            hashMap.put(Blocks.IRON_DOOR, ech4);
            hashMap.put(Blocks.REDSTONE_TORCH, ech4);
            hashMap.put(Blocks.REDSTONE_WALL_TORCH, ech4);
            hashMap.put(Blocks.CACTUS, ech4);
            hashMap.put(Blocks.SUGAR_CANE, ech4);
            hashMap.put(Blocks.REPEATER, ech4);
            hashMap.put(Blocks.OAK_TRAPDOOR, ech4);
            hashMap.put(Blocks.SPRUCE_TRAPDOOR, ech4);
            hashMap.put(Blocks.BIRCH_TRAPDOOR, ech4);
            hashMap.put(Blocks.JUNGLE_TRAPDOOR, ech4);
            hashMap.put(Blocks.ACACIA_TRAPDOOR, ech4);
            hashMap.put(Blocks.DARK_OAK_TRAPDOOR, ech4);
            hashMap.put(Blocks.CRIMSON_TRAPDOOR, ech4);
            hashMap.put(Blocks.WARPED_TRAPDOOR, ech4);
            hashMap.put(Blocks.ATTACHED_PUMPKIN_STEM, ech4);
            hashMap.put(Blocks.ATTACHED_MELON_STEM, ech4);
            hashMap.put(Blocks.PUMPKIN_STEM, ech4);
            hashMap.put(Blocks.MELON_STEM, ech4);
            hashMap.put(Blocks.VINE, ech4);
            hashMap.put(Blocks.LILY_PAD, ech4);
            hashMap.put(Blocks.NETHER_WART, ech4);
            hashMap.put(Blocks.BREWING_STAND, ech4);
            hashMap.put(Blocks.COCOA, ech4);
            hashMap.put(Blocks.BEACON, ech4);
            hashMap.put(Blocks.FLOWER_POT, ech4);
            hashMap.put(Blocks.POTTED_OAK_SAPLING, ech4);
            hashMap.put(Blocks.POTTED_SPRUCE_SAPLING, ech4);
            hashMap.put(Blocks.POTTED_BIRCH_SAPLING, ech4);
            hashMap.put(Blocks.POTTED_JUNGLE_SAPLING, ech4);
            hashMap.put(Blocks.POTTED_ACACIA_SAPLING, ech4);
            hashMap.put(Blocks.POTTED_DARK_OAK_SAPLING, ech4);
            hashMap.put(Blocks.POTTED_FERN, ech4);
            hashMap.put(Blocks.POTTED_DANDELION, ech4);
            hashMap.put(Blocks.POTTED_POPPY, ech4);
            hashMap.put(Blocks.POTTED_BLUE_ORCHID, ech4);
            hashMap.put(Blocks.POTTED_ALLIUM, ech4);
            hashMap.put(Blocks.POTTED_AZURE_BLUET, ech4);
            hashMap.put(Blocks.POTTED_RED_TULIP, ech4);
            hashMap.put(Blocks.POTTED_ORANGE_TULIP, ech4);
            hashMap.put(Blocks.POTTED_WHITE_TULIP, ech4);
            hashMap.put(Blocks.POTTED_PINK_TULIP, ech4);
            hashMap.put(Blocks.POTTED_OXEYE_DAISY, ech4);
            hashMap.put(Blocks.POTTED_CORNFLOWER, ech4);
            hashMap.put(Blocks.POTTED_LILY_OF_THE_VALLEY, ech4);
            hashMap.put(Blocks.POTTED_WITHER_ROSE, ech4);
            hashMap.put(Blocks.POTTED_RED_MUSHROOM, ech4);
            hashMap.put(Blocks.POTTED_BROWN_MUSHROOM, ech4);
            hashMap.put(Blocks.POTTED_DEAD_BUSH, ech4);
            hashMap.put(Blocks.POTTED_CACTUS, ech4);
            hashMap.put(Blocks.CARROTS, ech4);
            hashMap.put(Blocks.POTATOES, ech4);
            hashMap.put(Blocks.COMPARATOR, ech4);
            hashMap.put(Blocks.ACTIVATOR_RAIL, ech4);
            hashMap.put(Blocks.IRON_TRAPDOOR, ech4);
            hashMap.put(Blocks.SUNFLOWER, ech4);
            hashMap.put(Blocks.LILAC, ech4);
            hashMap.put(Blocks.ROSE_BUSH, ech4);
            hashMap.put(Blocks.PEONY, ech4);
            hashMap.put(Blocks.TALL_GRASS, ech4);
            hashMap.put(Blocks.LARGE_FERN, ech4);
            hashMap.put(Blocks.SPRUCE_DOOR, ech4);
            hashMap.put(Blocks.BIRCH_DOOR, ech4);
            hashMap.put(Blocks.JUNGLE_DOOR, ech4);
            hashMap.put(Blocks.ACACIA_DOOR, ech4);
            hashMap.put(Blocks.DARK_OAK_DOOR, ech4);
            hashMap.put(Blocks.END_ROD, ech4);
            hashMap.put(Blocks.CHORUS_PLANT, ech4);
            hashMap.put(Blocks.CHORUS_FLOWER, ech4);
            hashMap.put(Blocks.BEETROOTS, ech4);
            hashMap.put(Blocks.KELP, ech4);
            hashMap.put(Blocks.KELP_PLANT, ech4);
            hashMap.put(Blocks.TURTLE_EGG, ech4);
            hashMap.put(Blocks.DEAD_TUBE_CORAL, ech4);
            hashMap.put(Blocks.DEAD_BRAIN_CORAL, ech4);
            hashMap.put(Blocks.DEAD_BUBBLE_CORAL, ech4);
            hashMap.put(Blocks.DEAD_FIRE_CORAL, ech4);
            hashMap.put(Blocks.DEAD_HORN_CORAL, ech4);
            hashMap.put(Blocks.TUBE_CORAL, ech4);
            hashMap.put(Blocks.BRAIN_CORAL, ech4);
            hashMap.put(Blocks.BUBBLE_CORAL, ech4);
            hashMap.put(Blocks.FIRE_CORAL, ech4);
            hashMap.put(Blocks.HORN_CORAL, ech4);
            hashMap.put(Blocks.DEAD_TUBE_CORAL_FAN, ech4);
            hashMap.put(Blocks.DEAD_BRAIN_CORAL_FAN, ech4);
            hashMap.put(Blocks.DEAD_BUBBLE_CORAL_FAN, ech4);
            hashMap.put(Blocks.DEAD_FIRE_CORAL_FAN, ech4);
            hashMap.put(Blocks.DEAD_HORN_CORAL_FAN, ech4);
            hashMap.put(Blocks.TUBE_CORAL_FAN, ech4);
            hashMap.put(Blocks.BRAIN_CORAL_FAN, ech4);
            hashMap.put(Blocks.BUBBLE_CORAL_FAN, ech4);
            hashMap.put(Blocks.FIRE_CORAL_FAN, ech4);
            hashMap.put(Blocks.HORN_CORAL_FAN, ech4);
            hashMap.put(Blocks.DEAD_TUBE_CORAL_WALL_FAN, ech4);
            hashMap.put(Blocks.DEAD_BRAIN_CORAL_WALL_FAN, ech4);
            hashMap.put(Blocks.DEAD_BUBBLE_CORAL_WALL_FAN, ech4);
            hashMap.put(Blocks.DEAD_FIRE_CORAL_WALL_FAN, ech4);
            hashMap.put(Blocks.DEAD_HORN_CORAL_WALL_FAN, ech4);
            hashMap.put(Blocks.TUBE_CORAL_WALL_FAN, ech4);
            hashMap.put(Blocks.BRAIN_CORAL_WALL_FAN, ech4);
            hashMap.put(Blocks.BUBBLE_CORAL_WALL_FAN, ech4);
            hashMap.put(Blocks.FIRE_CORAL_WALL_FAN, ech4);
            hashMap.put(Blocks.HORN_CORAL_WALL_FAN, ech4);
            hashMap.put(Blocks.SEA_PICKLE, ech4);
            hashMap.put(Blocks.CONDUIT, ech4);
            hashMap.put(Blocks.BAMBOO_SAPLING, ech4);
            hashMap.put(Blocks.BAMBOO, ech4);
            hashMap.put(Blocks.POTTED_BAMBOO, ech4);
            hashMap.put(Blocks.SCAFFOLDING, ech4);
            hashMap.put(Blocks.STONECUTTER, ech4);
            hashMap.put(Blocks.LANTERN, ech4);
            hashMap.put(Blocks.SOUL_LANTERN, ech4);
            hashMap.put(Blocks.CAMPFIRE, ech4);
            hashMap.put(Blocks.SOUL_CAMPFIRE, ech4);
            hashMap.put(Blocks.SWEET_BERRY_BUSH, ech4);
            hashMap.put(Blocks.WEEPING_VINES, ech4);
            hashMap.put(Blocks.WEEPING_VINES_PLANT, ech4);
            hashMap.put(Blocks.TWISTING_VINES, ech4);
            hashMap.put(Blocks.TWISTING_VINES_PLANT, ech4);
            hashMap.put(Blocks.NETHER_SPROUTS, ech4);
            hashMap.put(Blocks.CRIMSON_FUNGUS, ech4);
            hashMap.put(Blocks.WARPED_FUNGUS, ech4);
            hashMap.put(Blocks.CRIMSON_ROOTS, ech4);
            hashMap.put(Blocks.WARPED_ROOTS, ech4);
            hashMap.put(Blocks.POTTED_CRIMSON_FUNGUS, ech4);
            hashMap.put(Blocks.POTTED_WARPED_FUNGUS, ech4);
            hashMap.put(Blocks.POTTED_CRIMSON_ROOTS, ech4);
            hashMap.put(Blocks.POTTED_WARPED_ROOTS, ech4);
            hashMap.put(Blocks.CRIMSON_DOOR, ech4);
            hashMap.put(Blocks.WARPED_DOOR, ech4);
            ech5 = RenderType.translucent();
            hashMap.put(Blocks.ICE, ech5);
            hashMap.put(Blocks.NETHER_PORTAL, ech5);
            hashMap.put(Blocks.WHITE_STAINED_GLASS, ech5);
            hashMap.put(Blocks.ORANGE_STAINED_GLASS, ech5);
            hashMap.put(Blocks.MAGENTA_STAINED_GLASS, ech5);
            hashMap.put(Blocks.LIGHT_BLUE_STAINED_GLASS, ech5);
            hashMap.put(Blocks.YELLOW_STAINED_GLASS, ech5);
            hashMap.put(Blocks.LIME_STAINED_GLASS, ech5);
            hashMap.put(Blocks.PINK_STAINED_GLASS, ech5);
            hashMap.put(Blocks.GRAY_STAINED_GLASS, ech5);
            hashMap.put(Blocks.LIGHT_GRAY_STAINED_GLASS, ech5);
            hashMap.put(Blocks.CYAN_STAINED_GLASS, ech5);
            hashMap.put(Blocks.PURPLE_STAINED_GLASS, ech5);
            hashMap.put(Blocks.BLUE_STAINED_GLASS, ech5);
            hashMap.put(Blocks.BROWN_STAINED_GLASS, ech5);
            hashMap.put(Blocks.GREEN_STAINED_GLASS, ech5);
            hashMap.put(Blocks.RED_STAINED_GLASS, ech5);
            hashMap.put(Blocks.BLACK_STAINED_GLASS, ech5);
            hashMap.put(Blocks.WHITE_STAINED_GLASS_PANE, ech5);
            hashMap.put(Blocks.ORANGE_STAINED_GLASS_PANE, ech5);
            hashMap.put(Blocks.MAGENTA_STAINED_GLASS_PANE, ech5);
            hashMap.put(Blocks.LIGHT_BLUE_STAINED_GLASS_PANE, ech5);
            hashMap.put(Blocks.YELLOW_STAINED_GLASS_PANE, ech5);
            hashMap.put(Blocks.LIME_STAINED_GLASS_PANE, ech5);
            hashMap.put(Blocks.PINK_STAINED_GLASS_PANE, ech5);
            hashMap.put(Blocks.GRAY_STAINED_GLASS_PANE, ech5);
            hashMap.put(Blocks.LIGHT_GRAY_STAINED_GLASS_PANE, ech5);
            hashMap.put(Blocks.CYAN_STAINED_GLASS_PANE, ech5);
            hashMap.put(Blocks.PURPLE_STAINED_GLASS_PANE, ech5);
            hashMap.put(Blocks.BLUE_STAINED_GLASS_PANE, ech5);
            hashMap.put(Blocks.BROWN_STAINED_GLASS_PANE, ech5);
            hashMap.put(Blocks.GREEN_STAINED_GLASS_PANE, ech5);
            hashMap.put(Blocks.RED_STAINED_GLASS_PANE, ech5);
            hashMap.put(Blocks.BLACK_STAINED_GLASS_PANE, ech5);
            hashMap.put(Blocks.SLIME_BLOCK, ech5);
            hashMap.put(Blocks.HONEY_BLOCK, ech5);
            hashMap.put(Blocks.FROSTED_ICE, ech5);
            hashMap.put(Blocks.BUBBLE_COLUMN, ech5);
            return;
        });
        final RenderType ech6;
        TYPE_BY_FLUID = Util.<Map<Fluid, RenderType>>make(Maps.newHashMap(), hashMap -> {
            ech6 = RenderType.translucent();
            hashMap.put(Fluids.FLOWING_WATER, ech6);
            hashMap.put(Fluids.WATER, ech6);
        });
    }
}
