net.minecraft.client.renderer.texture.TextureManager Java Examples

The following examples show how to use net.minecraft.client.renderer.texture.TextureManager. 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: 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 #2
Source File: GuiTFOven.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: BeefGuiRedNetChannelSelector.java    From BigReactors with MIT License 6 votes vote down vote up
@Override
public void drawBackground(TextureManager renderEngine, int mouseX, int mouseY) {
	int barTop = absoluteY + height/2 - (barHeight/2-1);
	int borderColor = 0xff000000;
	if(this.selected) {
		borderColor = 0xff22dd22; // bright green?
	}
	this.drawRect(absoluteX, absoluteY, absoluteX+height, absoluteY+height, borderColor);
	this.drawRect(absoluteX+width-height, absoluteY, absoluteX+width, absoluteY+height, borderColor);
	this.drawRect(absoluteX+height, barTop, absoluteX+width-height, barTop+barHeight, borderColor);
	
	float[] color = EntitySheep.fleeceColorTable[this.channelIdx];
	
	this.drawRect(absoluteX+1, absoluteY+1, absoluteX+height-1, absoluteY+height-1, color[0], color[1], color[2], 1.0f);
	this.drawRect(absoluteX+width-height+1, absoluteY+1, absoluteX+width-1, absoluteY+height-1, 0xff777777);
}
 
Example #5
Source File: ItemIcon.java    From OpenPeripheral-Addons with MIT License 6 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
protected void drawContents(RenderState renderState, float partialTicks) {
	renderState.enableTexture();
	renderState.enableDepthTest();
	renderState.enableCullFace();
	renderState.disableLight();
	renderState.setColor(0xFFFFFF, 1.0f);

	GL11.glScalef(scale, scale, scale);
	final RenderItem renderItem = getRenderItem();
	final Minecraft minecraft = Minecraft.getMinecraft();
	final TextureManager textureManager = minecraft.getTextureManager();

	renderItem.renderItemAndEffectIntoGUI(minecraft.fontRenderer, textureManager, drawStack, 0, 0);

	if (damageBar > 0 || !Strings.isNullOrEmpty(label)) {
		renderItem.renderItemOverlayIntoGUI(minecraft.fontRenderer, textureManager, dummyStack, 0, 0, label);
	}

	RenderUtils.disableLightmap();

	renderState.readState();
}
 
Example #6
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 #7
Source File: BeefGuiListBox.java    From BigReactors with MIT License 6 votes vote down vote up
@Override
public void drawForeground(TextureManager renderEngine, int mouseX, int mouseY) {
	int drawnY = 0;
	IBeefListBoxEntry entry;
	for(int i = displayTop; i < entries.size(); i++) {
		entry = entries.get(i);
		if(entry.getHeight() + drawnY > this.height) { break; }
		else {
			if(this.selectedEntryIdx == i) {
				entry.draw(this.guiContainer.getFontRenderer(), relativeX+margin, relativeY+margin+drawnY, selectedLineColor, selectedTextColor);
			}
			else {
				entry.draw(this.guiContainer.getFontRenderer(), relativeX+margin, relativeY+margin+drawnY, backgroundColor, textColor);
			}
		}
		if(drawnY >= this.height) { break; }
	}
}
 
Example #8
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 #9
Source File: BeefGuiTextureProgressBar.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) {

	double barHeight = Math.round((getProgress() * (this.height-2))) + 2;
	if(getProgress() > 0.00001) { barHeight = Math.max(getBarMinHeight(), barHeight); }

	double barMaxV = 1;
	double barMinV = 1 - Math.min(1, Math.max(0, barHeight / this.height));
	
	renderEngine.bindTexture(getBarTexture());
	tessellator.startDrawingQuads();
	tessellator.addVertexWithUV(this.absoluteX, this.absoluteY + this.height, zLevel, barLeftU, barMaxV);
	tessellator.addVertexWithUV(this.absoluteX + this.width, this.absoluteY + this.height, zLevel, barRightU, barMaxV);
	tessellator.addVertexWithUV(this.absoluteX + this.width, this.absoluteY + this.height - barHeight, zLevel, barRightU, barMinV);
	tessellator.addVertexWithUV(this.absoluteX, this.absoluteY + this.height - barHeight, zLevel, barLeftU, barMinV);
	tessellator.draw();
}
 
