2013-08-27 00:57:08 +02:00
|
|
|
package mekanism.client.render.block;
|
2013-02-22 04:03:54 +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.ModelTransmitter;
|
2013-10-23 03:13:23 +02:00
|
|
|
import mekanism.client.model.ModelTransmitter.Size;
|
2013-08-27 00:57:08 +02:00
|
|
|
import mekanism.common.util.MekanismUtils;
|
|
|
|
import mekanism.common.util.MekanismUtils.ResourceType;
|
2013-02-22 04:03:54 +01:00
|
|
|
import net.minecraft.block.Block;
|
2013-07-20 18:10:14 +02:00
|
|
|
import net.minecraft.client.Minecraft;
|
2013-02-22 04:03:54 +01:00
|
|
|
import net.minecraft.client.renderer.RenderBlocks;
|
|
|
|
import net.minecraft.world.IBlockAccess;
|
2013-08-01 00:22:48 +02:00
|
|
|
import net.minecraftforge.common.ForgeDirection;
|
2013-06-26 23:49:47 +02:00
|
|
|
|
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
|
2013-02-22 04:03:54 +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;
|
2013-02-22 04:03:54 +01:00
|
|
|
|
2013-04-13 16:33:37 +02:00
|
|
|
@SideOnly(Side.CLIENT)
|
2013-08-27 00:49:32 +02:00
|
|
|
public class TransmitterRenderingHandler implements ISimpleBlockRenderingHandler
|
2013-02-22 04:03:54 +01:00
|
|
|
{
|
2013-10-23 03:13:23 +02:00
|
|
|
public ModelTransmitter smallTransmitter = new ModelTransmitter(Size.SMALL);
|
|
|
|
public ModelTransmitter largeTransmitter = new ModelTransmitter(Size.LARGE);
|
2013-02-22 04:03:54 +01:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer)
|
|
|
|
{
|
|
|
|
GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
|
|
|
|
GL11.glRotatef(180F, 0.0F, -1.0F, 0.0F);
|
|
|
|
GL11.glTranslated(0.0F, -1.0F, 0.0F);
|
2013-08-01 00:22:48 +02:00
|
|
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
2013-03-25 17:00:45 +01:00
|
|
|
|
|
|
|
switch(metadata)
|
|
|
|
{
|
|
|
|
case 0:
|
2013-09-28 03:59:47 +02:00
|
|
|
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "PressurizedTube.png"));
|
2013-03-25 17:00:45 +01:00
|
|
|
break;
|
|
|
|
case 1:
|
2013-09-28 03:59:47 +02:00
|
|
|
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "UniversalCable.png"));
|
2013-03-25 17:00:45 +01:00
|
|
|
break;
|
2013-04-18 04:40:11 +02:00
|
|
|
case 2:
|
2013-09-28 03:59:47 +02:00
|
|
|
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "MechanicalPipe.png"));
|
2013-04-18 04:40:11 +02:00
|
|
|
break;
|
2013-08-06 05:58:44 +02:00
|
|
|
case 3:
|
2013-09-28 03:59:47 +02:00
|
|
|
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "LogisticalTransporter.png"));
|
2013-08-06 05:58:44 +02:00
|
|
|
break;
|
2013-10-29 23:13:30 +01:00
|
|
|
case 4:
|
|
|
|
Minecraft.getMinecraft().renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.RENDER, "RestrictiveTransporter.png"));
|
|
|
|
break;
|
2013-03-25 17:00:45 +01:00
|
|
|
}
|
|
|
|
|
2013-10-29 23:13:30 +01:00
|
|
|
if(metadata != 3 && metadata != 4)
|
2013-10-23 03:13:23 +02:00
|
|
|
{
|
|
|
|
smallTransmitter.renderSide(ForgeDirection.UP, true);
|
|
|
|
smallTransmitter.renderSide(ForgeDirection.DOWN, true);
|
|
|
|
smallTransmitter.renderCenter(new boolean[]{true, true, false, false, false, false});
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
largeTransmitter.renderSide(ForgeDirection.UP, true);
|
|
|
|
largeTransmitter.renderSide(ForgeDirection.DOWN, true);
|
|
|
|
largeTransmitter.renderCenter(new boolean[]{true, true, false, false, false, false});
|
|
|
|
}
|
2013-08-01 00:22:48 +02:00
|
|
|
|
|
|
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
2013-02-22 04:03:54 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
|
|
|
|
{
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean shouldRender3DInInventory()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public int getRenderId()
|
|
|
|
{
|
2013-03-25 17:00:45 +01:00
|
|
|
return ClientProxy.TRANSMITTER_RENDER_ID;
|
2013-02-22 04:03:54 +01:00
|
|
|
}
|
|
|
|
}
|