Example usage for org.lwjgl.opengl GL11 glRotatef

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

Introduction

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

Prototype

public static native void glRotatef(@NativeType("GLfloat") float angle, @NativeType("GLfloat") float x,
        @NativeType("GLfloat") float y, @NativeType("GLfloat") float z);

Source Link

Document

Manipulates the current matrix with a rotation matrix.

Usage

From source file:buildcraft.core.RenderEntityBlock.java

License:Minecraft Mod Public

public void doRenderBlock(EntityBlock entity, double i, double j, double k) {
    if (entity.isDead)
        return;//from  w  ww. j  a  v a2  s. c om

    shadowSize = entity.shadowSize;
    World world = entity.worldObj;
    BlockInterface util = new BlockInterface();
    util.texture = entity.texture;

    for (int iBase = 0; iBase < entity.iSize; ++iBase)
        for (int jBase = 0; jBase < entity.jSize; ++jBase)
            for (int kBase = 0; kBase < entity.kSize; ++kBase) {

                util.minX = 0;
                util.minY = 0;
                util.minZ = 0;

                double remainX = entity.iSize - iBase;
                double remainY = entity.jSize - jBase;
                double remainZ = entity.kSize - kBase;

                util.maxX = (remainX > 1.0 ? 1.0 : remainX);
                util.maxY = (remainY > 1.0 ? 1.0 : remainY);
                util.maxZ = (remainZ > 1.0 ? 1.0 : remainZ);

                GL11.glPushMatrix();
                GL11.glTranslatef((float) i + 0.5F, (float) j + 0.5F, (float) k + 0.5F);
                GL11.glRotatef(entity.rotationX, 1, 0, 0);
                GL11.glRotatef(entity.rotationY, 0, 1, 0);
                GL11.glRotatef(entity.rotationZ, 0, 0, 1);
                GL11.glTranslatef(iBase, jBase, kBase);

                MinecraftForgeClient.bindTexture(DefaultProps.TEXTURE_BLOCKS);

                int lightX, lightY, lightZ;

                lightX = (int) (Math.floor(entity.posX) + iBase);
                lightY = (int) (Math.floor(entity.posY) + jBase);
                lightZ = (int) (Math.floor(entity.posZ) + kBase);

                GL11.glDisable(2896 /* GL_LIGHTING */);
                renderBlock(util, world, lightX, lightY, lightZ, false, true);
                GL11.glEnable(2896 /* GL_LIGHTING */);
                GL11.glPopMatrix();

            }
}

From source file:buildcraft.factory.render.RenderRefinery.java

License:Minecraft Mod Public

