package com.hbm.inventory.gui; import org.lwjgl.opengl.GL11; import com.hbm.inventory.container.ContainerMachineChemplant; import com.hbm.items.ModItems; import com.hbm.lib.RefStrings; import com.hbm.tileentity.machine.TileEntityMachineChemplant; import com.hbm.util.I18nUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.resources.I18n; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.util.ResourceLocation; public class GUIMachineChemplant extends GuiInfoContainer { private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_chemplant.png"); private TileEntityMachineChemplant chemplant; public GUIMachineChemplant(InventoryPlayer invPlayer, TileEntityMachineChemplant tedf) { super(new ContainerMachineChemplant(invPlayer, tedf)); chemplant = tedf; this.xSize = 176; this.ySize = 222; } @Override public void drawScreen(int mouseX, int mouseY, float f) { super.drawScreen(mouseX, mouseY, f); chemplant.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 52 - 34, 16, 34); chemplant.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 52 - 34, 16, 34); chemplant.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 52 - 34, 16, 34); chemplant.tanks[3].renderTankInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 52 - 34, 16, 34); this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 44, guiTop + 70 - 52, 16, 52, chemplant.power, chemplant.maxPower); if(chemplant.getStackInSlot(4) == null || chemplant.getStackInSlot(4).getItem()!= ModItems.chemistry_template) { String[] warningText = I18nUtil.resolveKeyArray("desc.gui.chemplant.warning"); this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 36, 16, 16, guiLeft - 8, guiTop + 36 + 16, warningText); } String[] templateText = I18nUtil.resolveKeyArray("desc.gui.template"); this.drawCustomInfoStat(mouseX, mouseY, guiLeft - 16, guiTop + 16, 16, 16, guiLeft - 8, guiTop + 16 + 16, templateText); String[] upgradeText = new String[3]; upgradeText[0] = I18nUtil.resolveKey("desc.gui.upgrade"); upgradeText[1] = I18nUtil.resolveKey("desc.gui.upgrade.speed"); upgradeText[2] = I18nUtil.resolveKey("desc.gui.upgrade.power"); this.drawCustomInfoStat(mouseX, mouseY, guiLeft + 105, guiTop + 40, 8, 8, guiLeft + 105, guiTop + 40 + 16, upgradeText); } @Override protected void drawGuiContainerForegroundLayer( int i, int j) { String name = this.chemplant.hasCustomInventoryName() ? this.chemplant.getInventoryName() : I18n.format(this.chemplant.getInventoryName()); this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752); this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752); } @Override protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) { GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F); Minecraft.getMinecraft().getTextureManager().bindTexture(texture); drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize); int i = (int) (chemplant.power * 52 / chemplant.maxPower); drawTexturedModalRect(guiLeft + 44, guiTop + 70 - i, 176, 52 - i, 16, i); int j = chemplant.progress * 90 / chemplant.maxProgress; drawTexturedModalRect(guiLeft + 43, guiTop + 89, 0, 222, j, 18); this.drawInfoPanel(guiLeft + 105, guiTop + 40, 8, 8, 8); if(chemplant.getStackInSlot(4) == null || chemplant.getStackInSlot(4).getItem()!= ModItems.chemistry_template) { this.drawInfoPanel(guiLeft - 16, guiTop + 36, 16, 16, 6); } this.drawInfoPanel(guiLeft - 16, guiTop + 16, 16, 16, 11); chemplant.tanks[0].renderTank(guiLeft + 8, guiTop + 52, this.zLevel, 16, 34); chemplant.tanks[1].renderTank(guiLeft + 26, guiTop + 52, this.zLevel, 16, 34); chemplant.tanks[2].renderTank(guiLeft + 134, guiTop + 52, this.zLevel, 16, 34); chemplant.tanks[3].renderTank(guiLeft + 152, guiTop + 52, this.zLevel, 16, 34); } }