Search in sources :

Example 1 with RenderEngine

use of buildcraft.core.lib.engines.RenderEngine in project BuildCraft by BuildCraft.

the class CoreProxyClient method init.

@Override
public void init() {
    MinecraftForge.EVENT_BUS.register(RenderTickListener.INSTANCE);
    IResourceManager resourceManager = Minecraft.getMinecraft().getResourceManager();
    IReloadableResourceManager reloadable = (IReloadableResourceManager) resourceManager;
    reloadable.registerReloadListener(DetailedConfigOption.ReloadListener.INSTANCE);
    ClientRegistry.bindTileEntitySpecialRenderer(TileEngineBase.class, new RenderEngine());
    ClientRegistry.bindTileEntitySpecialRenderer(TilePathMarker.class, new RenderPathMarker());
    ClientRegistry.bindTileEntitySpecialRenderer(TileMarker.class, new RenderMarker());
    RenderingRegistry.registerEntityRenderingHandler(EntityResizableCuboid.class, RenderResizableCuboid.INSTANCE);
    RenderingRegistry.registerEntityRenderingHandler(EntityLaser.class, new RenderLaser());
    for (Block block : blocksToRegisterRenderersFor) {
        if (block instanceof IModelRegister) {
            ((IModelRegister) block).registerModels();
            continue;
        }
        IBlockState defaultState = block.getDefaultState();
        Multimap<Integer, IBlockState> metaStateMap = ArrayListMultimap.create();
        Map<IBlockState, String> stateTypeMap = Maps.newHashMap();
        for (IBlockState state : (List<IBlockState>) block.getBlockState().getValidStates()) {
            String type = BuildCraftStateMapper.getPropertyString(state);
            stateTypeMap.put(state, type);
            metaStateMap.put(block.damageDropped(state), state);
        }
        for (Entry<Integer, Collection<IBlockState>> entry : metaStateMap.asMap().entrySet()) {
            Collection<IBlockState> blockStates = entry.getValue();
            if (blockStates.isEmpty())
                continue;
            if (blockStates.contains(defaultState)) {
                registerBlockItemModel(defaultState, entry.getKey(), stateTypeMap.get(defaultState));
            } else {
                IBlockState state = blockStates.iterator().next();
                registerBlockItemModel(state, entry.getKey(), stateTypeMap.get(state));
            }
        }
    }
    for (Item item : itemsToRegisterRenderersFor) {
        if (item instanceof IModelRegister) {
            ((IModelRegister) item).registerModels();
        }
    }
}
Also used : RenderPathMarker(buildcraft.core.render.RenderPathMarker) IBlockState(net.minecraft.block.state.IBlockState) RenderLaser(buildcraft.core.render.RenderLaser) RenderMarker(buildcraft.core.render.RenderMarker) IModelRegister(buildcraft.core.lib.utils.IModelRegister) Item(net.minecraft.item.Item) IReloadableResourceManager(net.minecraft.client.resources.IReloadableResourceManager) Block(net.minecraft.block.Block) Collection(java.util.Collection) IResourceManager(net.minecraft.client.resources.IResourceManager) List(java.util.List) LinkedList(java.util.LinkedList) RenderEngine(buildcraft.core.lib.engines.RenderEngine)

Aggregations

RenderEngine (buildcraft.core.lib.engines.RenderEngine)1 IModelRegister (buildcraft.core.lib.utils.IModelRegister)1 RenderLaser (buildcraft.core.render.RenderLaser)1 RenderMarker (buildcraft.core.render.RenderMarker)1 RenderPathMarker (buildcraft.core.render.RenderPathMarker)1 Collection (java.util.Collection)1 LinkedList (java.util.LinkedList)1 List (java.util.List)1 Block (net.minecraft.block.Block)1 IBlockState (net.minecraft.block.state.IBlockState)1 IReloadableResourceManager (net.minecraft.client.resources.IReloadableResourceManager)1 IResourceManager (net.minecraft.client.resources.IResourceManager)1 Item (net.minecraft.item.Item)1