OSDN Git Service

誰かEntityAtomGrenadeを登録してくれ...
[chemicraft/chemicraft.git] / common / chemicraft / gui / GuiChemicalCombinationTable.java
index d8161ed..b6d2114 100644 (file)
@@ -1,17 +1,19 @@
 package chemicraft.gui;
 
+import java.util.ArrayList;
 import java.util.Arrays;
 
+import net.minecraft.src.EntityItem;
 import net.minecraft.src.EntityPlayer;
 import net.minecraft.src.GuiButton;
 import net.minecraft.src.GuiContainer;
 import net.minecraft.src.GuiTextField;
 import net.minecraft.src.IInventory;
 import net.minecraft.src.ItemStack;
+import net.minecraft.src.World;
 import chemicraft.ChemiCraft;
 import chemicraft.container.ContainerChemicalCombinationTable;
 import chemicraft.tileentity.TileEntityChemicalCombinationTable;
-import chemicraft.util.Auxiliary.ArrayAuxiliary;
 import chemicraft.util.ComparatorItemStack;
 import cpw.mods.fml.common.network.PacketDispatcher;
 
@@ -24,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
@@ -45,34 +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.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()]);
-                       }
-               }
-       }
-
        @Override
        protected void drawGuiContainerForegroundLayer() {
                this.atomList.setText(this.tileentity.getAtoms());