equivalent-exchange-3/ee3_common/com/pahimar/ee3/client/renderer/tileentity/TileEntityAludelRenderer.java

79 lines
2.4 KiB
Java
Raw Normal View History

2013-02-18 03:30:11 +01:00
package com.pahimar.ee3.client.renderer.tileentity;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
2013-04-16 22:06:30 +02:00
import net.minecraftforge.common.ForgeDirection;
2013-02-18 03:30:11 +01:00
import org.lwjgl.opengl.GL11;
2013-02-18 03:30:11 +01:00
import com.pahimar.ee3.client.model.ModelAludel;
2013-04-16 22:06:30 +02:00
import com.pahimar.ee3.lib.Textures;
2013-02-18 03:30:11 +01:00
import com.pahimar.ee3.tileentity.TileAludel;
2013-04-16 22:06:30 +02:00
import cpw.mods.fml.client.FMLClientHandler;
2013-02-19 02:13:24 +01:00
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* TileEntityAludelRenderer
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
2013-02-19 02:13:24 +01:00
@SideOnly(Side.CLIENT)
2013-02-18 03:30:11 +01:00
public class TileEntityAludelRenderer extends TileEntitySpecialRenderer {
private ModelAludel modelAludel = new ModelAludel();
2013-02-18 03:30:11 +01:00
@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
2013-04-16 22:06:30 +02:00
if (tileEntity instanceof TileAludel) {
2013-04-16 22:06:30 +02:00
TileAludel tileAludel = (TileAludel) tileEntity;
2013-04-16 22:06:30 +02:00
GL11.glPushMatrix();
GL11.glDisable(GL11.GL_LIGHTING);
// Scale, Translate, Rotate
scaleTranslateRotate(x, y, z, tileAludel.getOrientation());
// Bind texture
FMLClientHandler.instance().getClient().renderEngine.bindTexture(Textures.MODEL_ALUDEL);
// Render
modelAludel.render();
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glPopMatrix();
}
2013-02-18 03:30:11 +01:00
}
2013-04-16 22:06:30 +02:00
private void scaleTranslateRotate(double x, double y, double z, ForgeDirection orientation) {
if (orientation == ForgeDirection.NORTH) {
GL11.glTranslated(x + 1, y, z);
GL11.glRotatef(180F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
}
else if (orientation == ForgeDirection.EAST) {
GL11.glTranslated(x + 1, y, z + 1);
GL11.glRotatef(90F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
}
else if (orientation == ForgeDirection.SOUTH) {
GL11.glTranslated(x, y, z + 1);
GL11.glRotatef(0F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
}
else if (orientation == ForgeDirection.WEST) {
GL11.glTranslated(x, y, z);
GL11.glRotatef(-90F, 0F, 1F, 0F);
GL11.glRotatef(-90F, 1F, 0F, 0F);
}
}
2013-02-18 03:30:11 +01:00
}