private void render(TileRefinery tile, double x, double y, double z) {
    FluidStack liquid1 = null, liquid2 = null, liquidResult = null;
    int color1 = 0xFFFFFF, color2 = 0xFFFFFF, colorResult = 0xFFFFFF;

    float anim = 0;
    int angle = 0;
    ModelRenderer theMagnet = magnet[0];
    if (tile != null) {
        if (tile.tank1.getFluid() != null) {
            liquid1 = tile.tank1.getFluid();
            color1 = tile.tank1.colorRenderCache;
        }/*  ww  w .  ja v  a 2s . c  om*/

        if (tile.tank2.getFluid() != null) {
            liquid2 = tile.tank2.getFluid();
            color2 = tile.tank2.colorRenderCache;
        }

        if (tile.result.getFluid() != null) {
            liquidResult = tile.result.getFluid();
            colorResult = tile.result.colorRenderCache;
        }

        anim = tile.getAnimationStage();

        angle = 0;
        switch (tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord)) {
        case 2:
            angle = 90;
            break;
        case 3:
            angle = 270;
            break;
        case 4:
            angle = 180;
            break;
        case 5:
            angle = 0;
            break;
        }

        if (tile.animationSpeed <= 1) {
            theMagnet = magnet[0];
        } else if (tile.animationSpeed <= 2.5) {
            theMagnet = magnet[1];
        } else if (tile.animationSpeed <= 4.5) {
            theMagnet = magnet[2];
        } else {
            theMagnet = magnet[3];
        }
    }

    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);

    GL11.glTranslatef((float) x + 0.5F, (float) y + 0.5F, (float) z + 0.5F);
    GL11.glScalef(0.99F, 0.99F, 0.99F);

    GL11.glRotatef(angle, 0, 1, 0);

    bindTexture(TEXTURE);

    GL11.glPushMatrix();
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
    GL11.glTranslatef(-4F * pixel, 0, -4F * pixel);
    tank.render(pixel);
    GL11.glTranslatef(4F * pixel, 0, 4F * pixel);

    GL11.glTranslatef(-4F * pixel, 0, 4F * pixel);
    tank.render(pixel);
    GL11.glTranslatef(4F * pixel, 0, -4F * pixel);

    GL11.glTranslatef(4F * pixel, 0, 0);
    tank.render(pixel);
    GL11.glTranslatef(-4F * pixel, 0, 0);
    GL11.glPopMatrix();

    float trans1, trans2;

    if (anim <= 100) {
        trans1 = 12F * pixel * anim / 100F;
        trans2 = 0;
    } else if (anim <= 200) {
        trans1 = 12F * pixel - (12F * pixel * (anim - 100F) / 100F);
        trans2 = 12F * pixel * (anim - 100F) / 100F;
    } else {
        trans1 = 12F * pixel * (anim - 200F) / 100F;
        trans2 = 12F * pixel - (12F * pixel * (anim - 200F) / 100F);
    }

    GL11.glPushMatrix();
    GL11.glScalef(0.99F, 0.99F, 0.99F);
    GL11.glTranslatef(-0.51F, trans1 - 0.5F, -0.5F);
    theMagnet.render(pixel);
    GL11.glPopMatrix();

    GL11.glPushMatrix();
    GL11.glScalef(0.99F, 0.99F, 0.99F);
    GL11.glTranslatef(-0.51F, trans2 - 0.5F, 12F * pixel - 0.5F);
    theMagnet.render(pixel);
    GL11.glPopMatrix();

    if (tile != null) {
        GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
        GL11.glEnable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
        GL11.glScalef(0.5F, 1, 0.5F);

        if (liquid1 != null && liquid1.amount > 0) {
            int[] list1 = FluidRenderer.getFluidDisplayLists(liquid1, tile.getWorldObj(), false);

            if (list1 != null) {
                bindTexture(FluidRenderer.getFluidSheet(liquid1));
                RenderUtils.setGLColorFromInt(color1);
                GL11.glCallList(list1[getDisplayListIndex(tile.tank1)]);
            }
        }

        if (liquid2 != null && liquid2.amount > 0) {
            int[] list2 = FluidRenderer.getFluidDisplayLists(liquid2, tile.getWorldObj(), false);

            if (list2 != null) {
                GL11.glPushMatrix();
                GL11.glTranslatef(0, 0, 1);
                bindTexture(FluidRenderer.getFluidSheet(liquid2));
                RenderUtils.setGLColorFromInt(color2);
                GL11.glCallList(list2[getDisplayListIndex(tile.tank2)]);
                GL11.glPopMatrix();
            }
        }

        if (liquidResult != null && liquidResult.amount > 0) {
            int[] list3 = FluidRenderer.getFluidDisplayLists(liquidResult, tile.getWorldObj(), false);

            if (list3 != null) {
                GL11.glPushMatrix();
                GL11.glTranslatef(1, 0, 0.5F);
                bindTexture(FluidRenderer.getFluidSheet(liquidResult));
                RenderUtils.setGLColorFromInt(colorResult);
                GL11.glCallList(list3[getDisplayListIndex(tile.result)]);
                GL11.glPopMatrix();
            }
        }
        GL11.glPopAttrib();
    }

    GL11.glPopAttrib();
    GL11.glPopMatrix();
}

