2015-03-11 21:34:37 +01:00
|
|
|
package com.pahimar.ee3.client.renderer.tileentity;
|
|
|
|
|
|
|
|
import com.pahimar.ee3.client.renderer.model.ModelTransmutationTablet;
|
2015-03-19 02:52:53 +01:00
|
|
|
import com.pahimar.ee3.client.util.RenderUtils;
|
2015-03-11 21:34:37 +01:00
|
|
|
import com.pahimar.ee3.reference.Textures;
|
|
|
|
import com.pahimar.ee3.tileentity.TileEntityTransmutationTablet;
|
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
|
|
|
import net.minecraftforge.common.util.ForgeDirection;
|
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
import org.lwjgl.opengl.GL12;
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public class TileEntityRendererTransmutationTablet extends TileEntitySpecialRenderer
|
|
|
|
{
|
|
|
|
private final ModelTransmutationTablet modelTransmutationTablet = new ModelTransmutationTablet();
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
|
|
|
|
{
|
|
|
|
if (tileEntity instanceof TileEntityTransmutationTablet)
|
|
|
|
{
|
2015-03-19 04:33:09 +01:00
|
|
|
TileEntityTransmutationTablet tileEntityTransmutationTablet = (TileEntityTransmutationTablet) tileEntity;
|
|
|
|
|
2015-03-11 21:34:37 +01:00
|
|
|
this.bindTexture(Textures.Model.TRANSMUTATION_TABLET);
|
|
|
|
GL11.glPushMatrix();
|
|
|
|
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
2015-03-19 02:52:53 +01:00
|
|
|
GL11.glTranslatef((float) x, (float) y, (float) z);
|
|
|
|
GL11.glTranslatef(0.5F, -0.375F, 0.5F);
|
2015-03-19 04:33:09 +01:00
|
|
|
modelTransmutationTablet.renderBase(0.0625f);
|
|
|
|
if (tileEntityTransmutationTablet.isStructureValid())
|
|
|
|
{
|
|
|
|
modelTransmutationTablet.renderTransmutationPad(0.0625f);
|
|
|
|
}
|
2015-03-19 02:52:53 +01:00
|
|
|
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
|
|
|
GL11.glPopMatrix();
|
2015-03-11 21:34:37 +01:00
|
|
|
|
2015-03-19 04:33:09 +01:00
|
|
|
if (tileEntityTransmutationTablet.isStructureValid())
|
2015-03-19 02:52:53 +01:00
|
|
|
{
|
2015-03-19 04:33:09 +01:00
|
|
|
int rotationAngle = 0;
|
|
|
|
if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.NORTH)
|
|
|
|
{
|
|
|
|
rotationAngle = 0;
|
|
|
|
}
|
|
|
|
else if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.EAST)
|
|
|
|
{
|
|
|
|
rotationAngle = -90;
|
|
|
|
}
|
|
|
|
else if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.SOUTH)
|
|
|
|
{
|
|
|
|
rotationAngle = 180;
|
|
|
|
}
|
|
|
|
else if (tileEntityTransmutationTablet.getRotation() == ForgeDirection.WEST)
|
|
|
|
{
|
|
|
|
rotationAngle = 90;
|
|
|
|
}
|
2015-03-11 21:34:37 +01:00
|
|
|
|
2015-03-19 04:33:09 +01:00
|
|
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
|
|
|
GL11.glDisable(GL11.GL_LIGHTING);
|
|
|
|
GL11.glPushMatrix();
|
|
|
|
GL11.glDepthMask(false);
|
|
|
|
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
|
|
|
GL11.glPushMatrix();
|
|
|
|
GL11.glTranslated(x + 0.5d, y + 0.63d, z + 0.5d);
|
|
|
|
GL11.glScalef(2f, 2f, 2f);
|
|
|
|
GL11.glRotatef(rotationAngle, tileEntityTransmutationTablet.getOrientation().offsetX, tileEntityTransmutationTablet.getOrientation().offsetY, tileEntityTransmutationTablet.getOrientation().offsetZ);
|
|
|
|
GL11.glRotatef(90, -1, 0, 0);
|
|
|
|
RenderUtils.renderQuad(Textures.AlchemyArray.TRANSMUTATION_ALCHEMY_ARRAY);
|
|
|
|
GL11.glPopMatrix();
|
|
|
|
GL11.glDepthMask(true);
|
|
|
|
GL11.glPopMatrix();
|
|
|
|
GL11.glEnable(GL11.GL_LIGHTING);
|
|
|
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
|
|
|
}
|
2015-03-11 21:34:37 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|