Java Code Examples for net.minecraft.client.renderer.texture.TextureManager#bindTexture()

The following examples show how to use net.minecraft.client.renderer.texture.TextureManager#bindTexture() . 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: BeefGuiGrabTarget.java    From BigReactors with MIT License 6 votes vote down vote up
@Override
public void drawForeground(TextureManager renderEngine, int mouseX, int mouseY) {
	if(grabbable != null) {
		renderEngine.bindTexture(TextureMap.locationBlocksTexture);
		GL11.glColor4f(1f, 1f, 1f, 1f);
		this.guiContainer.drawTexturedModelRectFromIcon(relativeX, relativeY, grabbable.getIcon(), width, height);
	}
	
	if(this.isMouseOver(mouseX, mouseY)) {
		if(this.guiContainer.getGrabbedItem() != null && isAcceptedGrab(this.guiContainer.getGrabbedItem())) {
			this.drawRect(this.relativeX, this.relativeY, this.relativeX+this.width, this.relativeY+this.height, invalidHoverColor);
		}
		else {
			this.drawRect(this.relativeX, this.relativeY, this.relativeX+this.width, this.relativeY+this.height, hoverColor);
		}
	}
}
 
Example 2
Source File: GuiTFCompressor.java    From TofuCraftReload with MIT License 6 votes vote down vote up
/**
 * Draws the background layer of this container (behind the items).
 */
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {

    TextureManager manager = this.mc.getTextureManager();
    manager.bindTexture(TXTURE);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int var5 = (this.width - this.xSize) / 2;
    int var6 = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
    int var7,var8;
    var8 = this.getEnergyScaled(55);
    this.drawTexturedModalRect(var5 + 56, var6 + 55, 176, 31, var8 , 8);
    
    // Progress arrow
    var7 = this.getProgressScaled(28);
    this.drawTexturedModalRect(var5 + 68, var6 + 15, 176, 14, var7 + 1, 17);
    
    if(this.tileFurnace.getField(0)>0)
      this.drawTexturedModalRect(var5 + 72, var6 + 35, 176, 39, 24, 16);
}
 
Example 3
Source File: GuiTFCrasher.java    From TofuCraftReload with MIT License 6 votes vote down vote up
/**
 * Draws the background layer of this container (behind the items).
 */
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {

    TextureManager manager = this.mc.getTextureManager();
    manager.bindTexture(TXTURE);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int var5 = (this.width - this.xSize) / 2;
    int var6 = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
    int var7,var8;
    var8 = this.getEnergyScaled(55);
    this.drawTexturedModalRect(var5 + 56, var6 + 55, 176, 31, var8 , 8);
    
    // Progress arrow
    var7 = this.getProgressScaled(28);
    this.drawTexturedModalRect(var5 + 68, var6 + 15, 176, 14, var7 + 1, 17);
    
    if(this.tileFurnace.getField(0)>0)
      this.drawTexturedModalRect(var5 + 72, var6 + 35, 176, 39, 24, 16);
}
 
Example 4
Source File: BeefGuiIconProgressBar.java    From BigReactors with MIT License 6 votes vote down vote up
@Override
protected void drawProgressBar(Tessellator tessellator, TextureManager renderEngine, int barMinX, int barMaxX, int barMinY, int barMaxY, int zLevel) {
	IIcon progressBarIcon = getProgressBarIcon();
	if(progressBarIcon == null) {
		return;
	}

	double minU = progressBarIcon.getMinU();
	double minV = progressBarIcon.getMinV();
	double maxU = progressBarIcon.getMaxU();
	double maxV = progressBarIcon.getMaxV();
	
	renderEngine.bindTexture(getResourceLocation());
	
	// Draw the bar in 16-pixel slices from the bottom up.
	for(int slicedBarY = barMaxY; slicedBarY > 0; slicedBarY -= 16) {
		int slicedBarHeight = (int)Math.min(slicedBarY - barMinY, 16.0f);
		tessellator.startDrawingQuads();
		tessellator.addVertexWithUV(barMinX, slicedBarY, zLevel, minU, minV + (maxV - minV) * slicedBarHeight / 16.0f);
		tessellator.addVertexWithUV(barMaxX, slicedBarY, zLevel, maxU, minV + (maxV - minV) * slicedBarHeight / 16.0f);
		tessellator.addVertexWithUV(barMaxX, slicedBarY - slicedBarHeight, zLevel, maxU, minV);
		tessellator.addVertexWithUV(barMinX, slicedBarY - slicedBarHeight, zLevel, minU, minV);
		tessellator.draw();
	}
}
 
