2016-01-07 18:05:23 -05:00
|
|
|
package WayofTime.bloodmagic.client.gui;
|
|
|
|
|
2017-08-14 20:53:42 -07:00
|
|
|
import WayofTime.bloodmagic.BloodMagic;
|
2016-03-17 13:00:44 -07:00
|
|
|
import WayofTime.bloodmagic.tile.TileSoulForge;
|
|
|
|
import WayofTime.bloodmagic.tile.container.ContainerSoulForge;
|
|
|
|
import WayofTime.bloodmagic.util.helper.TextHelper;
|
2016-01-07 18:05:23 -05:00
|
|
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
|
|
|
import net.minecraft.client.renderer.GlStateManager;
|
|
|
|
import net.minecraft.entity.player.InventoryPlayer;
|
|
|
|
import net.minecraft.inventory.IInventory;
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
|
|
|
|
|
|
|
@SideOnly(Side.CLIENT)
|
2017-08-15 21:30:48 -07:00
|
|
|
public class GuiSoulForge extends GuiContainer {
|
2016-01-08 10:27:26 -05:00
|
|
|
public IInventory tileSoulForge;
|
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
public GuiSoulForge(InventoryPlayer playerInventory, IInventory tileSoulForge) {
|
2016-01-08 10:27:26 -05:00
|
|
|
super(new ContainerSoulForge(playerInventory, tileSoulForge));
|
|
|
|
this.tileSoulForge = tileSoulForge;
|
2016-01-07 18:05:23 -05:00
|
|
|
this.xSize = 176;
|
2016-01-07 22:40:04 -05:00
|
|
|
this.ySize = 205;
|
2016-01-07 18:05:23 -05:00
|
|
|
}
|
|
|
|
|
2018-02-05 17:25:25 -08:00
|
|
|
@Override
|
|
|
|
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
|
|
|
|
this.drawDefaultBackground();
|
|
|
|
super.drawScreen(mouseX, mouseY, partialTicks);
|
|
|
|
this.renderHoveredToolTip(mouseX, mouseY);
|
|
|
|
}
|
|
|
|
|
2016-01-07 18:05:23 -05:00
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY) {
|
2017-08-15 20:21:54 -07:00
|
|
|
this.fontRenderer.drawString(TextHelper.localize("tile.bloodmagic.soulForge.name"), 8, 5, 4210752);
|
|
|
|
this.fontRenderer.drawString(TextHelper.localize("container.inventory"), 8, 111, 4210752);
|
2016-01-07 18:05:23 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2017-08-15 21:30:48 -07:00
|
|
|
protected void drawGuiContainerBackgroundLayer(float partialTicks, int mouseX, int mouseY) {
|
2016-01-07 18:05:23 -05:00
|
|
|
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
2017-08-14 20:53:42 -07:00
|
|
|
ResourceLocation soulForgeGuiTextures = new ResourceLocation(BloodMagic.MODID + ":textures/gui/soulForge.png");
|
2016-01-07 18:05:23 -05:00
|
|
|
this.mc.getTextureManager().bindTexture(soulForgeGuiTextures);
|
|
|
|
int i = (this.width - this.xSize) / 2;
|
|
|
|
int j = (this.height - this.ySize) / 2;
|
|
|
|
this.drawTexturedModalRect(i, j, 0, 0, this.xSize, this.ySize);
|
|
|
|
|
2016-01-07 22:40:04 -05:00
|
|
|
int l = this.getCookProgressScaled(90);
|
|
|
|
this.drawTexturedModalRect(i + 115, j + 14 + 90 - l, 176, 90 - l, 18, l);
|
2016-01-07 18:05:23 -05:00
|
|
|
}
|
|
|
|
|
2017-08-15 21:30:48 -07:00
|
|
|
public int getCookProgressScaled(int scale) {
|
2016-01-08 10:27:26 -05:00
|
|
|
double progress = ((TileSoulForge) tileSoulForge).getProgressForGui();
|
2016-01-07 18:05:23 -05:00
|
|
|
return (int) (progress * scale);
|
|
|
|
}
|
|
|
|
}
|