Java Code Examples for org.lwjgl.opengl.GL11#glRotatef()

The following examples show how to use org.lwjgl.opengl.GL11#glRotatef() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MoCRenderDeer.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
protected void rotateDeer(MoCEntityDeer entitydeer)
{
    if (!entitydeer.onGround && (entitydeer.getMoveSpeed() > 2.0F))
    {
        if (entitydeer.motionY > 0.5D)
        {
            GL11.glRotatef(20F, -1F, 0.0F, 0.0F);
        }
        else if (entitydeer.motionY < -0.5D)
        {
            GL11.glRotatef(-20F, -1F, 0.0F, 0.0F);
        }
        else
        {
            GL11.glRotatef((float) (entitydeer.motionY * 40D), -1F, 0.0F, 0.0F);
        }
    }
}
 
Example 2
Source File: ItemNodeRenderer.java    From Gadomancy with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void renderNodeItem(IItemRenderer.ItemRenderType type, ItemStack item, AspectList aspects, NodeType nodeType, NodeModifier nodeModifier, Object... data) {
    if (type == IItemRenderer.ItemRenderType.ENTITY) {
        GL11.glTranslatef(-0.5F, -0.25F, -0.5F);
    } else if ((type == IItemRenderer.ItemRenderType.EQUIPPED) && ((data[1] instanceof EntityPlayer))) {
        GL11.glTranslatef(0.0F, 0.0F, -0.5F);
    }
    TileNode tjf = new TileNode();
    tjf.setAspects(aspects);
    tjf.setNodeType(nodeType);
    tjf.blockType = ConfigBlocks.blockAiry;
    tjf.blockMetadata = 0;
    GL11.glPushMatrix();
    GL11.glTranslated(0.5D, 0.5D, 0.5D);
    GL11.glScaled(2.0D, 2.0D, 2.0D);
    renderItemNode(tjf);
    GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
    renderItemNode(tjf);
    GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
    renderItemNode(tjf);
    GL11.glPopMatrix();
    GL11.glEnable(32826);
}
 
Example 3
Source File: GTTileDisplayScreen.java    From GT-Classic with GNU Lesser General Public License v3.0 6 votes vote down vote up
@SideOnly(Side.CLIENT)
public void applyRotation(float x, float y, float z) {
	GL11.glTranslatef((float) x + 0.5f, (float) y + 0.5f, (float) z + 0.5f);
	switch (this.facing) {
	case 2:
		GL11.glRotatef(0, 0.0F, 1.0F, 0.0F);
		GL11.glRotatef(180F, 0F, 0F, 1F);
		break;
	case 3:
		GL11.glRotatef(180, 0.0F, 1.0F, 0.0F);
		GL11.glRotatef(180F, 0F, 0F, 1F);
		break;
	case 4:
		GL11.glRotatef(90, 0.0F, 1.0F, 0.0F);
		GL11.glRotatef(180, 0.0F, 0F, 1.0F);
		break;
	case 5:
		GL11.glRotatef(270, 0.0F, 1.0F, 0.0F);
		GL11.glRotatef(180, 0.0F, 0F, 1.0F);
		break;
	}
	GL11.glTranslated(-0.5D, -0.5D, -0.5D);
}
 
Example 4
Source File: TileEntityRedererWalrus.java    From ExtraCells1 with MIT License 6 votes vote down vote up
@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTickTime)
{
	GL11.glPushMatrix();
	GL11.glTranslated(x + 0.5, y, z + 0.5);
	int orientation = tileentity.worldObj.getBlockMetadata(tileentity.xCoord, tileentity.yCoord, tileentity.zCoord);
	if (orientation == 4)
	{
		GL11.glRotatef(90, 0, 1, 0);
	} else if (orientation == 5)
	{
		GL11.glRotatef(-90, 0, 1, 0);
	} else if (orientation == 3)
	{
		GL11.glRotatef(180, 0, 1, 0);
	}
	model.render();
	GL11.glPopMatrix();
}
 