Example 5
Source File: GuiTFBattery.java    From TofuCraftReload with MIT License 6 votes vote down vote up
/**
     * Draws the background layer of this container (behind the items).
     */
    @Override
    protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {

        TextureManager manager = this.mc.getTextureManager();
        manager.bindTexture(TXTURE);
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        int var5 = (this.width - this.xSize) / 2;
        int var6 = (this.height - this.ySize) / 2;
        this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
//        int var7;
        if (this.tileBattery.inputTank.getFluid() != null) {
            FluidTank fluidTank = this.tileBattery.inputTank;
            int heightInd = (int) (72 * ((float) fluidTank.getFluidAmount() / (float) fluidTank.getCapacity()));
            if (heightInd > 0) {
                ClientUtils.drawRepeatedFluidSprite(fluidTank.getFluid(), var5 + 167 - 47 - heightInd, var6 + 54, heightInd, 16f);
            }

        }

    }
 
Example 6
Source File: EndPortalRenderer.java    From Wizardry with GNU Lesser General Public License v3.0 5 votes vote down vote up
private static void bindTexture(ResourceLocation location) {
	TextureManager texturemanager = Minecraft.getMinecraft().renderEngine;

	if (texturemanager != null) {
		texturemanager.bindTexture(location);
	}
}
 
Example 7
Source File: BeefGuiProgressArrow.java    From BigReactors with MIT License 5 votes vote down vote up
@Override
public void drawBackground(TextureManager renderEngine, int mouseX, int mouseY) {
	if(entity.getCycleCompletion() > 0.0) {
		int progressWidth = (int)(entity.getCycleCompletion() * (float)(this.width-1));
		renderEngine.bindTexture(this.guiContainer.getGuiBackground());
		guiContainer.drawTexturedModalRect(this.absoluteX, this.absoluteY, arrowU, arrowV, 1+progressWidth, this.height);
	}
}
 
Example 8
Source File: BeefGuiGrabSource.java    From BigReactors with MIT License 5 votes vote down vote up
@Override
public void drawForeground(TextureManager renderEngine, int mouseX, int mouseY) {
	if(this.grabbable != null) {
		renderEngine.bindTexture( TextureMap.locationBlocksTexture );
		GL11.glColor4f(1f, 1f, 1f, 1f);
		this.guiContainer.drawTexturedModelRectFromIcon(relativeX, relativeY, grabbable.getIcon(), width, height);
	}
	else {
		this.drawRect(this.relativeX, this.relativeY, this.relativeX+this.width, this.relativeY+this.height, 0x66ff0000); // Red error spot			
	}
	
	if(this.isMouseOver(mouseX, mouseY)) {
		this.drawRect(this.relativeX, this.relativeY, this.relativeX+this.width, this.relativeY+this.height, hoverColor);
	}
}
 
Example 9
Source File: LiquidIcon.java    From OpenPeripheral-Addons with MIT License 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
protected void drawContents(RenderState renderState, float partialTicks) {
	if (fluidIcon == null || iconWidth <= 0 || iconHeight <= 0) return;

	renderState.setupTexturedRender();
	renderState.setColor(0xFFFFFF, alpha);

	TextureManager render = FMLClientHandler.instance().getClient().renderEngine;
	render.bindTexture(TextureMap.locationBlocksTexture);
	float xIterations = width / iconWidth;
	float yIterations = height / iconHeight;

	for (float xIteration = 0; xIteration < xIterations; xIteration += 1) {
		for (float yIteration = 0; yIteration < yIterations; yIteration += 1) {
			// Draw whole or partial
			final float xDrawSize = Math.min(xIterations - xIteration, 1);
			final float yDrawSize = Math.min(yIterations - yIteration, 1);

			GlassesRenderingUtils.drawTexturedQuad(
					xIteration * iconWidth,
					yIteration * iconHeight,
					fluidIcon,
					xDrawSize * iconWidth,
					yDrawSize * iconHeight,
					xDrawSize,
					yDrawSize);
		}
	}
}
 
