2012-11-28 16:33:34 +01:00
|
|
|
package mekanism.client;
|
|
|
|
|
2012-12-23 20:46:11 +01:00
|
|
|
import mekanism.common.BlockMachine.MachineType;
|
2013-07-20 18:10:14 +02:00
|
|
|
import mekanism.common.MekanismUtils.ResourceType;
|
2012-11-28 16:33:34 +01:00
|
|
|
import mekanism.common.Mekanism;
|
2013-07-20 18:10:14 +02:00
|
|
|
import mekanism.common.MekanismUtils;
|
2012-12-20 22:53:39 +01:00
|
|
|
import net.minecraft.block.Block;
|
2013-07-20 18:10:14 +02:00
|
|
|
import net.minecraft.client.Minecraft;
|
2013-04-13 02:25:21 +02:00
|
|
|
import net.minecraft.client.model.ModelChest;
|
2012-12-20 22:53:39 +01:00
|
|
|
import net.minecraft.client.renderer.RenderBlocks;
|
2012-12-23 20:46:11 +01:00
|
|
|
import net.minecraft.world.IBlockAccess;
|
2012-11-28 16:33:34 +01:00
|
|
|
|
2012-12-20 22:53:39 +01:00
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
|
2012-12-23 20:46:11 +01:00
|
|
|
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
2013-04-13 16:33:37 +02:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
2012-12-23 20:46:11 +01:00
|
|
|
|
2013-04-13 16:33:37 +02:00
|
|
|
@SideOnly(Side.CLIENT)
|
2013-05-20 00:43:01 +02:00
|
|
|
public class MachineRenderingHandler implements ISimpleBlockRenderingHandler
|
2012-11-28 16:33:34 +01:00
|
|
|
{
|
2012-12-23 20:46:11 +01:00
|
|
|
public ModelTheoreticalElementizer theoreticalElementizer = new ModelTheoreticalElementizer();
|
2013-04-05 22:26:48 +02:00
|
|
|
public ModelElectricPump electricPump = new ModelElectricPump();
|
|
|
|
public ModelMetallurgicInfuser metallurgicInfuser = new ModelMetallurgicInfuser();
|
2013-04-13 02:25:21 +02:00
|
|
|
public ModelChest electricChest = new ModelChest();
|
2013-05-20 00:43:01 +02:00
|
|
|
public ModelChargepad chargepad = new ModelChargepad();
|
2012-12-23 20:46:11 +01:00
|
|
|
|
2012-11-28 16:33:34 +01:00
|
|
|
@Override
|
2012-12-23 20:46:11 +01:00
|
|
|
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
|
2012-11-28 16:33:34 +01:00
|
|
|
{
|
2013-05-23 19:30:12 +02:00
|
|
|
if(block == null || renderer == null)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2012-12-23 20:46:11 +01:00
|
|
|
GL11.glPushMatrix();
|
|
|
|
GL11.glRotatef(90F, 0.0F, 1.0F, 0.0F);
|
|
|
|
|
|
|
|
if(block.blockID == Mekanism.machineBlockID)
|
|
|
|
{
|
|
|
|
if(metadata == MachineType.THEORETICAL_ELEMENTIZER.meta)
|
|
|
|
{
|
|
|
|
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
2013-02-22 04:03:54 +01:00
|
|
|
GL11.glRotatef(180F, 0.0F, -1.0F, 0.0F);
|
2013-05-20 00:43:01 +02:00
|
|
|
GL11.glTranslatef(0.0F, -0.8F, 0.0F);
|
2013-07-20 18:10:14 +02:00
|
|
|
Minecraft.getMinecraft().renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.RENDER, "TheoreticalElementizer.png"));
|
2013-02-22 04:03:54 +01:00
|
|
|
theoreticalElementizer.render(0.0560F);
|
2012-12-23 20:46:11 +01:00
|
|
|
}
|
2013-04-05 22:26:48 +02:00
|
|
|
else if(metadata == MachineType.ELECTRIC_PUMP.meta)
|
|
|
|
{
|
|
|
|
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
|
|
|
GL11.glRotatef(90F, 0.0F, -1.0F, 0.0F);
|
2013-05-20 00:43:01 +02:00
|
|
|
GL11.glTranslatef(0.0F, -0.85F, 0.0F);
|
2013-07-20 18:10:14 +02:00
|
|
|
Minecraft.getMinecraft().renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.RENDER, "ElectricPump.png"));
|
2013-04-05 22:26:48 +02:00
|
|
|
electricPump.render(0.0560F);
|
|
|
|
}
|
|
|
|
else if(metadata == MachineType.METALLURGIC_INFUSER.meta)
|
|
|
|
{
|
|
|
|
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
|
|
|
GL11.glRotatef(270F, 0.0F, -1.0F, 0.0F);
|
2013-05-20 00:43:01 +02:00
|
|
|
GL11.glTranslatef(0.0F, 0.3F, 0.0F);
|
2013-07-20 18:10:14 +02:00
|
|
|
Minecraft.getMinecraft().renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.RENDER, "MetallurgicInfuser.png"));
|
2013-04-05 22:26:48 +02:00
|
|
|
metallurgicInfuser.render(0.0625F);
|
|
|
|
}
|
2013-05-20 00:43:01 +02:00
|
|
|
else if(metadata == MachineType.CHARGEPAD.meta)
|
|
|
|
{
|
|
|
|
GL11.glRotatef(180F, 1.0F, 0.0F, 0.0F);
|
2013-05-21 19:34:16 +02:00
|
|
|
GL11.glTranslatef(0.0F, -1.1F, 0.0F);
|
2013-07-20 18:10:14 +02:00
|
|
|
Minecraft.getMinecraft().renderEngine.func_110577_a(MekanismUtils.getResource(ResourceType.RENDER, "Chargepad.png"));
|
2013-05-20 00:43:01 +02:00
|
|
|
chargepad.render(0.0625F);
|
|
|
|
}
|
2012-12-23 20:46:11 +01:00
|
|
|
else {
|
2013-05-28 06:29:29 +02:00
|
|
|
MekanismRenderer.renderItem(renderer, metadata, block);
|
2012-12-23 20:46:11 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
GL11.glPopMatrix();
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
|
|
|
{
|
|
|
|
if(block.blockID == Mekanism.machineBlockID)
|
|
|
|
{
|
|
|
|
int metadata = world.getBlockMetadata(x, y, z);
|
|
|
|
|
|
|
|
if(!MachineType.getFromMetadata(metadata).hasModel)
|
|
|
|
{
|
|
|
|
renderer.renderStandardBlock(block, x, y, z);
|
2013-01-21 02:15:59 +01:00
|
|
|
renderer.setRenderBoundsFromBlock(block);
|
2012-12-23 20:46:11 +01:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2012-11-28 16:33:34 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2012-12-23 20:46:11 +01:00
|
|
|
public boolean shouldRender3DInInventory()
|
2012-11-28 16:33:34 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2012-12-23 20:46:11 +01:00
|
|
|
public int getRenderId()
|
2012-11-28 16:33:34 +01:00
|
|
|
{
|
2013-04-28 21:23:08 +02:00
|
|
|
return ClientProxy.MACHINE_RENDER_ID;
|
2012-11-28 16:33:34 +01:00
|
|
|
}
|
|
|
|
}
|