59 lines
1.9 KiB
Java
59 lines
1.9 KiB
Java
/*******************************************************************************
|
|
* Copyright (c) 2012 cpw.
|
|
* All rights reserved. This program and the accompanying materials
|
|
* are made available under the terms of the GNU Public License v3.0
|
|
* which accompanies this distribution, and is available at
|
|
* http://www.gnu.org/licenses/gpl.html
|
|
*
|
|
* Contributors:
|
|
* cpw - initial API and implementation
|
|
******************************************************************************/
|
|
package cpw.mods.ironchest.client;
|
|
|
|
import java.util.Map;
|
|
|
|
import net.minecraft.client.renderer.ChestItemRenderHelper;
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
import net.minecraft.tileentity.TileEntity;
|
|
import net.minecraft.world.World;
|
|
import net.minecraftforge.client.MinecraftForgeClient;
|
|
import cpw.mods.fml.client.FMLClientHandler;
|
|
import cpw.mods.fml.client.registry.ClientRegistry;
|
|
import cpw.mods.ironchest.CommonProxy;
|
|
import cpw.mods.ironchest.IronChestType;
|
|
import cpw.mods.ironchest.TileEntityIronChest;
|
|
|
|
public class ClientProxy extends CommonProxy {
|
|
@Override
|
|
public void registerRenderInformation()
|
|
{
|
|
ChestItemRenderHelper.instance = new IronChestRenderHelper();
|
|
}
|
|
|
|
@Override
|
|
public void registerTileEntitySpecialRenderer(IronChestType typ)
|
|
{
|
|
ClientRegistry.bindTileEntitySpecialRenderer(typ.clazz, new TileEntityIronChestRenderer());
|
|
}
|
|
|
|
@Override
|
|
public World getClientWorld()
|
|
{
|
|
return FMLClientHandler.instance().getClient().theWorld;
|
|
}
|
|
|
|
@Override
|
|
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z)
|
|
{
|
|
TileEntity te = world.getBlockTileEntity(x, y, z);
|
|
if (te != null && te instanceof TileEntityIronChest)
|
|
{
|
|
return GUIChest.GUI.buildGUI(IronChestType.values()[ID], player.inventory, (TileEntityIronChest) te);
|
|
}
|
|
else
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
}
|