From source file:buildcraft.factory.RenderRefinery.java

License:Minecraft Mod Public

private void render(TileRefinery tile, double x, double y, double z) {

    int liquid1 = 0, liquid2 = 0, liquid3 = 0;
    int qty1 = 0, qty2 = 0, qty3 = 0;
    float anim = 0;
    int angle = 0;
    ModelRenderer theMagnet = magnet[0];

    if (tile != null) {
        liquid1 = tile.slot1.liquidId;/*  www  . j a va 2  s . c  o  m*/
        qty1 = tile.slot1.quantity;

        liquid2 = tile.slot2.liquidId;
        qty2 = tile.slot2.quantity;

        liquid3 = tile.result.liquidId;
        qty3 = tile.result.quantity;

        anim = tile.getAnimationStage();

        switch (tile.worldObj.getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord)) {
        case 2:
            angle = 90;
            break;
        case 3:
            angle = 270;
            break;
        case 4:
            angle = 180;
            break;
        case 5:
            angle = 0;
            break;
        }

        if (tile.animationSpeed <= 1)
            theMagnet = magnet[0];
        else if (tile.animationSpeed <= 2.5)
            theMagnet = magnet[1];
        else if (tile.animationSpeed <= 4.5)
            theMagnet = magnet[2];
        else
            theMagnet = magnet[3];

    }

    GL11.glPushMatrix();
    GL11.glDisable(2896 /* GL_LIGHTING */);

    GL11.glTranslatef((float) x, (float) y, (float) z);

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);
    GL11.glRotatef(angle, 0, 1, 0);
    GL11.glTranslatef(-0.5F, -0.5F, -0.5F);

    MinecraftForgeClient.bindTexture(DefaultProps.TEXTURE_PATH_BLOCKS + "/refinery.png");
    GL11.glTranslatef(-4F * factor, 0, -4F * factor);
    tank.render(factor);
    GL11.glTranslatef(4F * factor, 0, 4F * factor);

    GL11.glTranslatef(-4F * factor, 0, 4F * factor);
    tank.render(factor);
    GL11.glTranslatef(4F * factor, 0, -4F * factor);

    GL11.glTranslatef(4F * factor, 0, 0);
    tank.render(factor);
    GL11.glTranslatef(-4F * factor, 0, 0);

    float trans1, trans2;

    if (anim <= 100) {
        trans1 = 12F * factor * anim / 100F;
        trans2 = 0;
    } else if (anim <= 200) {
        trans1 = 12F * factor - (12F * factor * (anim - 100F) / 100F);
        trans2 = 12F * factor * (anim - 100F) / 100F;
    } else {
        trans1 = 12F * factor * (anim - 200F) / 100F;
        trans2 = 12F * factor - (12F * factor * (anim - 200F) / 100F);
    }

    GL11.glTranslatef(0, trans1, 0);
    theMagnet.render(factor);
    GL11.glTranslatef(0, -trans1, 0);

    GL11.glTranslatef(0, trans2, 12F * factor);
    theMagnet.render(factor);
    GL11.glTranslatef(0, -trans2, -12F * factor);

    GL11.glTranslatef(0.5F, 0.5F, 0.5F);

    GL11.glTranslatef(-4F * factor, 0, -4F * factor);
    if (qty1 > 0) {
        int[] list1 = getDisplayLists(liquid1, tile.worldObj);

        if (list1 != null) {
            setTextureFor(liquid1);
            GL11.glCallList(
                    list1[(int) ((float) qty1 / (float) TileRefinery.LIQUID_PER_SLOT * (displayStages - 1))]);
        }
    }
    GL11.glTranslatef(4F * factor, 0, 4F * factor);

    GL11.glTranslatef(-4F * factor, 0, 4F * factor);
    if (qty2 > 0) {
        int[] list2 = getDisplayLists(liquid2, tile.worldObj);

        if (list2 != null) {
            setTextureFor(liquid2);
            GL11.glCallList(
                    list2[(int) ((float) qty2 / (float) TileRefinery.LIQUID_PER_SLOT * (displayStages - 1))]);
        }
    }
    GL11.glTranslatef(4F * factor, 0, -4F * factor);

    GL11.glTranslatef(4F * factor, 0, 0);
    if (qty3 > 0) {
        int[] list3 = getDisplayLists(liquid3, tile.worldObj);

        if (list3 != null) {
            setTextureFor(liquid3);
            GL11.glCallList(getDisplayLists(liquid3, tile.worldObj)[(int) ((float) qty3
                    / (float) TileRefinery.LIQUID_PER_SLOT * (displayStages - 1))]);
        }
    }
    GL11.glTranslatef(-4F * factor, 0, 0);

    GL11.glEnable(2896 /* GL_LIGHTING */);
    GL11.glPopMatrix();
}