Example 5
Source File: MediumPotRenderer.java    From GardenCollection with MIT License 6 votes vote down vote up
private void renderInventoryBlock (BlockMediumPot block, int metadata, int modelId, RenderBlocks renderer) {
    IIcon icon = renderer.getBlockIconFromSideAndMetadata(block, 1, metadata & 15);

    boolean blendEnabled = GL11.glIsEnabled(GL11.GL_BLEND);
    if (blendEnabled)
        GL11.glDisable(GL11.GL_BLEND);

    boxRenderer.setUnit(.0625);
    boxRenderer.setIcon(icon);
    boxRenderer.setColor(ModularBoxRenderer.COLOR_WHITE);

    GL11.glRotatef(90, 0, 1, 0);
    GL11.glTranslatef(-.5f, -.5f, -.5f);

    boxRenderer.renderBox(null, block, 0, 0, 0, .125, 0, .125, .875, .75, .875, 0, ModularBoxRenderer.CUT_YPOS);

    if (!blendEnabled)
        GL11.glDisable(GL11.GL_BLEND);

    GL11.glTranslatef(.5f, .5f, .5f);
}
 
Example 6
Source File: RenderModelBase.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
private void render(float x, float y, float z, float scale){
    GL11.glPushMatrix();
    GL11.glRotatef(-90F, 1F, 0, 0);
    GL11.glScalef(scale, scale, scale);
    GL11.glTranslatef(x, y, z);
    GL11.glRotatef(-90F, 1F, 0, 0);
    if(model.getModelTexture(null) != null) FMLClientHandler.instance().getClient().getTextureManager().bindTexture(model.getModelTexture(null));
    //TODO refactor when all models are converted:
    if(model instanceof BaseModel) {
        GL11.glTranslated(0, 24 / 16D, 0);
        GL11.glScalef(0.0625F, 0.0625F, 0.0625F);
    }
    model.rotateModelBasedOnBlockMeta();
    model.renderDynamic(0.0625F, null, 0);
    model.renderStatic(1F / 16F, null);
    GL11.glPopMatrix();
}
 
Example 7
Source File: RenderChiselSnowman.java    From Chisel-2 with GNU General Public License v2.0 6 votes vote down vote up
protected void renderEquippedItems(EntityChiselSnowman snowman, float size){
    super.renderEquippedItems(snowman, size);
    ItemStack itemStack = snowman.getEquipmentInSlot(2);

    if(itemStack.getItem() instanceof ItemBlock){
        GL11.glPushMatrix();
        this.snowMan.head.postRender(0.0625F);

        IItemRenderer customRenderer = MinecraftForgeClient.getItemRenderer(itemStack, EQUIPPED);
        boolean is3D = (customRenderer != null && customRenderer.shouldUseRenderHelper(EQUIPPED, itemStack, BLOCK_3D));

        if(is3D || RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemStack.getItem()).getRenderType())){
            float f1 = 0.625F;
            GL11.glTranslatef(0.0F, -0.34375F, 0.0F);
            GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
            GL11.glScalef(f1, -f1, f1);
        }
        this.renderManager.itemRenderer.renderItem(snowman, itemStack, 0);
        GL11.glPopMatrix();
    }
}
 
Example 8
Source File: MoCRenderBunny.java    From mocreaturesdev with GNU General Public License v3.0 6 votes vote down vote up
protected void rotBunny(MoCEntityBunny entitybunny)
{
    if (!entitybunny.onGround && (entitybunny.ridingEntity == null))
    {
        if (entitybunny.motionY > 0.5D)
        {
            GL11.glRotatef(35F, -1F, 0.0F, 0.0F);
        }
        else if (entitybunny.motionY < -0.5D)
        {
            GL11.glRotatef(-35F, -1F, 0.0F, 0.0F);
        }
        else
        {
            GL11.glRotatef((float) (entitybunny.motionY * 70D), -1F, 0.0F, 0.0F);
        }
    }
}
 
Example 9
Source File: RenderLaser.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
@Override
public void render(TileEntity tile, double x,
		double y, double z, float f, int damage, float a) {
	TileMultiBlock multiBlockTile = (TileMultiBlock)tile;

	if(!multiBlockTile.canRender())
		return;

	GL11.glPushMatrix();

	//Initial setup

	//Rotate and move the model into position
	GL11.glTranslated(x + 0.5, y, z + 0.5);
	EnumFacing front = RotatableBlock.getFront(tile.getWorld().getBlockState(tile.getPos())); //tile.getWorldObj().getBlockMetadata(tile.xCoord, tile.yCoord, tile.zCoord));
	GL11.glRotatef((front.getFrontOffsetX() == 1 ? 180 : 0) + front.getFrontOffsetZ()*90f, 0, 1, 0);
	GL11.glTranslated(2f, 0, 0f);
	bindTexture(texture);
	model.renderAll();
	
	GL11.glPopMatrix();
}
 