Example 10
Source File: GuiHelper.java    From LunatriusCore with MIT License 5 votes vote down vote up
public static void drawItemStackSlot(final TextureManager textureManager, final int x, final int y) {
    textureManager.bindTexture(Gui.STAT_ICONS);

    final Tessellator tessellator = Tessellator.getInstance();
    final BufferBuilder buffer = tessellator.getBuffer();
    final double uScale = 1.0 / 128.0;
    final double vScale = 1.0 / 128.0;

    GlStateManager.color(1.0f, 1.0f, 1.0f, 1.0f);
    buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    drawTexturedRectangle(buffer, x + 1, y + 1, x + 1 + 18, y + 1 + 18, 0, uScale * 0, vScale * 0, uScale * 18, vScale * 18);
    tessellator.draw();
}
 
Example 11
Source File: BeefGuiInsertionProgressBar.java    From BigReactors with MIT License 5 votes vote down vote up
@Override
public void drawBackground(TextureManager renderEngine, int mouseX, int mouseY) {
	if(!this.visible) { return; }

	// Draw the background
	GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	renderEngine.bindTexture(controlResource);
	Tessellator tessellator = Tessellator.instance;
	tessellator.startDrawingQuads();
	tessellator.addVertexWithUV(this.absoluteX, this.absoluteY + this.height, 0, backgroundLeftU, 1.0);
	tessellator.addVertexWithUV(this.absoluteX + this.width, this.absoluteY + this.height, 0, backgroundRightU, 1.0);
	tessellator.addVertexWithUV(this.absoluteX + this.width, this.absoluteY, 0, backgroundRightU, 0);
	tessellator.addVertexWithUV(this.absoluteX, this.absoluteY, 0, backgroundLeftU, 0);
	tessellator.draw();
	
	// Draw the rod itself, on top of the background
	if(insertion > 0f) {
		int barHeight = Math.max(1, (int)Math.floor(insertion * barAbsoluteMaxHeight));
		int rodMaxY = this.absoluteY + barHeight;
		
		float rodTopV = 1f - insertion; // TODO
		
		tessellator.startDrawingQuads();
		tessellator.addVertexWithUV(this.absoluteX, rodMaxY, 2, rodLeftU, 1f);
		tessellator.addVertexWithUV(this.absoluteX + this.width, rodMaxY, 2, rodRightU, 1f);
		tessellator.addVertexWithUV(this.absoluteX + this.width, this.absoluteY, 2, rodRightU, rodTopV);
		tessellator.addVertexWithUV(this.absoluteX, this.absoluteY, 2, rodLeftU, rodTopV);
		tessellator.draw();
	}
}
 
Example 12
Source File: RenderItemHook.java    From SkyblockAddons with MIT License 5 votes vote down vote up
public static void renderToxicArrowPoisonEffect(IBakedModel model, ItemStack stack) {
    SkyblockAddons main = SkyblockAddons.getInstance();

    if (main.getUtils().isOnSkyblock() && main.getConfigValues().isEnabled(Feature.TURN_BOW_GREEN_WHEN_USING_TOXIC_ARROW_POISON)
            && main.getInventoryUtils().isUsingToxicArrowPoison() && Items.bow.equals(stack.getItem()) && main.getUtils().itemIsInHotbar(stack)) {
        TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();

        GlStateManager.depthMask(false);
        GlStateManager.depthFunc(514);
        GlStateManager.disableLighting();
        GlStateManager.blendFunc(768, 1);
        textureManager.bindTexture(BLANK);
        GlStateManager.matrixMode(5890);

        GlStateManager.pushMatrix();

        Minecraft.getMinecraft().getRenderItem().renderModel(model, 0x201cba41);
        GlStateManager.popMatrix();

        GlStateManager.matrixMode(5888);
        GlStateManager.blendFunc(770, 771);
        GlStateManager.enableLighting();
        GlStateManager.depthFunc(515);
        GlStateManager.depthMask(true);
        textureManager.bindTexture(TextureMap.locationBlocksTexture);
    }
}
 