From source file:buildcraft.robotics.render.RenderRobot.java

License:Minecraft Mod Public

private void doRender(EntityRobot robot, double x, double y, double z, float partialTicks) {
    GL11.glPushMatrix();/* w ww .  jav a  2  s.co m*/
    GL11.glTranslated(x, y, z);

    float robotYaw = this.interpolateRotation(robot.prevRenderYawOffset, robot.renderYawOffset, partialTicks);
    GL11.glRotatef(-robotYaw, 0.0f, 1.0f, 0.0f);

    if (robot.getStackInSlot(0) != null) {
        GL11.glPushMatrix();
        GL11.glTranslatef(-0.125F, 0, -0.125F);
        doRenderItem(robot.getStackInSlot(0));
        GL11.glColor3f(1, 1, 1);
        GL11.glPopMatrix();
    }

    if (robot.getStackInSlot(1) != null) {
        GL11.glPushMatrix();
        GL11.glTranslatef(+0.125F, 0, -0.125F);
        doRenderItem(robot.getStackInSlot(1));
        GL11.glColor3f(1, 1, 1);
        GL11.glPopMatrix();
    }

    if (robot.getStackInSlot(2) != null) {
        GL11.glPushMatrix();
        GL11.glTranslatef(+0.125F, 0, +0.125F);
        doRenderItem(robot.getStackInSlot(2));
        GL11.glColor3f(1, 1, 1);
        GL11.glPopMatrix();
    }

    if (robot.getStackInSlot(3) != null) {
        GL11.glPushMatrix();
        GL11.glTranslatef(-0.125F, 0, +0.125F);
        doRenderItem(robot.getStackInSlot(3));
        GL11.glColor3f(1, 1, 1);
        GL11.glPopMatrix();
    }

    if (robot.itemInUse != null) {
        GL11.glPushMatrix();

        GL11.glRotatef(robot.itemAngle2, 0, 0, 1);

        if (robot.itemActive) {
            long newDate = new Date().getTime();
            robot.itemActiveStage = (robot.itemActiveStage + (newDate - robot.lastUpdateTime) / 10) % 45;
            GL11.glRotatef(robot.itemActiveStage, 0, 0, 1);
            robot.lastUpdateTime = newDate;
        }

        GL11.glTranslatef(-0.4F, 0, 0);
        GL11.glRotatef(-45F + 180F, 0, 1, 0);
        GL11.glScalef(0.8F, 0.8F, 0.8F);

        ItemStack itemstack1 = robot.itemInUse;

        if (itemstack1.getItem().requiresMultipleRenderPasses()) {
            for (int k = 0; k < itemstack1.getItem().getRenderPasses(itemstack1.getItemDamage()); ++k) {
                RenderUtils.setGLColorFromInt(itemstack1.getItem().getColorFromItemStack(itemstack1, k));
                this.renderManager.itemRenderer.renderItem(robot, itemstack1, k);
            }
        } else {
            RenderUtils.setGLColorFromInt(itemstack1.getItem().getColorFromItemStack(itemstack1, 0));
            this.renderManager.itemRenderer.renderItem(robot, itemstack1, 0);
        }

        GL11.glColor3f(1, 1, 1);
        GL11.glPopMatrix();
    }

    if (robot.laser.isVisible) {
        robot.laser.head.x = robot.posX;
        robot.laser.head.y = robot.posY;
        robot.laser.head.z = robot.posZ;

        RenderLaser.doRenderLaser(renderManager.renderEngine, robot.laser, EntityLaser.LASER_TEXTURES[1]);
    }

    if (robot.getTexture() != null) {
        renderManager.renderEngine.bindTexture(robot.getTexture());
        float storagePercent = (float) robot.getBattery().getEnergyStored()
                / (float) robot.getBattery().getMaxEnergyStored();
        if (robot.hurtTime > 0) {
            GL11.glColor3f(1.0f, 0.6f, 0.6f);
            GL11.glRotatef(robot.hurtTime * 0.01f, 0, 0, 1);
        }
        doRenderRobot(1F / 16F, renderManager.renderEngine, storagePercent, robot.isActive());
    }

    for (ItemStack s : robot.getWearables()) {
        doRenderWearable(robot, renderManager.renderEngine, s);
    }

    GL11.glPopMatrix();
}