Example 10
Source File: RendererRailgun.java    From AdvancedRocketry with MIT License 5 votes vote down vote up
@Override
public void render(TileEntity tile, double x,
		double y, double z, float f, int damage, float a) {
	TileRailgun multiBlockTile = (TileRailgun)tile;

	if(!multiBlockTile.canRender())
		return;

	GL11.glPushMatrix();

	//Initial setup

	GL11.glTranslated(x + 0.5, y, z + .5);
	//Rotate and move the model into position
	EnumFacing front = RotatableBlock.getFront(tile.getWorld().getBlockState(tile.getPos()));
	GL11.glRotatef((front.getFrontOffsetX() == 1 ? 180 : 0) + front.getFrontOffsetZ()*90f, 0, 1, 0);
	GL11.glTranslated(2f, 0, 0f);
	bindTexture(texture);
	
	
	if(tile.getWorld().getTotalWorldTime() - multiBlockTile.recoil - 20 <= 0) {
		model.renderOnly("Base");
		GL11.glPushMatrix();
		GL11.glTranslated(0, (-20+(tile.getWorld().getTotalWorldTime() - multiBlockTile.recoil))/50f, 0);
		model.renderOnly("Barrel");
		GL11.glPopMatrix();
	}
	else
		model.renderAll();
	
	GL11.glPopMatrix();
}
 
Example 11
Source File: RenderUtilsLiving.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public static void glSetup(double x, double y, double z) {
	GL11.glPushMatrix();
    GL11.glTranslated(x - RenderUtils.renderPos().x, y - RenderUtils.renderPos().y, z - RenderUtils.renderPos().z);
    GL11.glNormal3f(0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-mc.getRenderManager().playerViewY, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(mc.getRenderManager().playerViewX, 1.0F, 0.0F, 0.0F);
    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_DEPTH_TEST);

    GL11.glEnable(GL11.GL_BLEND);
    GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    
}
 