Example 13
Source File: BeefGuiVerticalProgressBar.java    From BigReactors with MIT License 5 votes vote down vote up
@Override
public void drawBackground(TextureManager renderEngine, int mouseX, int mouseY) {
	if(!this.visible) { return; }

	// Draw the background
	GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
	renderEngine.bindTexture(controlResource);
	Tessellator tessellator = Tessellator.instance;
	tessellator.startDrawingQuads();
	tessellator.addVertexWithUV(this.absoluteX, this.absoluteY + this.height, 0, backgroundLeftU, 1.0);
	tessellator.addVertexWithUV(this.absoluteX + this.width, this.absoluteY + this.height, 0, backgroundRightU, 1.0);
	tessellator.addVertexWithUV(this.absoluteX + this.width, this.absoluteY, 0, backgroundRightU, 0);
	tessellator.addVertexWithUV(this.absoluteX, this.absoluteY, 0, backgroundLeftU, 0);
	tessellator.draw();
	
	float progress = getProgress();
	// Draw the bar itself, on top of the background
	if(progress > 0.0) {
		int barHeight = Math.max(1, (int)Math.floor(progress * barAbsoluteMaxHeight));
		int barMinX = this.absoluteX + 1;
		int barMaxX = this.absoluteX + this.width - 4;
		int barMinY = this.absoluteY + this.height - barHeight;
		int barMaxY = this.absoluteY + this.height - 1;
		
		this.drawProgressBar(tessellator, renderEngine, barMinX, barMaxX, barMinY, barMaxY, 1);
	}
	
	if(drawGradationMarks()) {
		GL11.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
		renderEngine.bindTexture(controlResource);
		tessellator.startDrawingQuads();
		tessellator.addVertexWithUV(this.absoluteX, this.absoluteY + this.height, 2, gradationLeftU, 1.0);
		tessellator.addVertexWithUV(this.absoluteX + this.width - 4, this.absoluteY + this.height, 2, gradationRightU, 1.0);
		tessellator.addVertexWithUV(this.absoluteX + this.width - 4, this.absoluteY, 2, gradationRightU, 0);
		tessellator.addVertexWithUV(this.absoluteX, this.absoluteY, 2, gradationLeftU, 0);
		tessellator.draw();
	}
}
 
Example 14
Source File: GuiTFStorage.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Draws the background layer of this container (behind the items).
 */
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {

    TextureManager manager = this.mc.getTextureManager();
    manager.bindTexture(TXTURE);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int var5 = (this.width - this.xSize) / 2;
    int var6 = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
    int var7,var8;
    var8 = this.getEnergyScaled(55);
    this.drawTexturedModalRect(var5 + 87, var6 + 34, 176, 31, var8 , 8);

    // Progress arrow
    var7 = this.tileFurnace.getProgressScaled(24);
    this.drawTexturedModalRect(var5 + 53, var6 + 30, 176, 15, var7 + 1, 16);

    if (this.tileFurnace.getTank().getFluid() != null) {
        FluidTank fluidTank = this.tileFurnace.getTank();
        int heightInd = (int) (41 * ((float) fluidTank.getFluidAmount() / (float) fluidTank.getCapacity()));
        if (heightInd > 0) {
        	this.drawTexturedModalRect(var5 + 9, var6 + 52 - heightInd, 176, 40, 9, heightInd);
        }

    }
}
 
