2013-05-23 21:07:28 -07:00
|
|
|
package magicbees.client.gui;
|
2013-05-06 00:24:06 -07:00
|
|
|
|
2013-05-23 21:07:28 -07:00
|
|
|
import magicbees.main.CommonProxy;
|
|
|
|
|
import magicbees.tileentity.TileEntityEffectJar;
|
2013-08-25 19:56:55 -07:00
|
|
|
import net.minecraft.client.Minecraft;
|
2013-05-06 00:24:06 -07:00
|
|
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
2013-08-25 19:56:55 -07:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2013-04-21 15:38:52 -07:00
|
|
|
|
|
|
|
|
import org.lwjgl.opengl.GL11;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public class GUIEffectJar extends GuiContainer
|
|
|
|
|
{
|
|
|
|
|
public static final String BACKGROUND_FILE = "jarScreen.png";
|
2013-08-25 19:56:55 -07:00
|
|
|
public static final ResourceLocation BACKGROUND_LOCATION = new ResourceLocation(CommonProxy.DOMAIN, CommonProxy.GUI_TEXTURE + "jarScreen.png");
|
2013-04-21 15:38:52 -07:00
|
|
|
|
|
|
|
|
private static final int WIDTH = 176;
|
|
|
|
|
private static final int HEIGHT = 156;
|
|
|
|
|
|
|
|
|
|
private static final int SLOT_JAR_X = 80;
|
|
|
|
|
private static final int SLOT_JAR_Y = 22;
|
|
|
|
|
private static final int SLOT_INVENTORY_X = 8;
|
|
|
|
|
private static final int SLOT_INVENTORY_Y = 74;
|
|
|
|
|
private static final int BAR_DEST_X = 117;
|
|
|
|
|
private static final int BAR_DEST_Y = 10;
|
|
|
|
|
|
|
|
|
|
private static final int BAR_SRC_X = 176;
|
|
|
|
|
private static final int BAR_SRC_Y = 0;
|
|
|
|
|
|
|
|
|
|
private static final int BAR_WIDTH = 10;
|
|
|
|
|
private static final int BAR_HEIGHT = 40;
|
|
|
|
|
|
2013-05-06 00:24:06 -07:00
|
|
|
public GUIEffectJar(TileEntityEffectJar jar, EntityPlayer player)
|
2013-04-21 15:38:52 -07:00
|
|
|
{
|
2013-05-06 00:24:06 -07:00
|
|
|
super(new ContainerEffectJar(jar, player));
|
2013-04-21 15:38:52 -07:00
|
|
|
this.xSize = WIDTH;
|
|
|
|
|
this.ySize = HEIGHT;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void drawGuiContainerForegroundLayer(int par1, int par2)
|
|
|
|
|
{
|
2013-04-22 16:03:27 -07:00
|
|
|
fontRenderer.drawString("Inventory", 9, 63, 0);
|
2013-04-21 15:38:52 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void drawGuiContainerBackgroundLayer(float f, int i, int j)
|
|
|
|
|
{
|
2013-05-06 00:24:06 -07:00
|
|
|
GL11.glColor4f(1f, 1f, 1f, 1f);
|
2013-04-21 15:38:52 -07:00
|
|
|
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_SRC_ALPHA);
|
2013-09-09 23:23:00 -07:00
|
|
|
this.mc.getTextureManager().bindTexture(BACKGROUND_LOCATION);
|
2013-04-21 15:38:52 -07:00
|
|
|
|
|
|
|
|
this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, xSize, ySize);
|
|
|
|
|
|
2013-05-06 00:24:06 -07:00
|
|
|
TileEntityEffectJar jar = ((ContainerEffectJar)this.inventorySlots).jar;
|
|
|
|
|
float r = ((jar.currentBeeColour >> 16) & 255) / 255f;
|
|
|
|
|
float g = ((jar.currentBeeColour >> 8) & 255) / 255f;
|
|
|
|
|
float b = (jar.currentBeeColour & 255) / 255f;
|
|
|
|
|
|
|
|
|
|
GL11.glColor3f(r, g, b);
|
2013-04-21 15:38:52 -07:00
|
|
|
|
2013-05-06 00:24:06 -07:00
|
|
|
int value = BAR_HEIGHT - (jar.currentBeeHealth * BAR_HEIGHT) / 100;
|
2013-04-21 15:38:52 -07:00
|
|
|
this.drawTexturedModalRect(this.guiLeft + BAR_DEST_X, this.guiTop + value + BAR_DEST_Y, BAR_SRC_X, BAR_SRC_Y, BAR_WIDTH, BAR_HEIGHT - value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|