Example 12
Source File: RenderUtilsLiving.java    From bleachhack-1.14 with GNU General Public License v3.0 5 votes vote down vote up
public static void glSetup(double x, double y, double z) {
	GL11.glPushMatrix();
	RenderUtils.offsetRender();
    GL11.glTranslated(x, y, z);
    GL11.glNormal3f(0.0F, 1.0F, 0.0F);
    GL11.glRotatef(-mc.player.yaw, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(mc.player.pitch, 1.0F, 0.0F, 0.0F);
    //GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_DEPTH_TEST);

    GL11.glEnable(GL11.GL_BLEND);
    GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
    
}
 
Example 13
Source File: MoCRenderTurtle.java    From mocreaturesdev with GNU General Public License v3.0 5 votes vote down vote up
protected void rotateAnimal(MoCEntityTurtle entityturtle)
{
    //GL11.glRotatef(180F, -1F, 0.0F, 0.0F); //head up 180
    //GL11.glRotatef(180F, 0.0F, -1.0F, 0.0F); //head around 180

    float f = entityturtle.swingProgress * 10F * entityturtle.getFlipDirection();
    float f2 = entityturtle.swingProgress / 30 * entityturtle.getFlipDirection();
    GL11.glRotatef(180F + f, 0.0F, 0.0F, -1.0F);
    GL11.glTranslatef(0.0F - f2, 0.5F * entityturtle.getEdad() * 0.01F, 0.0F);
}
 
Example 14
Source File: RenderUtil.java    From seppuku with GNU General Public License v3.0 5 votes vote down vote up
public static void drawTriangle(float x, float y, float size, float theta, int color) {
    GL11.glTranslated(x, y, 0);
    GL11.glRotatef(180 + theta, 0F, 0F, 1.0F);

    float alpha = (float) (color >> 24 & 255) / 255.0F;
    float red = (float) (color >> 16 & 255) / 255.0F;
    float green = (float) (color >> 8 & 255) / 255.0F;
    float blue = (float) (color & 255) / 255.0F;

    GL11.glColor4f(red, green, blue, alpha);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    GL11.glBlendFunc(770, 771);
    GL11.glLineWidth(1);
    GL11.glBegin(GL11.GL_TRIANGLE_FAN);

    GL11.glVertex2d(0, (1.0F * size));
    GL11.glVertex2d((1 * size), -(1.0F * size));
    GL11.glVertex2d(-(1 * size), -(1.0F * size));

    GL11.glEnd();
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glRotatef(-180 - theta, 0F, 0F, 1.0F);
    GL11.glTranslated(-x, -y, 0);
}
 
Example 15
Source File: RenderPresent.java    From Chisel-2 with GNU General Public License v2.0 5 votes vote down vote up
private void renderInventory(float x, float y, float z) {
	GL11.glPushMatrix();
	GL11.glTranslatef(x, y, z);
	GL11.glRotatef(180F, 1F, 0, 0);
	GL11.glRotatef(-90F, 0, 1F, 0);
	GL11.glScalef(1.0F, 1.0F, 1.0F);
	smallChest.renderAll();
	GL11.glPopMatrix();
}
 
Example 16
Source File: TileEntitySurgeryChamberRenderer.java    From Cyberware with MIT License 4 votes vote down vote up
@Override
public void renderTileEntityAt(TileEntitySurgeryChamber te, double x, double y, double z, float partialTicks, int destroyStage)
{
	if (te != null)
	{
		float ticks = Minecraft.getMinecraft().thePlayer.ticksExisted + partialTicks;
		
		GL11.glPushMatrix();
		GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
		GL11.glTranslated(x+.5, y+.5, z+.5);
		
		IBlockState state = te.getWorld().getBlockState(te.getPos());
		if (state.getBlock() == CyberwareContent.surgeryChamber)
		{
			
			EnumFacing facing = state.getValue(BlockSurgeryChamber.FACING);
			
			switch (facing)
			{
				case EAST:
					GL11.glRotatef(90F, 0F, 1F, 0F);
					break;
				case NORTH:
					GL11.glRotatef(180F, 0F, 1F, 0F);
					break;
				case SOUTH:
					break;
				case WEST:
					GL11.glRotatef(270F, 0F, 1F, 0F);
					break;
				default:
					break;
			}
			ClientUtils.bindTexture(texture);

			boolean isOpen = state.getValue(BlockSurgeryChamber.OPEN);
			if (isOpen != te.lastOpen)
			{
				te.lastOpen = isOpen;
				te.openTicks = ticks;
			}
			
			float ticksPassed = Math.min(10, ticks - te.openTicks);
			float rotate = (float) (Math.sin(ticksPassed * ((Math.PI / 2) / 10F)) * 90F);
					
			if (!isOpen)
			{
				rotate = 90F - (float) (Math.sin(ticksPassed * ((Math.PI / 2) / 10F)) * 90F);
			}

			GL11.glPushMatrix();
			GL11.glTranslatef(-6F / 16F, 0F, -6F / 16F);
			GL11.glRotatef(-rotate, 0F, 1F, 0F);
			model.render(null, 0, 0, 0, 0, 0, .0625f);
			GL11.glPopMatrix();
			
			GL11.glPushMatrix();
			GL11.glTranslatef(6F / 16F, 0F, -6F / 16F);
			GL11.glRotatef(rotate, 0F, 1F, 0F);
			model.renderRight(null, 0, 0, 0, 0, 0, .0625f);
			GL11.glPopMatrix();
				
			GL11.glPopMatrix();
		}
	}
}
 
Example 17
Source File: RenderPresent.java    From Chisel-2 with GNU General Public License v2.0 4 votes vote down vote up
public void renderTileEntityAt(TileEntityPresent present, double x, double y, double z, float partialTicks) {
	GL11.glPushMatrix();
	GL11.glEnable(GL12.GL_RESCALE_NORMAL);
	GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
	GL11.glTranslatef((float) x, (float) y + 1.0F, (float) z + 1.0F);
	GL11.glScalef(1.0F, -1.0F, -1.0F);
	int rotation = present.getRotation();
	bindTexture(present);
	if (!present.isConnected()) {
		GL11.glRotatef(90 * rotation + 180, 0, 1, 0);
		switch(rotation) {
		case 0:
			GL11.glTranslatef(-1, 0, -1);
			break;
		case 1:
			GL11.glTranslatef(0, 0, -1);
			break;
		case 3:
			GL11.glTranslatef(-1, 0, 0);
			break;
		}
		smallChest.renderAll();
	} else if (present.isParent()) {
		ForgeDirection dir = present.getConnectionDir();
		switch(dir) {
		case NORTH:
			GL11.glRotatef(-90, 0, 1, 0);
			GL11.glTranslatef(0, 0, -1);
			break;
		case SOUTH:
			GL11.glRotatef(-90, 0, 1, 0);
			GL11.glTranslatef(-1, 0, -1);
			break;
		case WEST:
			GL11.glTranslatef(-1, 0, 0);
			break;
		default:
			break;
		}
		if (rotation == 0 || rotation == 3) {
			GL11.glRotatef(180, 0, 1, 0);
			GL11.glTranslatef(-2, 0, -1);
		}
		largeChest.renderAll();
	}
	GL11.glPopMatrix();
}
 
Example 18
Source File: RenderEntityVortex.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
private void renderGust(){
    byte b0 = 0;
    //float f2 = 0.0F;
    //float f3 = 0.5F;
    //float f4 = (0 + b0 * 10) / 16.0F;
    // float f5 = (5 + b0 * 10) / 16.0F;
    float f6 = 0.0F;
    float f7 = 0.15625F;
    float f8 = (5 + b0 * 10) / 16.0F;
    float f9 = (10 + b0 * 10) / 16.0F;
    float f10 = 0.05625F;
    GL11.glEnable(GL12.GL_RESCALE_NORMAL);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
    GL11.glScalef(f10, f10, f10);
    GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
    GL11.glNormal3f(f10, 0.0F, 0.0F);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();

    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f9);
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f9);

    double start = 0d;
    double end = 1 / 16d;
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, start, start);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, start, end);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, end, end);
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, end, start);
    tessellator.draw();
    GL11.glNormal3f(-f10, 0.0F, 0.0F);

    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, f6, f8);
    tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, f7, f8);
    tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, f7, f9);
    tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, f6, f9);
    tessellator.draw();

}
 