Example 15
Source File: GuiTFAggreagator.java    From TofuCraftReload with MIT License 5 votes vote down vote up
/**
 * Draws the background layer of this container (behind the items).
 */
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {

    TextureManager manager = this.mc.getTextureManager();
    manager.bindTexture(TXTURE);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int var5 = (this.width - this.xSize) / 2;
    int var6 = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
    int var7,var8;
    var8 = this.getEnergyScaled(55);
    this.drawTexturedModalRect(var5 + 61, var6 + 58, 176, 31, var8 , 8);
    
    // Progress arrow
    var7 = this.getProgressScaled(55);
    this.drawTexturedModalRect(var5 + 62, var6 + 16, 176, 31, var7, 8);
    
    if (this.tileFurnace.getTank().getFluid() != null) {
        FluidTank fluidTank = this.tileFurnace.getTank();
        int heightInd = (int) (55 * ((float) fluidTank.getFluidAmount() / (float) fluidTank.getCapacity()));
        if (heightInd > 0) {
        	this.drawTexturedModalRect(var5 + 18, var6 + 66 - heightInd, 176, 39, 9, heightInd);
        }

    }
}
 
Example 16
Source File: SkyblockAddonsGui.java    From SkyblockAddons with MIT License 5 votes vote down vote up
/**
 * Draws the default text at the top at bottoms of the GUI.
 * @param gui The gui to draw the text on.
 */
static void drawDefaultTitleText(GuiScreen gui, int alpha) {
    int defaultBlue = SkyblockAddons.getInstance().getUtils().getDefaultBlue(alpha);

    int height = 90;
    int width = height*2;
    ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());

    TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();

    SkyblockAddons.getInstance().getUtils().enableStandardGLOptions();
    textureManager.bindTexture(LOGO);
    SkyblockAddons.getInstance().getUtils().drawModalRectWithCustomSizedTexture(scaledResolution.getScaledWidth()/2F-width/2F, 3, 0, 0, width, height, width, height, true);

    int animationMillis = 4000;
    float glowAlpha;
    glowAlpha = System.currentTimeMillis()%animationMillis;
    if (glowAlpha > animationMillis/2F) {
        glowAlpha = (animationMillis-glowAlpha)/(animationMillis/2F);
    } else {
        glowAlpha = glowAlpha/(animationMillis/2F);
    }

    GlStateManager.color(1,1,1, glowAlpha);
    textureManager.bindTexture(LOGO_GLOW);
    SkyblockAddons.getInstance().getUtils().drawModalRectWithCustomSizedTexture(scaledResolution.getScaledWidth()/2F-width/2F, 3, 0, 0, width, height, width, height, true);

    GlStateManager.color(1,1,1, 1);
    String version = "v" + SkyblockAddons.VERSION.replace("beta", "b") + " by Biscut";
    drawScaledString(gui, version, 55, defaultBlue, 1.3, 170 - Minecraft.getMinecraft().fontRendererObj.getStringWidth(version), false);

    if (gui instanceof SkyblockAddonsGui) {
        drawScaledString(gui, "Special Credits: InventiveTalent - Magma Boss Timer API", gui.height - 22, defaultBlue, 1, 0);
    }
    SkyblockAddons.getInstance().getUtils().restoreGLOptions();
}
 
Example 17
Source File: ItemBowRenderer.java    From Et-Futurum with The Unlicense 4 votes vote down vote up
@Override
public void renderItem(ItemRenderType type, ItemStack stack, Object... data) {
	TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
	ResourceLocation resource = textureManager.getResourceLocation(stack.getItemSpriteNumber());

	EntityPlayer player = Minecraft.getMinecraft().thePlayer;
	ItemStack usingItem = player.getItemInUse();
	int useRemaining = player.getItemInUseCount();

	ItemBow bow = (ItemBow) stack.getItem();

	IIcon icon = bow.getIcon(stack, 0);
	if (usingItem != null && usingItem == stack) {
		int charge = stack.getMaxItemUseDuration() - useRemaining;
		if (charge >= 18)
			icon = bow.getItemIconForUseDuration(2);
		else if (charge > 13)
			icon = bow.getItemIconForUseDuration(1);
		else if (charge > 0)
			icon = bow.getItemIconForUseDuration(0);
	}
	if (icon == null)
		icon = ((TextureMap) textureManager.getTexture(resource)).getAtlasSprite("missingno");

	OpenGLHelper.pushMatrix();
	textureManager.bindTexture(resource);

	OpenGLHelper.colour(bow.getColorFromItemStack(stack, 0));

	OpenGLHelper.disableLighting();
	OpenGLHelper.enableAlpha();
	OpenGLHelper.enableBlend();
	OpenGlHelper.glBlendFunc(770, 771, 1, 0);

	renderItem.renderIcon(0, 0, icon, 16, 16);

	OpenGLHelper.enableLighting();
	OpenGLHelper.disableAlpha();
	OpenGLHelper.disableBlend();

	if (stack.hasEffect(0))
		renderItem.renderEffect(textureManager, 0, 0);

	OpenGLHelper.popMatrix();
}
 
