001 /*
002 * The FML Forge Mod Loader suite.
003 * Copyright (C) 2012 cpw
004 *
005 * This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
006 * Software Foundation; either version 2.1 of the License, or any later version.
007 *
008 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
009 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
010 *
011 * You should have received a copy of the GNU Lesser General Public License along with this library; if not, write to the Free Software Foundation, Inc., 51
012 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
013 */
014
015 package cpw.mods.fml.client.modloader;
016
017 import net.minecraft.block.Block;
018 import net.minecraft.client.renderer.RenderBlocks;
019 import net.minecraft.src.BaseMod;
020 import net.minecraft.world.IBlockAccess;
021 import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
022
023 /**
024 * @author cpw
025 *
026 */
027 public class ModLoaderBlockRendererHandler implements ISimpleBlockRenderingHandler
028 {
029 private int renderId;
030 private boolean render3dInInventory;
031 private BaseMod mod;
032
033 /**
034 * @param mod
035 *
036 */
037 public ModLoaderBlockRendererHandler(int renderId, boolean render3dInInventory, BaseMod mod)
038 {
039 this.renderId=renderId;
040 this.render3dInInventory=render3dInInventory;
041 this.mod=mod;
042 }
043
044 @Override
045 public int getRenderId()
046 {
047 return renderId;
048 }
049
050 @Override
051 public boolean shouldRender3DInInventory()
052 {
053 return render3dInInventory;
054 }
055
056 /**
057 * @param world
058 * @param x
059 * @param y
060 * @param z
061 * @param block
062 * @param modelId
063 * @param renderer
064 */
065 @Override
066 public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
067 {
068 return mod.renderWorldBlock(renderer, world, x, y, z, block, modelId);
069 }
070
071 /**
072 * @param block
073 * @param metadata
074 * @param modelID
075 * @param renderer
076 */
077 @Override
078 public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
079 {
080 mod.renderInvBlock(renderer, block, metadata, modelID);
081 }
082
083 }