2014-09-19 04:38:14 +02:00
|
|
|
package com.pahimar.ee3.client.renderer.tileentity;
|
|
|
|
|
2014-10-03 21:55:22 +02:00
|
|
|
import com.pahimar.ee3.api.Glyph;
|
2014-10-14 22:08:12 +02:00
|
|
|
import com.pahimar.ee3.client.util.RenderUtils;
|
2014-09-24 22:02:45 +02:00
|
|
|
import com.pahimar.ee3.tileentity.TileEntityAlchemyArray;
|
2014-10-03 21:55:22 +02:00
|
|
|
import cpw.mods.fml.client.FMLClientHandler;
|
2014-09-19 04:38:14 +02:00
|
|
|
import cpw.mods.fml.relauncher.Side;
|
|
|
|
import cpw.mods.fml.relauncher.SideOnly;
|
|
|
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
|
|
|
import net.minecraft.tileentity.TileEntity;
|
2014-10-07 22:20:41 +02:00
|
|
|
import net.minecraftforge.common.util.ForgeDirection;
|
2014-09-24 22:02:45 +02:00
|
|
|
import org.lwjgl.opengl.GL11;
|
2014-09-19 04:38:14 +02:00
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public class TileEntityRendererAlchemyArray extends TileEntitySpecialRenderer
|
|
|
|
{
|
|
|
|
@Override
|
|
|
|
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick)
|
|
|
|
{
|
2014-09-24 22:02:45 +02:00
|
|
|
if (tileEntity instanceof TileEntityAlchemyArray)
|
|
|
|
{
|
2014-10-03 21:55:22 +02:00
|
|
|
TileEntityAlchemyArray tileEntityAlchemyArray = (TileEntityAlchemyArray) FMLClientHandler.instance().getClient().theWorld.getTileEntity(tileEntity.xCoord, tileEntity.yCoord, tileEntity.zCoord);
|
2014-09-24 22:02:45 +02:00
|
|
|
|
2014-10-15 21:51:23 +02:00
|
|
|
int scale;
|
2014-10-21 21:59:00 +02:00
|
|
|
double xShift = 0.5d, yShift = 0.5d, zShift = 0.5d;
|
|
|
|
float xRotate = 0, yRotate = 0, zRotate = 0;
|
|
|
|
int rotationAngle = 0;
|
2014-10-15 21:51:23 +02:00
|
|
|
|
2014-09-25 22:23:45 +02:00
|
|
|
GL11.glDisable(GL11.GL_CULL_FACE);
|
|
|
|
GL11.glDisable(GL11.GL_LIGHTING);
|
2014-09-24 22:02:45 +02:00
|
|
|
GL11.glPushMatrix();
|
2014-10-14 22:08:12 +02:00
|
|
|
|
2014-10-15 21:51:23 +02:00
|
|
|
GL11.glDepthMask(false);
|
|
|
|
GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
|
2014-10-23 22:28:31 +02:00
|
|
|
for (Glyph glyph : tileEntityAlchemyArray.getGlyphs())
|
2014-09-24 22:02:45 +02:00
|
|
|
{
|
2014-10-15 21:51:23 +02:00
|
|
|
scale = glyph.getSize();
|
|
|
|
if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.UP)
|
|
|
|
{
|
|
|
|
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
|
|
|
|
{
|
|
|
|
rotationAngle = 0;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
|
|
|
|
{
|
|
|
|
rotationAngle = -90;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.SOUTH)
|
|
|
|
{
|
|
|
|
rotationAngle = 180;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.WEST)
|
|
|
|
{
|
|
|
|
rotationAngle = 90;
|
|
|
|
}
|
|
|
|
|
|
|
|
yShift = 0.001d;
|
|
|
|
xRotate = -1;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.DOWN)
|
|
|
|
{
|
|
|
|
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
|
|
|
|
{
|
|
|
|
rotationAngle = 0;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
|
|
|
|
{
|
|
|
|
rotationAngle = -90;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.SOUTH)
|
|
|
|
{
|
|
|
|
rotationAngle = 180;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.WEST)
|
|
|
|
{
|
|
|
|
rotationAngle = 90;
|
|
|
|
}
|
|
|
|
|
|
|
|
yShift = 0.999d;
|
|
|
|
xRotate = 1;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.NORTH)
|
|
|
|
{
|
|
|
|
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
|
|
|
|
{
|
|
|
|
rotationAngle = -90;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
|
|
|
|
{
|
|
|
|
rotationAngle = -180;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
|
|
|
|
{
|
|
|
|
rotationAngle = 90;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.WEST)
|
|
|
|
{
|
|
|
|
rotationAngle = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
zRotate = 1;
|
|
|
|
zShift = 0.999d;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.SOUTH)
|
|
|
|
{
|
|
|
|
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
|
|
|
|
{
|
|
|
|
rotationAngle = -90;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.EAST)
|
|
|
|
{
|
|
|
|
rotationAngle = 0;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
|
|
|
|
{
|
|
|
|
rotationAngle = 90;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.WEST)
|
|
|
|
{
|
|
|
|
rotationAngle = -180;
|
|
|
|
}
|
|
|
|
|
|
|
|
zRotate = -1;
|
|
|
|
zShift = 0.001d;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.EAST)
|
|
|
|
{
|
|
|
|
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
|
|
|
|
{
|
|
|
|
rotationAngle = 180;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
|
|
|
|
{
|
|
|
|
rotationAngle = 0;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
|
|
|
|
{
|
|
|
|
rotationAngle = -90;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.SOUTH)
|
|
|
|
{
|
|
|
|
rotationAngle = 90;
|
|
|
|
}
|
|
|
|
|
|
|
|
yRotate = 1;
|
|
|
|
xShift = 0.001d;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getOrientation() == ForgeDirection.WEST)
|
|
|
|
{
|
|
|
|
if (tileEntityAlchemyArray.getRotation() == ForgeDirection.UP)
|
|
|
|
{
|
|
|
|
rotationAngle = 180;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.DOWN)
|
|
|
|
{
|
|
|
|
rotationAngle = 0;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.NORTH)
|
|
|
|
{
|
|
|
|
rotationAngle = 90;
|
|
|
|
}
|
|
|
|
else if (tileEntityAlchemyArray.getRotation() == ForgeDirection.SOUTH)
|
|
|
|
{
|
|
|
|
rotationAngle = -90;
|
|
|
|
}
|
|
|
|
|
|
|
|
yRotate = -1;
|
|
|
|
xShift = 0.999d;
|
|
|
|
}
|
|
|
|
|
2014-10-14 22:08:12 +02:00
|
|
|
GL11.glPushMatrix();
|
2014-10-15 21:51:23 +02:00
|
|
|
GL11.glTranslated(x + xShift, y + yShift, z + zShift);
|
|
|
|
GL11.glScalef(1f * scale, 1f * scale, 1f * scale);
|
|
|
|
GL11.glRotatef(rotationAngle, tileEntityAlchemyArray.getOrientation().offsetX, tileEntityAlchemyArray.getOrientation().offsetY, tileEntityAlchemyArray.getOrientation().offsetZ);
|
|
|
|
GL11.glRotatef(90, xRotate, yRotate, zRotate);
|
2014-10-14 22:08:12 +02:00
|
|
|
RenderUtils.renderQuad(glyph.getTexture());
|
|
|
|
GL11.glPopMatrix();
|
2014-09-24 22:02:45 +02:00
|
|
|
}
|
2014-10-15 21:51:23 +02:00
|
|
|
GL11.glDepthMask(true);
|
2014-10-14 22:08:12 +02:00
|
|
|
|
2014-09-24 22:02:45 +02:00
|
|
|
GL11.glPopMatrix();
|
2014-09-25 22:23:45 +02:00
|
|
|
GL11.glEnable(GL11.GL_LIGHTING);
|
|
|
|
GL11.glEnable(GL11.GL_CULL_FACE);
|
2014-09-24 22:02:45 +02:00
|
|
|
}
|
2014-09-19 04:38:14 +02:00
|
|
|
}
|
|
|
|
}
|