2013-08-27 00:57:08 +02:00
|
|
|
package mekanism.client.render.block;
|
2012-11-28 16:33:34 +01:00
|
|
|
|
2013-08-27 00:57:08 +02:00
|
|
|
import mekanism.client.ClientProxy;
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.client.model.ModelChargepad;
|
2013-11-03 17:38:36 +01:00
|
|
|
import mekanism.client.model.ModelCrusher;
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.client.model.ModelElectricPump;
|
2013-11-02 03:36:06 +01:00
|
|
|
import mekanism.client.model.ModelLogisticalSorter;
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.client.model.ModelMetallurgicInfuser;
|
2013-08-27 00:57:08 +02:00
|
|
|
import mekanism.client.render.MekanismRenderer;
|
2013-11-01 16:33:00 +01:00
|
|
|
import mekanism.common.Mekanism;
|
2013-08-27 00:49:32 +02:00
|
|
|
import mekanism.common.block.BlockMachine.MachineType;
|
2013-08-27 00:57:08 +02:00
|
|
|
import mekanism.common.util.MekanismUtils;
|
|
|
|
import mekanism.common.util.MekanismUtils.ResourceType;
|
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;
|
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
|
|
|
{
|
2013-04-05 22:26:48 +02:00
|
|
|
public ModelElectricPump electricPump = new ModelElectricPump();
|
|
|
|
public ModelMetallurgicInfuser metallurgicInfuser = new ModelMetallurgicInfuser();
|
2013-05-20 00:43:01 +02:00
|
|
|
public ModelChargepad chargepad = new ModelChargepad();
|
2013-11-02 03:36:06 +01:00
|
|
|
public ModelLogisticalSorter logisticalSorter = new ModelLogisticalSorter();
|
2013-11-03 17:38:36 +01:00
|
|
|
public ModelCrusher crusher = new ModelCrusher();
|
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-11-03 18:07:23 +01:00
|
|
|
if(block == null || renderer == null || MachineType.getFromMetadata(metadata) == null)
|
2013-05-23 19:30:12 +02:00
|
|
|
{
|
|
|
|
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)
|
|
|
|
{
|
2013-11-01 16:33:00 +01:00
|
|
|
if(metadata == MachineType.ELECTRIC_PUMP.meta)
|
2013-04-05 22:26:48 +02:00
|
|
|
{
|
|
|
|
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-09-28 03:59:47 +02:00
|
|
|
Minecraft.getMinecraft().renderEngine.bindTexture(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-11-03 02:07:55 +01:00
|
|
|
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
|
2013-09-28 03:59:47 +02:00
|
|
|
Minecraft.getMinecraft().renderEngine.bindTexture(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-09-28 03:59:47 +02:00
|
|
|
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "Chargepad.png"));
|
2013-05-20 00:43:01 +02:00
|
|
|
chargepad.render(0.0625F);
|
|
|
|
}
|
2013-11-02 03:36:06 +01:00
|
|
|
else if(metadata == MachineType.LOGISTICAL_SORTER.meta)
|
|
|
|
{
|
|
|
|
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
|
|
|
GL11.glRotatef(270F, 0.0F, -1.0F, 0.0F);
|
|
|
|
GL11.glTranslatef(0.0F, -0.85F, -0.15F);
|
|
|
|
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "LogisticalSorter.png"));
|
2013-11-02 04:51:10 +01:00
|
|
|
logisticalSorter.render(0.0625F, false);
|
2013-11-02 03:36:06 +01:00
|
|
|
}
|
2013-11-06 02:35:02 +01:00
|
|
|
/*else if(metadata == MachineType.CRUSHER.meta)
|
2013-11-03 17:38:36 +01:00
|
|
|
{
|
|
|
|
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
|
|
|
GL11.glRotatef(270F, 0.0F, -1.0F, 0.0F);
|
|
|
|
GL11.glTranslatef(0.0F, -1.0F, 0.0F);
|
|
|
|
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "Crusher.png"));
|
|
|
|
crusher.render(0.0625F, 0.0F);
|
2013-11-06 02:35:02 +01:00
|
|
|
} TODO model */
|
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);
|
|
|
|
|
2013-11-03 18:07:23 +01:00
|
|
|
if(MachineType.getFromMetadata(metadata) != null && !MachineType.getFromMetadata(metadata).hasModel)
|
2012-12-23 20:46:11 +01:00
|
|
|
{
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|