use of club.nsdn.nyasamarailway.tileblock.signal.deco.BlockGlassShield1X1 in project NyaSamaRailway by NSDN.
the class GlassShieldRenderer method renderTileEntityAt.
public void renderTileEntityAt(TileEntity te, double x, double y, double z, float scale) {
GL11.glPushMatrix();
GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
RenderHelper.disableStandardItemLighting();
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
GL11.glEnable(GL11.GL_BLEND);
GL11.glDisable(GL11.GL_CULL_FACE);
if (Minecraft.isAmbientOcclusionEnabled()) {
GL11.glShadeModel(GL11.GL_SMOOTH);
} else {
GL11.glShadeModel(GL11.GL_FLAT);
}
Tessellator.instance.setColorOpaque_F(1.0F, 1.0F, 1.0F);
int meta = te.getWorldObj().getBlockMetadata(te.xCoord, te.yCoord, te.zCoord);
int angle = (meta & 0x3) * 90;
if (te instanceof TileEntityGlassShieldBase) {
TileEntityGlassShieldBase glassShield = (TileEntityGlassShieldBase) te;
switch(renderType) {
case SHIELD:
MOVE_DIST = 1.0F - (1.0F / 16.0F);
doInterpolation(te);
GL11.glPushMatrix();
GL11.glRotatef(angle, 0.0F, -1.0F, 0.0F);
GL11.glPushMatrix();
GL11.glTranslatef(glassShield.prevDist, 0.0F, 0.0F);
RendererHelper.renderWithResource(modelMain[MODEL_NORMAL], textureMain);
GL11.glPopMatrix();
GL11.glPopMatrix();
break;
case SHIELD_HALF:
MOVE_DIST = 1.0F - (1.0F / 16.0F);
doInterpolation(te);
GL11.glPushMatrix();
GL11.glRotatef(angle, 0.0F, -1.0F, 0.0F);
GL11.glPushMatrix();
GL11.glTranslatef(glassShield.prevDist, 0.0F, 0.0F);
RendererHelper.renderWithResource(modelMain[MODEL_HALF], textureMain);
GL11.glPopMatrix();
GL11.glPopMatrix();
break;
case SHIELD_1X1:
MOVE_DIST = 1.0F - (1.0F / 16.0F);
if (te.getBlockType() instanceof BlockGlassShield1X1) {
BlockGlassShield1X1 shield1X1 = (BlockGlassShield1X1) te.getBlockType();
World W = te.getWorldObj();
int X = te.xCoord, Y = te.yCoord, Z = te.zCoord;
if (!shield1X1.checkShield(W, X, Y - 1, Z) && !shield1X1.checkShield(W, X, Y - 2, Z)) {
doInterpolation(te);
GL11.glPushMatrix();
GL11.glRotatef(angle, 0.0F, -1.0F, 0.0F);
GL11.glPushMatrix();
GL11.glTranslatef(glassShield.prevDist, 0.0F, 0.0F);
RendererHelper.renderWithResource(modelMain[MODEL_1X1], textureMain);
GL11.glPopMatrix();
GL11.glPopMatrix();
}
}
break;
case SHIELD_3X1:
MOVE_DIST = 1.0F - (1.0F / 16.0F);
doInterpolation(te);
GL11.glPushMatrix();
GL11.glRotatef(angle, 0.0F, -1.0F, 0.0F);
GL11.glPushMatrix();
GL11.glTranslatef(0.0F, 1.0F, 0.0F);
GL11.glPushMatrix();
GL11.glTranslatef(glassShield.prevDist, 0.0F, 0.0F);
RendererHelper.renderWithResource(modelMain[MODEL_3X1], textureMain);
GL11.glPopMatrix();
GL11.glPopMatrix();
GL11.glPopMatrix();
break;
case SHIELD_3X1D5:
MOVE_DIST = 1.5F - (1.0F / 16.0F);
doInterpolation(te);
GL11.glPushMatrix();
GL11.glRotatef(angle, 0.0F, -1.0F, 0.0F);
GL11.glPushMatrix();
GL11.glTranslatef(0.0F, 1.0F, 0.0F);
GL11.glPushMatrix();
GL11.glTranslatef(glassShield.prevDist, 0.0F, 0.0F);
RendererHelper.renderWithResource(modelMain[MODEL_3X1D5], textureMain);
GL11.glPopMatrix();
GL11.glPopMatrix();
GL11.glPopMatrix();
break;
default:
break;
}
} else {
switch(renderType) {
case SHIELD_AL:
GL11.glPushMatrix();
GL11.glRotatef(angle, 0.0F, -1.0F, 0.0F);
GL11.glPushMatrix();
GL11.glScalef(1.0F, 1.0F, 1.5F);
RendererHelper.renderWithResource(modelMainAl[MODEL_NORMAL], textureMainAl);
GL11.glPopMatrix();
GL11.glPopMatrix();
break;
case SHIELD_AL_HALF:
GL11.glPushMatrix();
GL11.glRotatef(angle, 0.0F, -1.0F, 0.0F);
GL11.glPushMatrix();
GL11.glScalef(1.0F, 1.0F, 1.5F);
RendererHelper.renderWithResource(modelMainAl[MODEL_HALF], textureMainAl);
GL11.glPopMatrix();
GL11.glPopMatrix();
break;
case SHIELD_AL_BASE:
GL11.glPushMatrix();
GL11.glRotatef(angle, 0.0F, -1.0F, 0.0F);
GL11.glPushMatrix();
GL11.glScalef(1.0F, 1.0F, 1.5F);
RendererHelper.renderWithResource(modelMainAl[MODEL_ALBASE], textureMainAl);
GL11.glPopMatrix();
GL11.glPopMatrix();
break;
case SHIELD_CORNER:
RendererHelper.renderWithResourceAndRotation(modelCorner[MODEL_NORMAL], angle, textureCorner);
break;
case SHIELD_CORNER_HALF:
RendererHelper.renderWithResourceAndRotation(modelCorner[MODEL_HALF], angle, textureCorner);
break;
default:
break;
}
}
RenderHelper.enableStandardItemLighting();
GL11.glPopMatrix();
}
Aggregations