Example 19
Source File: RenderLaser.java    From Electro-Magic-Tools with GNU General Public License v3.0 4 votes vote down vote up
public void renderArrow(EntityLaser entityLaser, double par2, double par4, double par6, float par8, float par9) {

        this.bindEntityTexture(entityLaser);
        GL11.glPushMatrix();
        GL11.glTranslatef((float) par2, (float) par4, (float) par6);
        GL11.glRotatef(entityLaser.prevRotationYaw + (entityLaser.rotationYaw - entityLaser.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(entityLaser.prevRotationPitch + (entityLaser.rotationPitch - entityLaser.prevRotationPitch) * par9, 0.0F, 0.0F, 1.0F);
        Tessellator tessellator = Tessellator.instance;
        byte b0 = 0;
        float f2 = 0.4F;
        float f3 = 0.7F;
        float f4 = (float) (0 + b0 * 10) / 32.0F;
        float f5 = (float) (5 + b0 * 10) / 32.0F;
        float f6 = 0.0F;
        float f7 = 0.15625F;
        float f8 = (float) (5 + b0 * 10) / 32.0F;
        float f9 = (float) (10 + b0 * 10) / 32.0F;
        float f10 = 0.05625F;
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);

        GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.0F);
        GL11.glScalef(f10, f10, f10);
        GL11.glTranslatef(-4.0F, 0.0F, 0.0F);
        GL11.glNormal3f(f10, 0.0F, 0.0F);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f8);
        tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f8);
        tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f9);
        tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f9);
        tessellator.draw();
        GL11.glNormal3f(-f10, 0.0F, 0.0F);
        tessellator.startDrawingQuads();
        tessellator.addVertexWithUV(-7.0D, 2.0D, -2.0D, (double) f6, (double) f8);
        tessellator.addVertexWithUV(-7.0D, 2.0D, 2.0D, (double) f7, (double) f8);
        tessellator.addVertexWithUV(-7.0D, -2.0D, 2.0D, (double) f7, (double) f9);
        tessellator.addVertexWithUV(-7.0D, -2.0D, -2.0D, (double) f6, (double) f9);
        tessellator.draw();

        for (int i = 0; i < 4; ++i) {
            GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
            GL11.glNormal3f(0.0F, 0.0F, f10);
            tessellator.startDrawingQuads();
            tessellator.addVertexWithUV(-8.0D, -2.0D, 0.0D, (double) f2, (double) f4);
            tessellator.addVertexWithUV(8.0D, -2.0D, 0.0D, (double) f3, (double) f4);
            tessellator.addVertexWithUV(8.0D, 2.0D, 0.0D, (double) f3, (double) f5);
            tessellator.addVertexWithUV(-8.0D, 2.0D, 0.0D, (double) f2, (double) f5);
            tessellator.draw();
        }

        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
 