From source file:buildcraft.robotics.render.RenderRobot.java

License:Minecraft Mod Public

private void doRenderWearable(EntityRobot entity, TextureManager textureManager, ItemStack wearable) {
    if (wearable.getItem() instanceof IRobotOverlayItem) {
        ((IRobotOverlayItem) wearable.getItem()).renderRobotOverlay(wearable, textureManager);
    } else if (wearable.getItem() instanceof ItemArmor) {
        GL11.glPushMatrix();/*from  w  w  w.  j a  va  2  s . com*/
        GL11.glScalef(1.0125F, 1.0125F, 1.0125F);
        GL11.glTranslatef(0.0f, -0.25f, 0.0f);
        GL11.glRotatef(180F, 0, 0, 1);

        int color = wearable.getItem().getColorFromItemStack(wearable, 0);
        if (color != 16777215) {
            GL11.glPushAttrib(GL11.GL_COLOR_BUFFER_BIT);
            GL11.glColor3ub((byte) (color >> 16), (byte) ((color >> 8) & 255), (byte) (color & 255));
        }

        textureManager.bindTexture(RenderBiped.getArmorResource(entity, wearable, 0, null));
        ModelBiped armorModel = ForgeHooksClient.getArmorModel(entity, wearable, 0, null);
        if (armorModel != null) {
            armorModel.render(entity, 0, 0, 0, -90f, 0, 1 / 16F);

            if (color != 16777215) {
                GL11.glPopAttrib();
            }
        } else {
            GL11.glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
            helmetBox.render(1 / 16F);

            if (color != 16777215) {
                this.bindTexture(RenderBiped.getArmorResource(entity, wearable, 0, "overlay"));
                helmetBox.render(1 / 16F);
                GL11.glPopAttrib();
            }
        }

        GL11.glPopMatrix();
    } else if (wearable.getItem() instanceof ItemSkull) {
        doRenderSkull(wearable);
    }
}

From source file:buildcraft.robotics.render.RenderRobot.java

License:Minecraft Mod Public