Example 18
Source File: RenderLaser.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
public void render(float partialTicks, double x1, double y1, double z1, double x2, double y2, double z2){
    Minecraft mc = FMLClientHandler.instance().getClient();
    TextureManager textureManager = mc.renderEngine;

    double laserLength = PneumaticCraftUtils.distBetween(x1, y1, z1, x2, y2, z2);
    double laserSize = 0.4;

    GL11.glDisable(GL11.GL_LIGHTING);
    GL11.glDisable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

    GL11.glTranslated(x1, y1, z1);

    double dx = x2 - x1;
    double dy = y2 - y1;
    double dz = z2 - z1;
    float f3 = MathHelper.sqrt_double(dx * dx + dz * dz);
    double rotYaw = Math.atan2(dx, dz) * 180.0D / Math.PI;
    double rotPitch = 90 - (float)(Math.atan2(dy, f3) * 180.0D / Math.PI);

    GL11.glRotated(rotYaw, 0, 1, 0);
    GL11.glRotated(rotPitch, 1, 0, 0);

    GL11.glScaled(laserSize, laserSize, laserSize);
    GL11.glTranslated(0, 0.6, 0);
    GL11.glRotated((ticksExisted + partialTicks) * 200, 0, 1, 0);

    GL11.glPushMatrix();
    GL11.glScaled(1, laserLength / laserSize, 1);

    /*   GL11.glTranslated(0, -0.01, 0);
       textureManager.bindTexture(Textures.RENDER_LASER_ANIMATION);
       renderAnimation(partialTicks, laserLength / laserSize);
       GL11.glTranslated(0, 0.01, 0);*/

    textureManager.bindTexture(Textures.RENDER_LASER);
    renderQuad(glowColor);
    textureManager.bindTexture(Textures.RENDER_LASER_OVERLAY);
    renderQuad(coreColor);
    GL11.glPopMatrix();

    GL11.glRotated(180, 1, 0, 0);
    textureManager.bindTexture(Textures.RENDER_LASER_START);
    renderQuad(glowColor);
    textureManager.bindTexture(Textures.RENDER_LASER_START_OVERLAY);
    renderQuad(coreColor);

    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_CULL_FACE);
    GL11.glEnable(GL11.GL_LIGHTING);

    GL11.glColor4d(1, 1, 1, 1);
}
 
Example 19
Source File: GuiSaltFurnace.java    From TofuCraftReload with MIT License 4 votes vote down vote up
/**
 * Draws the background layer of this container (behind the items).
 */