Example 20
Source File: TileEntityRendererMonitorStorageFluid.java    From ExtraCells1 with MIT License 4 votes vote down vote up
@Override
public void renderTileEntityAt(TileEntity tileentity, double x, double y, double z, float partialTickTime)
{
	if (tileentity instanceof TileEntityMonitorStorageFluid)
	{
		Fluid fluid = ((TileEntityMonitorStorageFluid) tileentity).getFluid();
		if (fluid == null || fluid.getIcon() == null)
			return;
		Icon fluidIcon = fluid.getFlowingIcon();

		GL11.glPushMatrix();
		GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);

		FontRenderer fr = Minecraft.getMinecraft().fontRenderer;
		ForgeDirection d = ForgeDirection.getOrientation(tileentity.blockMetadata);
		GL11.glTranslated(x + 0.5D, y + 0.5D, z + 0.5D);
		GL11.glTranslated(d.offsetX * 0.76D, d.offsetY * 0.76D, d.offsetZ * 0.76D);
		if (d == ForgeDirection.UP)
		{
			GL11.glScalef(1.0F, -1.0F, 1.0F);
			GL11.glRotatef(90.0F, 1.0F, 0.0F, 0.0F);
			GL11.glRotatef(90.0F, 0.0F, 0.0F, 1.0F);
		}

		if (d == ForgeDirection.DOWN)
		{
			GL11.glScalef(1.0F, -1.0F, 1.0F);
			GL11.glRotatef(-90.0F, 1.0F, 0.0F, 0.0F);
			GL11.glRotatef(-90.0F, 0.0F, 0.0F, 1.0F);
		}

		if (d == ForgeDirection.EAST)
		{
			GL11.glScalef(-1.0F, -1.0F, -1.0F);
			GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
		}

		if (d == ForgeDirection.WEST)
		{
			GL11.glScalef(-1.0F, -1.0F, -1.0F);
			GL11.glRotatef(90.0F, 0.0F, 1.0F, 0.0F);
		}

		if (d == ForgeDirection.NORTH)
		{
			GL11.glScalef(-1.0F, -1.0F, -1.0F);
		}

		if (d == ForgeDirection.SOUTH)
		{
			GL11.glScalef(-1.0F, -1.0F, -1.0F);
			GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
		}

		GL11.glTranslatef(0.01F, 0.13F, -0.24F);
		GL11.glScalef(0.0625F * 0.25F, 0.0625F * 0.25F, 0.01612903F);

		long qty = ((TileEntityMonitorStorageFluid) tileentity).getAmount();
		if (qty > 999999999999L)
		{
			qty = 999999999999L;
		}
		String msg = Long.toString(qty) + "mB";
		if (Extracells.shortenedBuckets)
		{
			if (qty > 1000000000L)
				msg = Long.toString(qty / 1000000000L) + "MegaB";
			else if (qty > 1000000L)
				msg = Long.toString(qty / 1000000L) + "KiloB";
			else if (qty > 9999L)
			{
				msg = Long.toString(qty / 1000L) + "B";
			}
		}

		TileEntityMonitorStorageFluid TE = (TileEntityMonitorStorageFluid) tileentity;
		if (TE.isMachineActive())
		{
			GL11.glTranslated(-8.6F, -16.3, -1.2F);
			Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
			Tessellator cake = Tessellator.instance;
			cake.startDrawingQuads();
			cake.setBrightness(255);
			cake.setColorRGBA_F(1.0f, 1.0f, 1.0f, 1.0f);
			cake.addVertexWithUV(0, 16, 0, fluidIcon.getMinU(), fluidIcon.getMaxV());
			cake.addVertexWithUV(16, 16, 0, fluidIcon.getMaxU(), fluidIcon.getMaxV());
			cake.addVertexWithUV(16, 0, 0, fluidIcon.getMaxU(), fluidIcon.getMinV());
			cake.addVertexWithUV(0, 0, 0, fluidIcon.getMinU(), fluidIcon.getMinV());
			cake.draw();

			int width = fr.getStringWidth(msg);
			GL11.glTranslatef(8.25F - 0.5F * width, 24.0F, 0);
			GL11.glScaled(1, 0.5, 1);
			fr.drawString(msg, 0, 0, 0x00FFFF);
		}
		GL11.glPopMatrix();
		GL11.glPopAttrib();
	}
}