X-Git-Url: http://git.sourceforge.jp/view?p=chemicraft%2Fchemicraft.git;a=blobdiff_plain;f=common%2Fchemicraft%2Fgui%2FGuiChemicalCombinationTable.java;h=b6d2114f999745adbd32795993d13394ab63694f;hp=6fac8dc375bd6f79fea2f0da1ce4dab25f527195;hb=a1a86dfbff1c9c280cca1a83860e63464103873a;hpb=5fd7df53f8f3c8497456f1ccfed911dfa9b6aebc diff --git a/common/chemicraft/gui/GuiChemicalCombinationTable.java b/common/chemicraft/gui/GuiChemicalCombinationTable.java index 6fac8dc..b6d2114 100644 --- a/common/chemicraft/gui/GuiChemicalCombinationTable.java +++ b/common/chemicraft/gui/GuiChemicalCombinationTable.java @@ -26,16 +26,17 @@ public class GuiChemicalCombinationTable extends GuiContainer { public GuiChemicalCombinationTable(EntityPlayer par1EntityPlayer, TileEntityChemicalCombinationTable par2) { super(new ContainerChemicalCombinationTable(par1EntityPlayer, par2)); this.tileentity = par2; + this.ySize = 204; } @Override public void initGui(){ super.initGui(); - this.atomList = new GuiTextField(this.fontRenderer, 92, 7, 80, 15); + this.atomList = new GuiTextField(this.fontRenderer, 9, 103, 160, 15); this.atomList.setFocused(false); - this.atomList.setMaxStringLength(20); - 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")); + this.atomList.setMaxStringLength(25); + this.controlList.add(new GuiButton(0, this.guiLeft + 172 - 41, this.guiTop + 80 - 21, 40, 20, "Add")); + this.controlList.add(new GuiButton(1, this.guiLeft + 172 - 41, this.guiTop + 80, 40, 20, "Eject")); } @Override @@ -47,71 +48,15 @@ public class GuiChemicalCombinationTable extends GuiContainer { @Override protected void actionPerformed(GuiButton par1GuiButton) { if(par1GuiButton.id == 0){ - this.field_00001(this.tileentity); + this.tileentity.field_00001(); PacketDispatcher.sendPacketToServer(this.tileentity.getDescriptionPacket()); }else if(par1GuiButton.id == 1){ - this.field_00002(this.tileentity); + this.tileentity.field_00002(); PacketDispatcher.sendPacketToServer(this.tileentity.getDescriptionPacket()); } 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++){ - if(stacks[i].stackSize > 1){ - par1.setAtoms(ChemiCraft.ATOMSLIST[stacks[i].getItemDamage()], stacks[i].stackSize); - }else{ - par1.setAtoms(ChemiCraft.ATOMSLIST[stacks[i].getItemDamage()], 1); - } - } - - for(int i = 0;i < inv.getSizeInventory();i++){ - inv.setInventorySlotContents(i, null); - } - } - - protected void field_00002(TileEntityChemicalCombinationTable par1) { - ArrayList var1 = par1.getAtomsList(); - ArrayList var2 = par1.getAtomsAmountList(); - - for (int i = 0;i < var1.size();i++) { - for (int j = 0;j < ChemiCraft.ATOMSLIST.length;j++) { - if (var1.get(i).equals(ChemiCraft.ATOMSLIST[j])) { - int var3 = var2.get(i); - while(var3 > 0){ - if(var3 > 64){ - ItemStack itemstack = new ItemStack(ChemiCraft.instance.itemAtoms, 64, j); - this.tileentity.setDropItems(itemstack); - PacketDispatcher.sendPacketToServer(this.tileentity.getDescriptionPacket()); - var3 -= 64; - }else{ - ItemStack itemstack = new ItemStack(ChemiCraft.instance.itemAtoms, var3, j); - this.tileentity.setDropItems(itemstack); - PacketDispatcher.sendPacketToServer(this.tileentity.getDescriptionPacket()); - var3 = 0; - } - } - break; - } - } - } - IInventory invr = par1.getInvResult(); - if (invr.getStackInSlot(0) != null) { - invr.setInventorySlotContents(0, null); - } - par1.emptytoAtomsList(); - } - @Override protected void drawGuiContainerForegroundLayer() { this.atomList.setText(this.tileentity.getAtoms());