    001/*
    002 * Forge Mod Loader
    003 * Copyright (c) 2012-2013 cpw.
    004 * All rights reserved. This program and the accompanying materials
    005 * are made available under the terms of the GNU Lesser Public License v2.1
    006 * which accompanies this distribution, and is available at
    007 * http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
    008 *
    009 * Contributors:
    010 *     cpw - implementation
    011 */
    012
    013package cpw.mods.fml.client.registry;
    014
    015import cpw.mods.fml.common.registry.GameRegistry;
    016import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
    017import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
    018import net.minecraft.tileentity.TileEntity;
    019
    020public class ClientRegistry
    021{
    022    /**
    023     *
    024     * Utility method for registering a tile entity and it's renderer at once - generally you should register them separately
    025     *
    026     * @param tileEntityClass
    027     * @param id
    028     * @param specialRenderer
    029     */
    030    public static void registerTileEntity(Class <? extends TileEntity > tileEntityClass, String id, TileEntitySpecialRenderer specialRenderer)
    031    {
    032        GameRegistry.registerTileEntity(tileEntityClass, id);
    033        bindTileEntitySpecialRenderer(tileEntityClass, specialRenderer);
    034    }
    035
    036    public static void bindTileEntitySpecialRenderer(Class <? extends TileEntity> tileEntityClass, TileEntitySpecialRenderer specialRenderer)
    037    {
    038        TileEntityRenderer.instance.specialRendererMap.put(tileEntityClass, specialRenderer);
    039        specialRenderer.setTileEntityRenderer(TileEntityRenderer.instance);
    040    }
    041}