package chemicraft.gui;
+import java.util.Arrays;
+
import net.minecraft.src.EntityPlayer;
+import net.minecraft.src.GuiButton;
import net.minecraft.src.GuiContainer;
-import net.minecraft.src.InventoryPlayer;
+import net.minecraft.src.GuiTextField;
+import net.minecraft.src.IInventory;
+import net.minecraft.src.ItemStack;
import chemicraft.ChemiCraft;
import chemicraft.container.ContainerChemicalCombinationTable;
import chemicraft.tileentity.TileEntityChemicalCombinationTable;
-import cpw.mods.fml.common.Side;
-import cpw.mods.fml.common.asm.SideOnly;
+import chemicraft.util.Auxiliary.ArrayAuxiliary;
+import chemicraft.util.ComparatorItemStack;
+import cpw.mods.fml.common.network.PacketDispatcher;
-@SideOnly(Side.CLIENT)
public class GuiChemicalCombinationTable extends GuiContainer {
- /**
- * the TileEntity.
- */
- private TileEntityChemicalCombinationTable tileEntity;
-
+ private GuiTextField atomList;
- /**
- * the InventoryPlayer.
- */
- private InventoryPlayer inventoryPlayer;
+ private TileEntityChemicalCombinationTable tileentity;
+ public GuiChemicalCombinationTable(EntityPlayer par1EntityPlayer, TileEntityChemicalCombinationTable par2) {
+ super(new ContainerChemicalCombinationTable(par1EntityPlayer, par2));
+ this.tileentity = par2;
+ }
- /**
- * the Container
- */
- private ContainerChemicalCombinationTable container;
+ @Override
+ public void initGui(){
+ super.initGui();
+ this.atomList = new GuiTextField(this.fontRenderer, 92, 7, 80, 15);
+ this.atomList.setFocused(false);
+ this.atomList.setMaxStringLength(10);
+ this.controlList.add(new GuiButton(0, this.guiLeft + 132 - 41, this.guiTop + 63, 40, 20, "Add"));
+ this.controlList.add(new GuiButton(1, this.guiLeft + 132, this.guiTop + 63, 40, 20, "Eject"));
+ }
+ @Override
+ protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
+ this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture(ChemiCraft.instance.guiChemicalCombinationTexture));
+ this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
+ }
+ @Override
+ protected void actionPerformed(GuiButton par1GuiButton) {
+ if(par1GuiButton.id == 0){
+ this.field_00001(this.tileentity);
+ PacketDispatcher.sendPacketToServer(this.tileentity.getDescriptionPacket());
+ }else if(par1GuiButton.id == 1){
- public GuiChemicalCombinationTable(EntityPlayer par1EntityPlayer, TileEntityChemicalCombinationTable par2){
- super(new ContainerChemicalCombinationTable(par1EntityPlayer, par2));
- this.inventoryPlayer = par1EntityPlayer.inventory;
- this.tileEntity = par2;
- this.container = (ContainerChemicalCombinationTable) this.inventorySlots;
+ }
+ return;
}
+ protected void field_00001(TileEntityChemicalCombinationTable par1){
+ IInventory inv = par1.getInvMaterial();
+ ItemStack[] stacks = new ItemStack[inv.getSizeInventory()];
+ for(int i = 0;i < stacks.length;i++){
+ if(inv.getStackInSlot(i) != null){
+ stacks[i] = inv.getStackInSlot(i);
+ }
+ }
+ Arrays.sort(stacks, new ComparatorItemStack());
+ stacks = ChemiCraft.instance.arrayAuxiliary.deleteNull(stacks);
+ for(int i = 0;i < stacks.length;i++){
+ }
+ }
@Override
- protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3){
- this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture(ChemiCraft.instance.guiChemicalCombinationTexture));
- this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
+ protected void drawGuiContainerForegroundLayer() {
+ this.atomList.drawTextBox();
}
}