Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.chef.mod.gui;
- import net.minecraft.client.gui.inventory.GuiContainer;
- import net.minecraft.client.renderer.GlStateManager;
- import net.minecraft.entity.player.InventoryPlayer;
- import net.minecraft.util.EnumChatFormatting;
- import net.minecraft.util.ResourceLocation;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.fml.relauncher.SideOnly;
- import com.chef.mod.Debugger;
- import com.chef.mod.Reference;
- import com.chef.mod.container.ContainerBoiler;
- import com.chef.mod.tileentity.TileEntityBoiler;
- @SideOnly(Side.CLIENT)
- public class GuiBoiler extends GuiContainer {
- private static final ResourceLocation furnaceGuiTextures = new ResourceLocation(Reference.MOD_ID + ":"
- + "textures/gui/container/boiler.png");
- private final InventoryPlayer playerInventory;
- public TileEntityBoiler boiler;
- public GuiBoiler(InventoryPlayer playerInv, TileEntityBoiler teBoiler) {
- super(new ContainerBoiler(playerInv, teBoiler));
- this.playerInventory = playerInv;
- this.boiler = teBoiler;
- }
- protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
- String status;
- if (!this.boiler.hasWater()) {
- status = EnumChatFormatting.DARK_RED + "No water!";
- } else if (this.boiler.water <= 10000) {
- status = EnumChatFormatting.DARK_RED + "Not enough water!";
- } else if (this.boiler.heath >= 0 && this.boiler.heath < 300) {
- status = EnumChatFormatting.DARK_RED + "Too cold!";
- } else if (this.boiler.heath < 600) {
- status = EnumChatFormatting.YELLOW + "Warm";
- } else if (this.boiler.heath < 1200) {
- status = EnumChatFormatting.GREEN + "Hot";
- } else {
- status = EnumChatFormatting.AQUA + "Boiling";
- }
- this.fontRendererObj.drawString(status, this.xSize / 2 - this.fontRendererObj.getStringWidth(status) + 70, 20, 4210752);
- //Debugger.log("THE HEATH OF THE BOILER: " + this.boiler.heath);
- String s = this.boiler.getDisplayName().getUnformattedText();
- this.fontRendererObj.drawString(s, this.xSize / 2 - this.fontRendererObj.getStringWidth(s) / 2, 6, 4210752);
- this.fontRendererObj.drawString(this.playerInventory.getDisplayName().getUnformattedText(), 42, this.ySize - 96 + 3, 4210752);
- }
- protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- this.mc.getTextureManager().bindTexture(furnaceGuiTextures);
- int k = (this.width - this.xSize) / 2;
- int l = (this.height - this.ySize) / 2;
- this.drawTexturedModalRect(guiLeft, guiTop, 0, 0, this.xSize, this.ySize);
- int time;
- // this.drawTexturedModalRect(pixels measured from the left, pixels
- // measured from the top, xSize, from where it begins meeting, lenght,
- // width);
- /*
- * this.drawTexturedModalRect(pixels measured from the left,
- * pixelsmeasured from the top, xSize, from where it begins meeting,
- * lenght, width);
- */
- if (boiler.isBurning()) {
- // Fuel remaining bar
- time = boiler.getBurnTimeRemainingScaled(13);
- this.drawTexturedModalRect(guiLeft + 18, guiTop + 48 + 12 - time, 176, 12 - time, 14, time + 1);
- }
- if (boiler.hasWater()) {
- time = boiler.getWaterRemainingScaled(25);
- this.drawTexturedModalRect(guiLeft + 16, guiTop + 44 - time, 176, 39 - time, 21, time);
- }
- // Progress bar
- time = boiler.getCookProgressScaled(24);
- this.drawTexturedModalRect(guiLeft + 99, guiTop + 49, 176, 39, time + 1, 16);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment