OSDN Git Service

b6d2114f999745adbd32795993d13394ab63694f
[chemicraft/chemicraft.git] / common / chemicraft / gui / GuiChemicalCombinationTable.java
1 package chemicraft.gui;
2
3 import java.util.ArrayList;
4 import java.util.Arrays;
5
6 import net.minecraft.src.EntityItem;
7 import net.minecraft.src.EntityPlayer;
8 import net.minecraft.src.GuiButton;
9 import net.minecraft.src.GuiContainer;
10 import net.minecraft.src.GuiTextField;
11 import net.minecraft.src.IInventory;
12 import net.minecraft.src.ItemStack;
13 import net.minecraft.src.World;
14 import chemicraft.ChemiCraft;
15 import chemicraft.container.ContainerChemicalCombinationTable;
16 import chemicraft.tileentity.TileEntityChemicalCombinationTable;
17 import chemicraft.util.ComparatorItemStack;
18 import cpw.mods.fml.common.network.PacketDispatcher;
19
20 public class GuiChemicalCombinationTable extends GuiContainer {
21
22         private GuiTextField atomList;
23
24         private TileEntityChemicalCombinationTable tileentity;
25
26         public GuiChemicalCombinationTable(EntityPlayer par1EntityPlayer, TileEntityChemicalCombinationTable par2) {
27                 super(new ContainerChemicalCombinationTable(par1EntityPlayer, par2));
28                 this.tileentity = par2;
29                 this.ySize = 204;
30         }
31
32         @Override
33         public void initGui(){
34                 super.initGui();
35                 this.atomList = new GuiTextField(this.fontRenderer, 9, 103, 160, 15);
36                 this.atomList.setFocused(false);
37                 this.atomList.setMaxStringLength(25);
38                 this.controlList.add(new GuiButton(0, this.guiLeft + 172 - 41, this.guiTop + 80 - 21, 40, 20, "Add"));
39                 this.controlList.add(new GuiButton(1, this.guiLeft + 172 - 41, this.guiTop + 80, 40, 20, "Eject"));
40         }
41
42         @Override
43         protected void drawGuiContainerBackgroundLayer(float var1, int var2, int var3) {
44                 this.mc.renderEngine.bindTexture(this.mc.renderEngine.getTexture(ChemiCraft.instance.guiChemicalCombinationTexture));
45                 this.drawTexturedModalRect(this.guiLeft, this.guiTop, 0, 0, this.xSize, this.ySize);
46         }
47
48         @Override
49         protected void actionPerformed(GuiButton par1GuiButton) {
50                 if(par1GuiButton.id == 0){
51                         this.tileentity.field_00001();
52                         PacketDispatcher.sendPacketToServer(this.tileentity.getDescriptionPacket());
53                 }else if(par1GuiButton.id == 1){
54                         this.tileentity.field_00002();
55                         PacketDispatcher.sendPacketToServer(this.tileentity.getDescriptionPacket());
56                 }
57                 return;
58         }
59
60         @Override
61         protected void drawGuiContainerForegroundLayer() {
62                 this.atomList.setText(this.tileentity.getAtoms());
63                 this.atomList.drawTextBox();
64         }
65
66 }