Example #10
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 #11
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 #12
Source File: ClientProxy.java    From Et-Futurum with The Unlicense 5 votes vote down vote up
@SuppressWarnings("unchecked")
private void registerEntityRenderers() {
	if (EtFuturum.enableArmourStand)
		RenderingRegistry.registerEntityRenderingHandler(EntityArmourStand.class, new ArmourStandRenderer());
	if (EtFuturum.enableEndermite)
		RenderingRegistry.registerEntityRenderingHandler(EntityEndermite.class, new EndermiteRenderer());
	if (EtFuturum.enableRabbit)
		RenderingRegistry.registerEntityRenderingHandler(EntityRabbit.class, new RabbitRenderer());
	if (EtFuturum.enableLingeringPotions) {
		RenderingRegistry.registerEntityRenderingHandler(EntityLingeringPotion.class, new LingeringPotionRenderer());
		RenderingRegistry.registerEntityRenderingHandler(EntityLingeringEffect.class, new LingeringEffectRenderer());
	}
	if (EtFuturum.enableVillagerZombies)
		RenderingRegistry.registerEntityRenderingHandler(EntityZombieVillager.class, new VillagerZombieRenderer());
	if (EtFuturum.enableDragonRespawn)
		RenderingRegistry.registerEntityRenderingHandler(EntityPlacedEndCrystal.class, new PlacedEndCrystalRenderer());
	if (EtFuturum.enablePlayerSkinOverlay) {
		TextureManager texManager = Minecraft.getMinecraft().renderEngine;
		File fileAssets = ReflectionHelper.getPrivateValue(Minecraft.class, Minecraft.getMinecraft(), "fileAssets", "field_110446_Y", " field_110607_c");
		File skinFolder = new File(fileAssets, "skins");
		MinecraftSessionService sessionService = Minecraft.getMinecraft().func_152347_ac();
		ReflectionHelper.setPrivateValue(Minecraft.class, Minecraft.getMinecraft(), new NewSkinManager(Minecraft.getMinecraft().func_152342_ad(), texManager, skinFolder, sessionService), "field_152350_aA");

		RenderManager.instance.entityRenderMap.put(EntityPlayer.class, new NewRenderPlayer());
	}
	if (EtFuturum.enableShearableGolems)
		RenderingRegistry.registerEntityRenderingHandler(EntityNewSnowGolem.class, new NewSnowGolemRenderer());
}
 
Example #13
Source File: GuiHelper.java    From LunatriusCore with MIT License 5 votes vote down vote up
public static void drawItemStackWithSlot(final TextureManager textureManager, final ItemStack itemStack, final int x, final int y) {
    drawItemStackSlot(textureManager, x, y);

    if (itemStack != null && itemStack.getItem() != null) {
        drawItemStack(itemStack, x + 2, y + 2);
    }
}
 
Example #14
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 #15
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 #16
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 #17
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 #18
Source File: BeefGuiGrabSource.java    From BigReactors with MIT License 5 votes vote down vote up
@Override
public void drawBackground(TextureManager renderEngine, int mouseX, int mouseY) {
	// Draw Border
	this.drawRect(absoluteX-1, absoluteY-1, absoluteX+width+1, absoluteY+height+1, 0xff222222);
	
	// Draw Background
	this.drawRect(absoluteX, absoluteY, absoluteX+width, absoluteY+height, 0xff777777);
}
 