private void doRenderSkull(ItemStack wearable) {
    GL11.glPushMatrix();//w  w w  .j a  v  a  2 s  . c  o m
    GL11.glScalef(1.0125F, 1.0125F, 1.0125F);
    GameProfile gameProfile = null;
    if (wearable.hasTagCompound()) {
        NBTTagCompound nbt = wearable.getTagCompound();
        if (nbt.hasKey("Name")) {
            gameProfile = gameProfileCache.get(nbt.getString("Name"));
        } else if (nbt.hasKey("SkullOwner", NBT.TAG_COMPOUND)) {
            gameProfile = NBTUtil.func_152459_a(nbt.getCompoundTag("SkullOwner"));
            nbt.setString("Name", gameProfile.getName());
            gameProfileCache.put(gameProfile.getName(), gameProfile);
        }
    }

    TileEntitySkullRenderer.field_147536_b.func_152674_a(-0.5F, -0.25F, -0.5F, 1, -90.0F,
            wearable.getItemDamage(), gameProfile);
    if (gameProfile != null) {
        GL11.glTranslatef(0.0f, -0.25f, 0.0f);
        GL11.glRotatef(180F, 0, 0, 1);
        GL11.glRotatef(-90.0f, 0.0f, 1.0f, 0.0f);
        skullOverlayBox.render(1 / 16f);
    }
    GL11.glPopMatrix();
}

From source file:buildcraft.robotics.render.RobotStationItemRenderer.java

License:Minecraft Mod Public

@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
    switch (type) {
    case ENTITY:/*from  w w w . j a v a2  s  .c  o  m*/
        GL11.glScalef(0.50F, 0.50F, 0.50F);
        renderPlugItem((RenderBlocks) data[0], item, -0.6F, 0f, -0.6F);
        break;
    case EQUIPPED:
    case EQUIPPED_FIRST_PERSON:
        GL11.glRotatef(70, 0, 0, 1F);
        GL11.glRotatef(-55, 1, 0, 0);
        GL11.glScalef(2F, 2F, 2F);
        GL11.glTranslatef(0, -0.6F, -0.4F);
        renderPlugItem((RenderBlocks) data[0], item, 0F, 0F, 0f);
        break;
    case INVENTORY:
        GL11.glScalef(1.1F, 1.1F, 1.1F);
        renderPlugItem((RenderBlocks) data[0], item, -0.3f, -0.35f, -0.7f);
        break;
    default:
    }
}

From source file:buildcraft.robots.render.RenderRobot.java

License:Minecraft Mod Public

private void doRender(EntityRobot robot, double x, double y, double z) {
    GL11.glPushMatrix();//w  ww  .  j  a v  a 2 s .c  o m
    GL11.glTranslated(x, y, z);

    if (robot.getStackInSlot(0) != null) {
        GL11.glPushMatrix();
        GL11.glTranslatef(-0.125F, 0, -0.125F);
        doRenderItem(robot.getStackInSlot(0));
        GL11.glPopMatrix();
    }

    if (robot.getStackInSlot(1) != null) {
        GL11.glPushMatrix();
        GL11.glTranslatef(+0.125F, 0, -0.125F);
        doRenderItem(robot.getStackInSlot(1));
        GL11.glPopMatrix();
    }

    if (robot.getStackInSlot(2) != null) {
        GL11.glPushMatrix();
        GL11.glTranslatef(+0.125F, 0, +0.125F);
        doRenderItem(robot.getStackInSlot(2));
        GL11.glPopMatrix();
    }

    if (robot.getStackInSlot(3) != null) {
        GL11.glPushMatrix();
        GL11.glTranslatef(-0.125F, 0, +0.125F);
        doRenderItem(robot.getStackInSlot(3));
        GL11.glPopMatrix();
    }

    if (robot.itemInUse != null) {
        GL11.glPushMatrix();

        GL11.glRotatef((float) (-robot.itemAngle1 / (2 * Math.PI) * 360) + 180, 0, 1, 0);
        GL11.glRotatef((float) (robot.itemAngle2 / (2 * Math.PI) * 360), 0, 0, 1);

        if (robot.itemActive) {
            long newDate = new Date().getTime();
            robot.itemActiveStage = (robot.itemActiveStage + (newDate - robot.lastUpdateTime) / 10) % 45;
            GL11.glRotatef(robot.itemActiveStage, 0, 0, 1);
            robot.lastUpdateTime = newDate;
        }

        GL11.glTranslatef(-0.4F, 0, 0);
        GL11.glRotatef(-45F + 180F, 0, 1, 0);
        GL11.glScalef(0.8F, 0.8F, 0.8F);

        ItemStack itemstack1 = robot.itemInUse;

        if (itemstack1.getItem().requiresMultipleRenderPasses()) {
            for (int k = 0; k < itemstack1.getItem().getRenderPasses(itemstack1.getItemDamage()); ++k) {
                RenderUtils.setGLColorFromInt(itemstack1.getItem().getColorFromItemStack(itemstack1, k));
                this.renderManager.itemRenderer.renderItem(robot, itemstack1, k);
            }
        } else {
            RenderUtils.setGLColorFromInt(itemstack1.getItem().getColorFromItemStack(itemstack1, 0));
            this.renderManager.itemRenderer.renderItem(robot, itemstack1, 0);
        }

        GL11.glColor3f(1, 1, 1);
        GL11.glPopMatrix();
    }

    if (robot.laser.isVisible) {
        robot.laser.head.x = robot.posX;
        robot.laser.head.y = robot.posY;
        robot.laser.head.z = robot.posZ;

        RenderLaser.doRenderLaser(renderManager.renderEngine, robot.laser, EntityLaser.LASER_TEXTURES[1]);
    }

    if (robot.getTexture() != null) {
        renderManager.renderEngine.bindTexture(robot.getTexture());
        doRenderRobot(1F / 16F, renderManager.renderEngine);
    }

    GL11.glPopMatrix();
}

