OSDN Git Service

とりあえずコミット
authormozipi <mozipi@users.sourceforge.jp>
Tue, 1 Jan 2013 09:16:13 +0000 (18:16 +0900)
committermozipi <mozipi@users.sourceforge.jp>
Tue, 1 Jan 2013 09:16:13 +0000 (18:16 +0900)
common/chemicraft/ChemiCraft.java
common/chemicraft/gui/GuiChemicalCombinationTable.java
common/chemicraft/item/ItemAtoms.java
common/chemicraft/tileentity/TileEntityChemicalCombinationTable.java

index 8594619..d054218 100644 (file)
@@ -541,5 +541,19 @@ public class ChemiCraft {
        public final static String UNUNSEPTIUM_ = "Uus";\r
        public final static String UNUNOCTIUM_ = "Uuo";\r
 \r
+       public final static String[] atomsList = {\r
+               "H","He","Li","Be","B","C","N","O","F","Ne",\r
+               "Na","Mg","Al","Si","P","S","Cl","Ar","K","Ca",\r
+               "Sc","Ti","V","Cr","Mn","Fe","Co","Ni","Cu","Zn",\r
+               "Ga","Ge","As","Se","Br","Kr","Rb","Sr","Y","Zr",\r
+               "Nb","Mo","Tc","Ru","Rh","Pd","Ag","Cd","In","Sn",\r
+               "Sb","Te","I","Xe","Cs","Ba","La","Ce","Pr","Pm",\r
+               "Sm","Eu","Gd","Tb","Dy","Ho","Er","Tm","Yb","Lu",\r
+               "Hf","Ta","W","Re","Os","Ir","Pt","Au","Hg","Tl",\r
+               "Pb","Bi","Po","At","Rn","Fr","Ra","Ac","Th","Pa",\r
+               "U","Np","Pu","Am","Cm","Bk","Cf","Es","Fm","Md",\r
+               "No","Lr","Rf","Db","Sg","Bh","Hs","Mt","Ds","Rg",\r
+               "Cn","Uut","Uuq","Uup","Uuh","Uus","Uuo"\r
+       };\r
 \r
 }
\ No newline at end of file
index 044eb5b..d8161ed 100644 (file)
@@ -31,7 +31,7 @@ public class GuiChemicalCombinationTable extends GuiContainer {
                super.initGui();
                this.atomList = new GuiTextField(this.fontRenderer, 92, 7, 80, 15);
                this.atomList.setFocused(false);
-               this.atomList.setMaxStringLength(10);
+               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"));
        }
@@ -65,11 +65,17 @@ public class GuiChemicalCombinationTable extends GuiContainer {
                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());
                this.atomList.drawTextBox();
        }
 
index 3d175a8..45f5404 100644 (file)
@@ -13,7 +13,7 @@ public class ItemAtoms extends Item {
 
        public ItemAtoms(int par1){
                super(par1);
-               this.maxStackSize = 1;
+               this.maxStackSize = 64;
                this.setHasSubtypes(true);
                this.setMaxDamage(0);
                this.setCreativeTab(ChemiCraft.instance.creativeTab);
index 01235d4..9f80cff 100644 (file)
@@ -1,24 +1,27 @@
 package chemicraft.tileentity;
 
 import java.io.DataOutputStream;
+import java.util.ArrayList;
 
-import com.google.common.io.ByteArrayDataInput;
-
-import chemicraft.inventory.InventoryChemicalCombinationTableMaterial;
-import chemicraft.inventory.InventoryChemicalCombinationTableResult;
-import chemicraft.system.PacketHandler;
 import net.minecraft.src.ItemStack;
 import net.minecraft.src.NBTTagCompound;
 import net.minecraft.src.NBTTagList;
 import net.minecraft.src.Packet;
 import net.minecraft.src.TileEntity;
+import chemicraft.inventory.InventoryChemicalCombinationTableMaterial;
+import chemicraft.inventory.InventoryChemicalCombinationTableResult;
+import chemicraft.system.PacketHandler;
+
+import com.google.common.io.ByteArrayDataInput;
 
 public class TileEntityChemicalCombinationTable extends TileEntity {
 
        private InventoryChemicalCombinationTableMaterial invm = new InventoryChemicalCombinationTableMaterial();
        private InventoryChemicalCombinationTableResult invr = new InventoryChemicalCombinationTableResult();
 
-       private String atomsList = "";
+       private ArrayList<String> atomsList = new ArrayList<String>();
+       private ArrayList<Integer> atomsAmountList = new ArrayList<Integer>();
+       private int atomsListSize = 0;
 
        @Override
        public void readFromNBT(NBTTagCompound par1){
@@ -47,12 +50,15 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
                        }
                }
 
-               this.atomsList = par1.getString("AtomsList");
-       }
+               this.atomsListSize = par1.getInteger("atomsListSize");
 
-       @Override
-       public Packet getDescriptionPacket() {
-               return PacketHandler.getPacket(this);
+               for(int i = 0;i < this.atomsListSize;i++){
+                       this.atomsList.add(par1.getString("atomsList") + i);
+               }
+
+               for(int i = 0;i < this.atomsListSize;i++){
+                       this.atomsAmountList.add(par1.getInteger("atomsAmountList") + i);
+               }
        }
 
        @Override
@@ -84,7 +90,23 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
                }
                par1.setTag("Items2", var5);
 
-               par1.setString("AtomsList", this.atomsList);
+               this.atomsList.trimToSize();
+               this.atomsAmountList.trimToSize();
+               for(int i = 0;i < this.atomsList.size();i++){
+                       par1.setString("atoms" + i, this.atomsList.get(i));
+               }
+               for(int i = 0;i < this.atomsAmountList.size();i++){
+                       par1.setInteger("atomsAmount" + i, this.atomsAmountList.get(i));
+               }
+
+               this.atomsListSize = this.atomsList.size();
+               par1.setInteger("atomsListSize", this.atomsListSize);
+
+       }
+
+       @Override
+       public Packet getDescriptionPacket() {
+               return PacketHandler.getPacket(this);
        }
 
        public void readPacket(ByteArrayDataInput data) {
@@ -110,12 +132,12 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
                                        this.invr.setInventorySlotContents(i, null);
                                }
                        }
+
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }
 
-
        public void writePacket(DataOutputStream dos){
                try {
                        for(int i = 0;i < this.invm.getSizeInventory();i++){
@@ -155,13 +177,35 @@ public class TileEntityChemicalCombinationTable extends TileEntity {
                                        dos.writeInt(0);
                                }
                        }
+
                } catch (Exception e) {
                        e.printStackTrace();
                }
        }
 
        public void setAtoms(String par1){
-               this.atomsList = this.atomsList + par1;
+
+       }
+
+       public String getAtoms(){
+               return this.atomsList;
+       }
+
+       public ArrayList<String> getAtomsList(){
+               return this.atomsList;
+       }
+
+       public ArrayList<Integer> getAtomsAmountList(){
+               return this.atomsAmountList;
+       }
+
+       protected boolean isNumber(String par1){
+               try {
+                       int var1 = Integer.valueOf(new String(par1));
+               } catch (Exception e) {
+                       return false;
+               }
+               return true;
        }
 
        public InventoryChemicalCombinationTableMaterial getInvMaterial(){