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.modloader;
014
015import net.minecraft.block.Block;
016import net.minecraft.client.renderer.RenderBlocks;
017import net.minecraft.src.BaseMod;
018import net.minecraft.world.IBlockAccess;
019import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
020
021/**
022 * @author cpw
023 *
024 */
025public class ModLoaderBlockRendererHandler implements ISimpleBlockRenderingHandler
026{
027    private int renderId;
028    private boolean render3dInInventory;
029    private BaseMod mod;
030
031    /**
032     * @param mod
033     *
034     */
035    public ModLoaderBlockRendererHandler(int renderId, boolean render3dInInventory, BaseMod mod)
036    {
037        this.renderId=renderId;
038        this.render3dInInventory=render3dInInventory;
039        this.mod=mod;
040    }
041
042    @Override
043    public int getRenderId()
044    {
045        return renderId;
046    }
047
048    @Override
049    public boolean shouldRender3DInInventory()
050    {
051        return render3dInInventory;
052    }
053
054    /**
055     * @param world
056     * @param x
057     * @param y
058     * @param z
059     * @param block
060     * @param modelId
061     * @param renderer
062     */
063    @Override
064    public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
065    {
066        return mod.renderWorldBlock(renderer, world, x, y, z, block, modelId);
067    }
068
069    /**
070     * @param block
071     * @param metadata
072     * @param modelID
073     * @param renderer
074     */
075    @Override
076    public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
077    {
078        mod.renderInvBlock(renderer, block, metadata, modelID);
079    }
080
081}