From source file:buildcraft.transport.render.GateItemRenderer.java

License:Minecraft Mod Public

private void renderAsEntity(ItemStack stack, EntityItem entity) {
    GL11.glPushMatrix();//from   www .  j a  v a2s .c o m
    byte iterations = 1;
    if (stack.stackSize > 1) {
        iterations = 2;
    }
    if (stack.stackSize > 15) {
        iterations = 3;
    }
    if (stack.stackSize > 31) {
        iterations = 4;
    }

    Random rand = new Random(187L);

    float offsetZ = 0.0625F + 0.021875F;

    GL11.glRotatef(((entity.age + 1.0F) / 20.0F + entity.hoverStart) * (180F / (float) Math.PI), 0.0F, 1.0F,
            0.0F);
    GL11.glTranslatef(-0.5F, -0.25F, -(offsetZ * iterations / 2.0F));

    for (int count = 0; count < iterations; ++count) {
        if (count > 0) {
            float offsetX = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
            float offsetY = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
            float z = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
            GL11.glTranslatef(offsetX, offsetY, offsetZ);
        } else {
            GL11.glTranslatef(0f, 0f, offsetZ);
        }

        renderIn3D(stack);
    }
    GL11.glPopMatrix();
}

From source file:buildcraft.transport.render.GateItemRenderer.java

License:Minecraft Mod Public

private void renderAsEntityFlat(ItemStack stack) {
    GL11.glPushMatrix();/*from  ww  w.j av  a 2 s.c o m*/
    byte iterations = 1;
    if (stack.stackSize > 1) {
        iterations = 2;
    }
    if (stack.stackSize > 15) {
        iterations = 3;
    }
    if (stack.stackSize > 31) {
        iterations = 4;
    }

    Random rand = new Random(187L);

    for (int ii = 0; ii < iterations; ++ii) {
        GL11.glPushMatrix();
        GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(180 - RenderManager.instance.playerViewY, 0.0F, 1.0F, 0.0F);

        if (ii > 0) {
            float var12 = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F;
            float var13 = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F;
            float var14 = (rand.nextFloat() * 2.0F - 1.0F) * 0.3F;
            GL11.glTranslatef(var12, var13, var14);
        }

        GL11.glTranslatef(0.5f, 0.8f, 0);
        GL11.glRotatef(180.0F, 0.0F, 0.0F, 1.0F);
        GL11.glScalef(1f / 16f, 1f / 16f, 1);

        render(ItemRenderType.ENTITY, stack);
        GL11.glPopMatrix();
    }
    GL11.glPopMatrix();
}