@Override
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {

    TextureManager manager = this.mc.getTextureManager();
    manager.bindTexture(TXTURE);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
    int var5 = (this.width - this.xSize) / 2;
    int var6 = (this.height - this.ySize) / 2;
    this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);
    int var7;

    // Flame
    if (this.tileFurnace.isBurning()) {
        var7 = this.tileFurnace.getBurnTimeRemainingScaled(12);
        this.drawTexturedModalRect(var5 + 23, var6 + 36 + 12 - var7, 176, 12 - var7, 14, var7 + 2);
    }

    // Progress arrow
    var7 = this.tileFurnace.getCookProgressScaled(24);
    this.drawTexturedModalRect(var5 + 46, var6 + 34, 176, 14, var7 + 1, 16);

    // Cauldron
    var7 = this.tileFurnace.getCauldronStatus();
    if (var7 < 0) {
        this.drawTexturedModalRect(var5 + 23, var6 + 17, 176, 31, 16, 16);
    } else if (var7 == 1) {
        this.drawTexturedModalRect(var5 + 23, var6 + 17, 192, 31, 16, 16);
    } else if (var7 >= 2) {
        this.drawTexturedModalRect(var5 + 23, var6 + 17, 208, 31, 16, 16);
    }

    // Nigari Gauge
    if (this.tileFurnace.getNigariTank().getFluid() != null) {
        FluidTank fluidTank = this.tileFurnace.getNigariTank();
        int heightInd = (int) (35 * ((float) fluidTank.getFluidAmount() / (float) fluidTank.getCapacity()));
        if (heightInd > 0) {
            manager.bindTexture(NIGARI);
            int time = (int)this.mc.world.getWorldTime()%64/2;
            GuiSaltFurnace.drawModalRectWithCustomSizedTexture(var5 + 114, var6 + 64 - heightInd, 0.0f, 16*time, 6, heightInd, 16, 512);
        }
    }
}
 
Example 20
Source File: BeefGuiFuelMixBar.java    From BigReactors with MIT License 4 votes vote down vote up
@Override
protected void drawProgressBar(Tessellator tessellator,
		TextureManager renderEngine, int barMinX, int barMaxX, int barMinY,
		int barMaxY, int zLevel) {

	int barMaxHeight = this.height - 1;
	int barHeight = Math.max(1, Math.round(getProgress() * barMaxHeight));

	double fullness = (double)(entity.getFuelAmount() + entity.getWasteAmount()) / (double)entity.getCapacity();
	double fuelProportion = (double)entity.getFuelAmount() / (double)(entity.getFuelAmount() + entity.getWasteAmount());
	double wasteProportion = (double)entity.getWasteAmount() / (double)(entity.getFuelAmount() + entity.getWasteAmount());

	renderEngine.bindTexture(controlResource);
	if(fuelProportion > 0) {
		double fuelMinV = 1.0 - fullness*maxV;
		double fuelMaxV = maxV;
		tessellator.startDrawingQuads();
		tessellator.addVertexWithUV(this.absoluteX, this.absoluteY + this.height - 1, zLevel, fuelLeftU, fuelMaxV);
		tessellator.addVertexWithUV(this.absoluteX + this.width, this.absoluteY + this.height - 1, zLevel, fuelRightU, fuelMaxV);
		tessellator.addVertexWithUV(this.absoluteX + this.width, this.absoluteY + this.height - barHeight, zLevel, fuelRightU, fuelMinV);
		tessellator.addVertexWithUV(this.absoluteX, this.absoluteY + this.height - barHeight, zLevel, fuelLeftU, fuelMinV);
		tessellator.draw();
	}
	
	if(wasteProportion > 0) {
		double wasteMinV = 1.0 - fullness * wasteProportion * maxV;
		double wasteMaxV = maxV;
		double wasteHeight = Math.round(barHeight * wasteProportion);
		
		if(wasteHeight > 0) {
			double wasteTop = this.absoluteY + this.height - 1 - wasteHeight;
			
			tessellator.startDrawingQuads();
			tessellator.addVertexWithUV(this.absoluteX, this.absoluteY + this.height - 1, zLevel+1, wasteLeftU, wasteMaxV);
			tessellator.addVertexWithUV(this.absoluteX + this.width, this.absoluteY + this.height - 1, zLevel+1, wasteRightU, wasteMaxV);
			tessellator.addVertexWithUV(this.absoluteX + this.width, wasteTop, zLevel+1, wasteRightU, wasteMinV);
			tessellator.addVertexWithUV(this.absoluteX, wasteTop, zLevel+1, wasteLeftU, wasteMinV);
			tessellator.draw();
		}
	}
}