Example usage for org.lwjgl.opengl GL11 glTranslated

List of usage examples for org.lwjgl.opengl GL11 glTranslated

Introduction

In this page you can find the example usage for org.lwjgl.opengl GL11 glTranslated.

Prototype

public static native void glTranslated(@NativeType("GLdouble") double x, @NativeType("GLdouble") double y,
        @NativeType("GLdouble") double z);

Source Link

Document

Double version of #glTranslatef Translatef .

Usage

From source file:simElectricity.Client.Render.RenderWire.java

License:Open Source License

@Override
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float tick) {
    TileWire wire = (TileWire) tileEntity;
    WIDTH = wire.width;//from w  ww.ja  v  a  2s .co  m
    textureString = wire.textureString;

    Tessellator t = Tessellator.instance;
    GL11.glPushMatrix();
    GL11.glTranslated(x + 0.5, y + 0.5, z + 0.5);
    renderWireBox(t, -1, wire.renderSides);
    for (int i = 0; i < 6; i++) {
        if (wire.renderSides[i])
            renderWireBox(t, i, wire.renderSides);
    }
    GL11.glPopMatrix();
}

From source file:simElectricity.Templates.Client.Render.RenderTower.java

License:Open Source License

private void renderTower2() {
    GL11.glPushMatrix();// w  ww .  j av  a2 s  . co  m
    SEAPI.clientRender.renderCube(0.25, 1, 0.25, this, 0);
    GL11.glPopMatrix();

    GL11.glTranslated(0.2, 0.6, -1.5);

    GL11.glPushMatrix();
    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.2, 3, 0.2, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    renderInsulator(4, 0.6);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0, 0, 3);
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    renderInsulator(4, 0.6);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0, 0, 2);
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    renderInsulator(4, 0.6);
    GL11.glPopMatrix();
}

From source file:simElectricity.Templates.Client.Render.RenderTower.java

License:Open Source License

private void renderTower1() {
    GL11.glTranslated(0, -8, 0);

    GL11.glPushMatrix();/*from w  w  w  . jav a2s  . co  m*/
    GL11.glTranslated(0, 8, 0);
    SEAPI.clientRender.renderCube(0.25, 2, 0.25, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0, 8, -1);
    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.1, 2.5, 0.1, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0, 9.5, 0);
    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.1, 1, 0.1, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0, 8, -1);
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    renderInsulator(4, 0.6);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0, 8, 1.5);
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    renderInsulator(4, 0.6);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0, 9.5, 1);
    GL11.glRotatef(180F, 0.0F, 0.0F, 1.0F);
    renderInsulator(4, 0.6);
    GL11.glPopMatrix();
}

From source file:simElectricity.Templates.Client.Render.RenderTower.java

License:Open Source License

