equivalent-exchange-3/common/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalBag.java
pahimar 16f8c09e32 Bump Forge version for the build script, break out the NBTHelpers to
their own helper.nbt package (because the classes are getting messy),
and starting work on cleaning up said classes
2013-10-29 15:49:16 -04:00

72 lines
2.2 KiB
Java

package com.pahimar.ee3.client.gui.inventory;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import org.lwjgl.opengl.GL11;
import com.pahimar.ee3.core.helper.nbt.GeneralNBTHelper;
import com.pahimar.ee3.inventory.ContainerAlchemicalBag;
import com.pahimar.ee3.lib.Strings;
import com.pahimar.ee3.lib.Textures;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
/**
* Equivalent-Exchange-3
*
* GuiAlchemicalBag
*
* @author pahimar
* @license Lesser GNU Public License v3 (http://www.gnu.org/licenses/lgpl.html)
*
*/
@SideOnly(Side.CLIENT)
public class GuiAlchemicalBag extends GuiContainer {
public GuiAlchemicalBag(InventoryPlayer inventoryPlayer) {
super(new ContainerAlchemicalBag(inventoryPlayer));
xSize = 248;
ySize = 186;
}
@Override
protected void drawGuiContainerForegroundLayer(int x, int y) {
fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_ALCHEMICAL_BAG_NAME), 8, 6, 4210752);
fontRenderer.drawString(StatCollector.translateToLocal(Strings.CONTAINER_INVENTORY), 44, ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float opacity, int x, int y) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
// this.mc.getTextureManager().bindTexture(...)
this.mc.getTextureManager().bindTexture(Textures.GUI_ALCHEMICAL_STORAGE);
int xStart = (width - xSize) / 2;
int yStart = (height - ySize) / 2;
this.drawTexturedModalRect(xStart, yStart, 0, 0, xSize, ySize);
}
@Override
public void onGuiClosed() {
super.onGuiClosed();
if (mc.thePlayer != null) {
for (ItemStack itemStack : mc.thePlayer.inventory.mainInventory) {
if (itemStack != null) {
if (GeneralNBTHelper.hasTag(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN)) {
GeneralNBTHelper.removeTag(itemStack, Strings.NBT_ITEM_ALCHEMICAL_BAG_GUI_OPEN);
}
}
}
}
}
}