OSDN Git Service

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