private void renderTower0() {
    //1//  w w  w. j a  va 2s.c  om
    GL11.glPushMatrix();
    GL11.glTranslated(-2.455, -9.85, -2.385);
    GL11.glRotatef(-90F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 0.5, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(-2.385, -9.85, -2.455);
    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.15, 0.5, 0.15, this, 0);
    GL11.glPopMatrix();

    //2
    GL11.glPushMatrix();
    GL11.glTranslated(2.455, -9.85, 2.385);
    GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 0.5, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(2.385, -9.85, 2.455);
    GL11.glRotatef(-90F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.15, 0.5, 0.15, this, 0);
    GL11.glPopMatrix();

    //3
    GL11.glPushMatrix();
    GL11.glTranslated(2.455, -9.85, -2.385);
    GL11.glRotatef(90F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 0.5, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(2.385, -9.85, -2.455);
    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.15, 0.5, 0.15, this, 0);
    GL11.glPopMatrix();

    //4
    GL11.glPushMatrix();
    GL11.glTranslated(-2.455, -9.85, 2.385);
    GL11.glRotatef(-90F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 0.5, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(-2.385, -9.85, 2.455);
    GL11.glRotatef(-90F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.15, 0.5, 0.15, this, 0);
    GL11.glPopMatrix();

    //1
    GL11.glPushMatrix();
    GL11.glTranslated(-2.4, -9.85, -2.385);
    GL11.glRotatef(-24F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(7.8F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.15, 8.8, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(-2.385, -9.85, -2.4);
    GL11.glRotatef(24F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(-7.8F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 8.8, 0.15, this, 0);
    GL11.glPopMatrix();

    //2
    GL11.glPushMatrix();
    GL11.glTranslated(2.4, -9.85, 2.385);
    GL11.glRotatef(24F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(-7.8F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.15, 8.8, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(2.385, -9.85, 2.4);
    GL11.glRotatef(-24F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(7.8F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 8.8, 0.15, this, 0);
    GL11.glPopMatrix();

    //3
    GL11.glPushMatrix();
    GL11.glTranslated(2.4, -9.85, -2.385);
    GL11.glRotatef(24F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(7.8F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.15, 8.8, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(2.385, -9.85, -2.4);
    GL11.glRotatef(24F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(7.8F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 8.8, 0.15, this, 0);
    GL11.glPopMatrix();

    //4
    GL11.glPushMatrix();
    GL11.glTranslated(-2.4, -9.85, 2.385);
    GL11.glRotatef(-24F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(-7.8F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.15, 8.8, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(-2.385, -9.85, 2.4);
    GL11.glRotatef(-24F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(-7.8F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 8.8, 0.15, this, 0);
    GL11.glPopMatrix();

    //1
    GL11.glPushMatrix();
    GL11.glTranslated(-1.18, -1.8, -1.18);
    GL11.glRotatef(-38F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(7F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.15, 3.3, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(-1.18, -1.8, -1.18);
    GL11.glRotatef(38F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(-7F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 3.3, 0.15, this, 0);
    GL11.glPopMatrix();

    //2
    GL11.glPushMatrix();
    GL11.glTranslated(-1.18, -1.8, 1.18);
    GL11.glRotatef(-38F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(-7F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.15, 3.3, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(-1.18, -1.8, 1.18);
    GL11.glRotatef(-38F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(-7F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 3.3, 0.15, this, 0);
    GL11.glPopMatrix();

    //3
    GL11.glPushMatrix();
    GL11.glTranslated(1.18, -1.8, 1.18);
    GL11.glRotatef(38F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(-7F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.15, 3.3, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(1.18, -1.8, 1.18);
    GL11.glRotatef(-38F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(7F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 3.3, 0.15, this, 0);
    GL11.glPopMatrix();

    //4
    GL11.glPushMatrix();
    GL11.glTranslated(1.18, -1.8, -1.18);
    GL11.glRotatef(38F, 0.0F, 0.0F, 1.0F);
    GL11.glRotatef(7F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.15, 3.3, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(1.18, -1.8, -1.18);
    GL11.glRotatef(38F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(7F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 3.3, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glTranslated(0, -6, 0);

    //Base1
    GL11.glPushMatrix();
    GL11.glTranslated(2.4, -3.9, -2.4);
    GL11.glRotatef(8.5F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(8.5F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 10.9, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(-2.4, -3.9, 2.4);
    GL11.glRotatef(351.5F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(351.5F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 10.9, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(2.4, -3.9, 2.4);
    GL11.glRotatef(351.5F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(8.5F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 10.9, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(-2.4, -3.9, -2.4);
    GL11.glRotatef(8.5F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(351.5F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 10.9, 0.15, this, 0);
    GL11.glPopMatrix();

    //Base2 (H)
    GL11.glPushMatrix();
    GL11.glTranslated(-0.8, 6.7, -0.9);
    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.15, 1.8, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0.8, 6.7, -0.9);
    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.15, 1.8, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0.85, 6.7, -0.8);
    GL11.glRotatef(90, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(90, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 1.7, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0.85, 6.7, 0.8);
    GL11.glRotatef(90, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(90, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 1.7, 0.15, this, 0);
    GL11.glPopMatrix();

    //Base3
    GL11.glPushMatrix();
    GL11.glTranslated(-0.8, 6.7, -0.8);
    GL11.glRotatef(340F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(355F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 5, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0.8, 6.7, -0.8);
    GL11.glRotatef(340F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(5F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 5, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0.8, 6.7, 0.8);
    GL11.glRotatef(20F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(5F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 5, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(-0.8, 6.7, 0.8);
    GL11.glRotatef(20F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(355F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 5, 0.15, this, 0);
    GL11.glPopMatrix();

    //Horizontal1
    GL11.glPushMatrix();
    GL11.glTranslated(-0.45, 10, -4);
    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.15, 8, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0.45, 10, -4);
    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
    SEAPI.clientRender.renderCube(0.15, 8, 0.15, this, 0);
    GL11.glPopMatrix();

    //Insulators
    GL11.glPushMatrix();
    GL11.glTranslated(0, 9, 0);
    renderInsulator(8, 1);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0, 9, -3);
    renderInsulator(8, 1);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0, 9, 3);
    renderInsulator(8, 1);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0.45, 10, 2);
    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(167F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 4.2, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0.45, 10, -2);
    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(13F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 4.2, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0.5, 10, 2);
    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(26F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 2.2, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(-0.5, 10, 2);
    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(-26F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 2.2, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(0.45, 10, -3.9);
    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(26F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 2, 0.15, this, 0);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glTranslated(-0.45, 10, -3.9);
    GL11.glRotatef(90F, 1.0F, 0.0F, 0.0F);
    GL11.glRotatef(-26F, 0.0F, 0.0F, 1.0F);
    SEAPI.clientRender.renderCube(0.15, 2, 0.15, this, 0);
    GL11.glPopMatrix();
}

From source file:slimevoid.littleblocks.client.render.blocks.LittleBlocksLittleRenderer.java

License:Open Source License

public void renderLittleBlocks(IBlockAccess iblockaccess, int x, int y, int z) {
    if (this.littleBlocksToRender.size() > 0) {
        Tessellator tessellator = Tessellator.instance;
        int mode = tessellator.drawMode;
        tessellator.draw();// www  .ja  va  2  s. c om
        GL11.glPushMatrix();

        double xS = -((x >> 4) << 4), yS = -((y >> 4) << 4), zS = -((z >> 4) << 4);

        GL11.glTranslated(xS, yS, zS);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        float scale = 1 / (float) LBCore.littleBlocksSize;
        GL11.glScalef(scale, scale, scale);
        GL11.glTranslated(-xS, -yS, -zS);

        tessellator.startDrawing(mode);
        for (LittleBlockToRender littleBlockToRender : this.littleBlocksToRender) {
            this.renderBlocks.renderBlockByRenderType(littleBlockToRender.block, littleBlockToRender.x,
                    littleBlockToRender.y, littleBlockToRender.z);
        }
        tessellator.draw();
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
        tessellator.startDrawingQuads();
    }
}

From source file:slimevoid.littleblocks.client.render.tileentities.LittleTilesLittleRenderer.java

License:Open Source License

public void renderLittleTiles(TileEntityLittleChunk tileentity, double x, double y, double z, float f) {
    GL11.glPushMatrix();//from w  w  w  . j a  va2 s  .co  m

    GL11.glTranslated(x, y, z);
    GL11.glTranslated(-tileentity.xCoord, -tileentity.yCoord, -tileentity.zCoord);
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    float scale = 1F / LBCore.littleBlocksSize;
    GL11.glScaled(scale, scale, scale);

    RenderHelper.disableStandardItemLighting();
    GL11.glBlendFunc(770, 771);
    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);
    }

    for (LittleTileToRender tileToRender : this.tilesToRender) {
        this.tileEntityRenderer.renderTileEntityAt(tileToRender.tileentity, tileToRender.x, tileToRender.y,
                tileToRender.z, f);
    }

    GL11.glDisable(GL12.GL_RESCALE_NORMAL);
    GL11.glPopMatrix();
}

From source file:sokobanMod.client.HandlerLevelPreviewRenderer.java

License:LGPL

private void renderPreview(DrawBlockHighlightEvent event) {

    double x = event.target.blockX + 0.5F;
    double y = event.target.blockY + 0.5F;
    double z = event.target.blockZ + 0.5F;
    double iPX = event.player.prevPosX + (event.player.posX - event.player.prevPosX) * event.partialTicks;
    double iPY = event.player.prevPosY + (event.player.posY - event.player.prevPosY) * event.partialTicks;
    double iPZ = event.player.prevPosZ + (event.player.posZ - event.player.prevPosZ) * event.partialTicks;

    int baseX = event.target.blockX;
    int baseY = event.target.blockY + 1;
    int baseZ = event.target.blockZ;

    float xScale = 0.1F;
    float yScale = 0.1F;
    float zScale = 0.1F;
    float xShift = 0.0F;
    float yShift = 1.0F;
    float zShift = 0.0F;
    // determine the line color

    int[] levelBounds;
    int[] rawLevelBounds;
    ForgeDirection sideHit = ForgeDirection.UP;
    if (event.currentItem == new ItemStack(SokobanMod.ItemLevelGeneratorTutorial)) {
        rawLevelBounds = LevelRegistrator.getLevelBounds(event.currentItem.getItemDamage());
        levelBounds = rawLevelBounds.clone();
        levelBounds[0]++;/*from  w  w  w. j  a  v  a2  s. c o  m*/
        levelBounds[1]++;
        levelBounds[2]++;
        yShift += levelBounds[1] / 2;

        int orientation = SokobanUtils.determineOrientation(event.player);
        switch (orientation) {
        case 0:
            orientation = 3;
            break;
        case 3:
            orientation = 5;
            break;
        case 1:
            orientation = 4;
            break;
        }
        sideHit = ForgeDirection.getOrientation(orientation);

        xShift += (1 - levelBounds[0] % 2) / 2F;
        yShift -= (1 - levelBounds[1] % 2) / 2F;
        zShift += (1 - levelBounds[2] % 2) / 2F;

    } else {
        colliding = false; // always render the wireframe green.
        NBTTagCompound nbt = event.player.getCurrentEquippedItem().stackTagCompound;
        if (nbt != null && nbt.hasKey("x")) {
            int startX = nbt.getInteger("x");
            int startY = nbt.getInteger("y");
            int startZ = nbt.getInteger("z");
            int endX = event.target.blockX;
            int endY = event.target.blockY;
            int endZ = event.target.blockZ;

            rawLevelBounds = new int[] { Math.abs(endX - startX), Math.abs(endY - startY),
                    Math.abs(endZ - startZ) };
            levelBounds = new int[] { rawLevelBounds[0] + 1, rawLevelBounds[1] + 1, rawLevelBounds[2] + 1 };

            xShift -= (endX - startX) / 2F;
            yShift -= (endY - startY) / 2F + 1F;
            zShift -= (endZ - startZ) / 2F;
        } else {
            rawLevelBounds = new int[] { 1, 1, 1 };
            levelBounds = new int[] { 1, 1, 1 };
            yShift = 0F;
        }

    }
    switch (sideHit) {
    case NORTH:
        zShift += levelBounds[2] / 2;
        zShift -= 1 - levelBounds[2] % 2;
        zShift = -zShift;

        baseZ -= rawLevelBounds[2];// +2
        baseX -= rawLevelBounds[0] / 2;
        break;
    case SOUTH:
        zShift += levelBounds[2] / 2;
        zShift -= 1 - levelBounds[2] % 2;

        baseX -= rawLevelBounds[0] / 2;
        break;
    case EAST:
        // zShift = 0;
        xShift += levelBounds[0] / 2;
        xShift -= 1 - levelBounds[0] % 2;
        baseZ -= rawLevelBounds[2] / 2;
        break;
    case WEST:
        xShift += levelBounds[0] / 2;
        xShift -= 1 - levelBounds[0] % 2;
        xShift = -xShift;

        baseX -= rawLevelBounds[0];
        baseZ -= rawLevelBounds[2] / 2;
        break;
    default:
    }

    colliding = SokobanUtils.isCollidingWithLevel(event.player.worldObj, baseX, baseY, baseZ,
            baseX + rawLevelBounds[0], baseY + rawLevelBounds[1], baseZ + rawLevelBounds[2]);

    GL11.glDepthMask(false);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    // GL11.glDisable(GL11.GL_CULL_FACE);

    for (int i = 0; i < 6; i++) {
        ForgeDirection forgeDir = ForgeDirection.getOrientation(i);
        int zCorrection = i == 2 ? -1 : 1;
        GL11.glPushMatrix();
        GL11.glTranslated(-iPX + x + xShift, -iPY + y + yShift, -iPZ + z + zShift);
        GL11.glScalef(levelBounds[0] + xScale, levelBounds[1] + yScale, levelBounds[2] + zScale);
        GL11.glRotatef(90, forgeDir.offsetX, forgeDir.offsetY, forgeDir.offsetZ);
        GL11.glTranslated(0, 0, 0.5f * zCorrection);
        GL11.glClear(GL11.GL_DEPTH_BUFFER_BIT);
        renderPulsingQuad();
        GL11.glPopMatrix();
    }

    GL11.glDepthMask(true);
    GL11.glEnable(GL11.GL_TEXTURE_2D);

}

From source file:sqr.client.model.ModelHatchedSpider.java

License:Open Source License

private void renderLongLegSpider(float partialTickTime) {
    GL11.glPushMatrix();/*from  w w  w.java2  s  .co m*/
    {
        GL11.glTranslated(0, 0.35D, 0);
        longLegSpiderBody.render(partialTickTime);
    }
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    {
        GL11.glTranslated(0, -0.05D, 0);
        GL11.glScaled(1, 1.5D, 1);
        longLegSpiderLeg1.render(partialTickTime);
        longLegSpiderLeg2.render(partialTickTime);
        longLegSpiderLeg3.render(partialTickTime);
        longLegSpiderLeg4.render(partialTickTime);
        longLegSpiderLeg5.render(partialTickTime);
        longLegSpiderLeg6.render(partialTickTime);
        longLegSpiderLeg7.render(partialTickTime);
        longLegSpiderLeg8.render(partialTickTime);
    }
    GL11.glPopMatrix();
}

From source file:sqr.client.model.ModelHatchedSpider.java

License:Open Source License

private void renderTinyLongLegSpider(float partialTickTime) {
    GL11.glPushMatrix();// www . j a  v  a2s .co  m
    {
        GL11.glScaled(0.5D, 0.5D, 0.5D);
        GL11.glTranslated(0.0D, 1.2D, 0.0D);
        renderLongLegSpider(partialTickTime);
    }
    GL11.glPopMatrix();
}

From source file:sqr.client.model.ModelHatchedSpider.java

License:Open Source License

private void renderSwarmSpiders(Entity entity, float partialTickTime) {
    final EntityHatchedSpider spider = (EntityHatchedSpider) entity;
    final int level = spider.getLevel();

    if (spider.isOnLadder()) {
        final Vec3 lookVector = spider.getLookVec();

        if (lookVector.xCoord <= -0.90 || lookVector.zCoord <= -0.90) {
            GL11.glRotatef(270, 1, 0, 0);
            GL11.glTranslated(0, -1.2, 0);
        }//from w  w  w. j a va2s .c o  m

        else if (lookVector.xCoord >= 0.90 || lookVector.zCoord >= 0.90) {
            GL11.glRotatef(-90, 1, 0, 0);
            GL11.glTranslated(0, -1.2, 0);
        }
    }

    if (level == 1) {
        for (int pass = 0; pass < 9; pass++) {
            GL11.glPushMatrix();
            {
                GL11.glScaled(0.3D, 0.3D, 0.3D);
                GL11.glTranslated(0, 3.6D, 0D);

                switch (pass) {
                case 0:
                    GL11.glTranslated(0D, 0.0D, -2.0D);
                    break;
                case 1:
                    GL11.glTranslated(0D, 0, 2.0D);
                    break;
                case 2:
                    GL11.glTranslated(1.8D, 0, 0D);
                    break;
                case 3:
                    GL11.glTranslated(-1.8D, 0, 0D);
                    break;
                case 4:
                    GL11.glTranslated(1.8D, 0, -2.0D);
                    break;
                case 5:
                    GL11.glTranslated(-1.8D, 0, -2.0D);
                    break;
                case 6:
                    GL11.glTranslated(1.8D, 0, 2.0D);
                    break;
                case 7:
                    GL11.glTranslated(-1.8D, 0, 2.0D);
                    break;
                default:
                    break;
                }
                renderDefaultSpider(partialTickTime);
            }
            GL11.glPopMatrix();
        }
    }

    else if (level == 2) {
        for (int pass = 0; pass < 13; pass++) {
            GL11.glPushMatrix();
            {
                GL11.glScaled(0.2D, 0.2D, 0.2D);
                GL11.glTranslated(0, 6.1D, 0D);

                switch (pass) {
                case 0:
                    GL11.glTranslated(0D, 0.0D, -2.0D);
                    break;
                case 1:
                    GL11.glTranslated(0D, 0, 2.0D);
                    break;
                case 2:
                    GL11.glTranslated(1.8D, 0, 0D);
                    break;
                case 3:
                    GL11.glTranslated(-1.8D, 0, 0D);
                    break;
                case 4:
                    GL11.glTranslated(1.8D, 0, -2.0D);
                    break;
                case 5:
                    GL11.glTranslated(-1.8D, 0, -2.0D);
                    break;
                case 6:
                    GL11.glTranslated(1.8D, 0, 2.0D);
                    break;
                case 7:
                    GL11.glTranslated(3.5D, 0, 0.0D);
                    break;
                case 8:
                    GL11.glTranslated(-3.5D, 0, 0.0D);
                    break;
                case 9:
                    GL11.glTranslated(0D, 0, 0D);
                    break;
                case 10:
                    GL11.glTranslated(0D, 0, 4D);
                    break;
                case 11:
                    GL11.glTranslated(-1.8D, 0, 2.0D);
                    break;
                case 12:
                    GL11.glTranslated(0D, 0, -4D);
                    break;
                default:
                    break;
                }
                renderDefaultSpider(partialTickTime);
            }
            GL11.glPopMatrix();
        }
    }

    else if (level == 3) {
        for (int pass = 0; pass < 25; pass++) {
            GL11.glPushMatrix();
            {
                GL11.glScaled(0.15D, 0.15D, 0.15D);
                GL11.glTranslated(0, 8.6D, 0D);

                switch (pass) {
                case 0:
                    GL11.glTranslated(0D, 0.0D, -2.0D);
                    break;
                case 1:
                    GL11.glTranslated(0D, 0, 2.0D);
                    break;
                case 2:
                    GL11.glTranslated(1.8D, 0, 0D);
                    break;
                case 3:
                    GL11.glTranslated(-1.8D, 0, 0D);
                    break;
                case 4:
                    GL11.glTranslated(1.8D, 0, -2.0D);
                    break;
                case 5:
                    GL11.glTranslated(-1.8D, 0, -2.0D);
                    break;
                case 6:
                    GL11.glTranslated(1.8D, 0, 2.0D);
                    break;
                case 7:
                    GL11.glTranslated(3.5D, 0, 0.0D);
                    break;
                case 8:
                    GL11.glTranslated(-3.5D, 0, 0.0D);
                    break;
                case 9:
                    GL11.glTranslated(0D, 0, 0D);
                    break;
                case 10:
                    GL11.glTranslated(0D, 0, 4D);
                    break;
                case 11:
                    GL11.glTranslated(-1.8D, 0, 2.0D);
                    break;
                case 12:
                    GL11.glTranslated(0D, 0, -4D);
                    break;
                case 13:
                    GL11.glTranslated(1.8D, 0, -4D);
                    break;
                case 14:
                    GL11.glTranslated(-1.8D, 0, -4D);
                    break;
                case 15:
                    GL11.glTranslated(3.5D, 0, -4D);
                    break;
                case 16:
                    GL11.glTranslated(-3.5D, 0, -4D);
                    break;
                case 17:
                    GL11.glTranslated(-3.5D, 0, -2D);
                    break;
                case 18:
                    GL11.glTranslated(-3.5D, 0, 4D);
                    break;
                case 19:
                    GL11.glTranslated(-3.5D, 0, 2D);
                    break;
                case 20:
                    GL11.glTranslated(1.8D, 0, 4D);
                    break;
                case 21:
                    GL11.glTranslated(3.5D, 0, 4D);
                    break;
                case 22:
                    GL11.glTranslated(3.5D, 0, 2D);
                    break;
                case 23:
                    GL11.glTranslated(3.5D, 0, -2D);
                    break;
                case 24:
                    GL11.glTranslated(-1.8D, 0, 4D);
                    break;
                default:
                    break;
                }
                renderDefaultSpider(partialTickTime);
            }
            GL11.glPopMatrix();
        }
    }
}