123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- package me.km.networking;
- import me.km.KajetansMod;
- import me.km.inventory.ContainerCampFire;
- import net.minecraft.client.renderer.GlStateManager;
- import net.minecraft.inventory.IInventory;
- import net.minecraft.util.ResourceLocation;
- import net.minecraftforge.fml.relauncher.Side;
- import net.minecraftforge.fml.relauncher.SideOnly;
- import net.minecraft.client.gui.inventory.GuiContainer;
- import net.minecraft.entity.player.InventoryPlayer;
- @SideOnly(Side.CLIENT)
- public class CampFireInventoryGui extends GuiContainer
- {
- private static final ResourceLocation FURNACE_GUI_TEXTURES = new ResourceLocation(KajetansMod.MODID, "textures/gui/container/campfire.png");
- private final InventoryPlayer pInv;
- private final IInventory tileFurnace;
- public CampFireInventoryGui(InventoryPlayer pInv, IInventory fireInv)
- {
- super(new ContainerCampFire(pInv, fireInv));
- this.pInv = pInv;
- this.tileFurnace = fireInv;
- }
- @Override
- public void drawScreen(int mouseX, int mouseY, float partialTicks)
- {
- this.drawDefaultBackground();
- super.drawScreen(mouseX, mouseY, partialTicks);
- this.renderHoveredToolTip(mouseX, mouseY);
- }
- @Override
- protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
- {
- String s = this.tileFurnace.getDisplayName().getUnformattedText();
- this.fontRenderer.drawString(s, this.xSize / 2 - this.fontRenderer.getStringWidth(s) / 2, 6, 4210752);
- this.fontRenderer.drawString(this.pInv.getDisplayName().getUnformattedText(), 8, this.ySize - 96 + 2, 4210752);
- }
- @Override
- protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY)
- {
- GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
- this.mc.getTextureManager().bindTexture(FURNACE_GUI_TEXTURES);
- int i = (this.width - this.xSize) / 2;
- int j = (this.height - this.ySize) / 2;
- this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
- int l = this.getCookProgressScaled(0);
- this.drawTexturedModalRect(i + 75, j + 16, 176, 14, l + 1, 16);
- l = this.getCookProgressScaled(1);
- this.drawTexturedModalRect(i + 75, j + 34, 176, 14, l + 1, 16);
- l = this.getCookProgressScaled(2);
- this.drawTexturedModalRect(i + 75, j + 52, 176, 14, l + 1, 16);
- }
- private int getCookProgressScaled(int id)
- {
- int i = this.tileFurnace.getField(id);
- int j = 200;
- return j != 0 && i != 0 ? i * 24 / j : 0;
- }
- }
|