Example #19
Source File: GuiFilter.java    From BetterChests with GNU Lesser General Public License v3.0 5 votes vote down vote up
public GuiFilter(ContainerFilter container) {
	super(container);

	GuiElementToggle isBlacklist = new GuiElementToggle(this, 96, 16, "isBlacklist");
	isBlacklist.setTexture(new IRenderable() {
		IRenderable blacklist = IRenderable.getRenderable(BlocksItemsBetterChests.filter.getBlacklistItemStack());
		IRenderable whitelist = IRenderable.getRenderable(BlocksItemsBetterChests.filter.getWhitelistItemStack());

		@Override
		public void render(int x, int y, Gui gui, TextureManager textureManager) {
			if (isBlacklist.getState()) {
				blacklist.render(x, y, gui, textureManager);
			} else {
				whitelist.render(x, y, gui, textureManager);
			}
		}
	}.offset(6, 2));
	addGuiElement(isBlacklist);

	GuiElementToggle checkDamage = new GuiElementToggle(this, 96, 38, "checkdamage");
	checkDamage.setTexture(checkDamage.getRenderable());
	addGuiElement(checkDamage);

	GuiElementToggle checkNbt = new GuiElementToggle(this, 96, 60, "checknbt");
	checkNbt.setTexture(checkNbt.getRenderable());
	addGuiElement(checkNbt);

	GuiElementExpandableColor upgradeInfo = addGuiElement(new GuiElementExpandableColor(this, right(22, 22), 125, 70));
	upgradeInfo.setColor(0xFF808000);
	upgradeInfo.setTexture(IRenderable.getRenderable(new ItemStack(BlocksItemsBetterChests.crafting)));
	upgradeInfo.setActualContent(IRenderable.getRenderable(() -> LocalizationHelper.localize("betterchests:gui.filter.info.restrictupgrade"), upgradeInfo.getLocation()));
}
 
Example #20
Source File: BeefGuiLabel.java    From BigReactors with MIT License 5 votes vote down vote up
@Override
public void drawForeground(TextureManager renderEngine, int mouseX, int mouseY) {
	FontRenderer fontRenderer = guiContainer.getFontRenderer();
	if(xMax > 0) {
		fontRenderer.drawSplitString(labelText, relativeX, relativeY, color, xMax);
	}
	else {
		fontRenderer.drawString(labelText, relativeX, relativeY, color, dropShadow);
	}
}
 
Example #21
Source File: BeefGuiIcon.java    From BigReactors with MIT License 5 votes vote down vote up
@Override
public void drawBackground(TextureManager renderEngine, int mouseX,
		int mouseY) {
	if(!visible) { return; }
	if(icon == null) { return; }
	

       GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
       renderEngine.bindTexture(TextureMap.locationBlocksTexture);
   	drawTexturedModelRectFromIcon(this.absoluteX, this.absoluteY, this.icon, this.width, this.height);
}
 
Example #22
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 #23
Source File: DisposableDynamicTexture.java    From OpenModsLib with MIT License 5 votes vote down vote up
public ResourceLocation register(TextureManager manager, String prefix) {
	ResourceLocation location = new ResourceLocation(String.format("dynamic_o/%s_%d", prefix, textureCounter));
	textureCounter++;

	manager.loadTexture(location, this);
	return location;
}
 
Example #24
Source File: DynamicTextureAtlas.java    From OpenModsLib with MIT License 5 votes vote down vote up
public DynamicTextureAtlas(TextureManager manager, int cellSize) {
	Preconditions.checkArgument(ByteUtils.isPowerOfTwo(cellSize), "NO POWER!");
	this.manager = manager;
	this.cellSize = cellSize;
	this.textureWrapper = new DisposableDynamicTexture();
	this.textureLocation = textureWrapper.register(manager, "dyn-atlas");
}
 
Example #25
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 #26
Source File: MemoryHelper.java    From Hyperium with GNU Lesser General Public License v3.0 5 votes vote down vote up
private void deleteSkin(ResourceLocation skinLocation) {
    if (skinLocation == null) return;
    TextureManager textureManager = Minecraft.getMinecraft().getTextureManager();
    Map<ResourceLocation, ITextureObject> mapTextureObjects = ((IMixinTextureManager) textureManager).getMapTextureObjects();
    textureManager.deleteTexture(skinLocation);
    mapTextureObjects.remove(skinLocation); // not needed with optifine but needed without it
}
 
Example #27
Source File: GuiTFAdvancedAggreagator.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 + 88, var6 + 53, 176, 31, var8, 8);
    
    // Progress arrow
    var7 = this.getProgressScaled(55);
    this.drawTexturedModalRect(var5 + 62, var6 + 12, 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 #28
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 #29
Source File: MixinMinecraft.java    From VanillaFix with MIT License 5 votes vote down vote up
/** @reason Part 2 of GUI logic fix. */
@Redirect(method = "runTick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/texture/TextureManager;tick()V", ordinal = 0))
private void tickTextureManagerWithCorrectProfiler(TextureManager textureManager) {
    profiler.endStartSection("textures");
    textureManager.tick();
    profiler.endStartSection("gui");
}
 
Example #30
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);
	}
}