OSDN Git Service

修正・変更
[chemicraft/chemicraft.git] / common / pcc / chemicraft / base / ChemiCraftBaseAPI.java
index 06d613d..42fbf02 100644 (file)
@@ -8,12 +8,23 @@ import pcc.chemicraft.base.gen.WorldGenAtomsOre;
 import pcc.chemicraft.util.Formula;
 import pcc.chemicraft.util.ListHash;
 
-public class ChemiCraftBaseAPI
-{
+/**
+ * ChemiCraftBaseのAPIを提供するクラスです。<br>
+ * ChemiCraftBaseを使用したAPIを作成する場合、このクラスを使用します。
+ * @author mozipi,ponkotate
+ */
+public class ChemiCraftBaseAPI {
 
+       /**
+        * APIのインスタンス
+        */
        private static ChemiCraftBaseAPI instance = new ChemiCraftBaseAPI();
 
 
+       /**
+        * APIのインスタンスを返します。
+        * @return APIのインスタンス
+        */
        public static ChemiCraftBaseAPI instance(){
                return instance;
        }
@@ -25,12 +36,6 @@ public class ChemiCraftBaseAPI
 
 
        /**
-        * 鉱石の言語リスト
-        */
-       private ListHash<String, String> atomOresLangListHash = new ListHash<String, String>();
-
-
-       /**
         * 鉱石リスト
         */
        private ArrayList<WorldGenAtomsOre> atomOresList = new ArrayList<WorldGenAtomsOre>();
@@ -42,15 +47,19 @@ public class ChemiCraftBaseAPI
        private ListHash<String, String> atomOresNameListHash = new ListHash<String, String>();
 
 
+       /**
+        * 鉱石の英語名リスト
+        */
+       private ArrayList<String> atomOresEnglishList = new ArrayList<String>();
 
        /**
         * 鉱石を追加します。
-        * @param par1Name
-        * @param par2Formula
-        * @param par3Id
-        * @param par4Size
-        * @param par5Frequency
-        * @param par6PosY
+        * @param par1Name 鉱石名(Oreは自動で語尾につけられます)
+        * @param par2Formula 化学式
+        * @param par3Id 鉱石のID
+        * @param par4Size 鉱石の塊の大きさ
+        * @param par5Frequency 生成率(frequency/Chunk)
+        * @param par6PosY 鉱石が生成される高度(nowY < PosY == Generate)
         */
        public void addAtomOres(String par1Name, Formula par2Formula, int par3Id, int par4Size, int par5Frequency, int par6PosY){
                atomOresList.add(
@@ -60,12 +69,27 @@ public class ChemiCraftBaseAPI
                                                par4Size,
                                                par5Frequency,
                                                par6PosY));
+
                atomOresFormulasHash.put(par1Name, par2Formula);
-               addAtomOresLanguage(par1Name, par1Name, "en_US");
+
+               String var7 = par1Name;
+               if (!var7.contains(" Ore")) {
+                       var7 = var7.concat(" Ore");
+               }
+
+               this.atomOresEnglishList.add(var7);
+               addAtomOresLanguage(var7, "en_US");
        }
 
 
 
+       /**
+        * 鉱石を追加します。
+        * @param par1Name 鉱石名(Oreは自動で語尾につけられます)
+        * @param par2Formula 化学式
+        * @param par3Id 鉱石のID
+        * @param par4Enum 鉱石生成の情報が入ったEnum
+        */
        public void addAtomOres(String par1Name, Formula par2Formula, int par3Id, EnumOreSpawnFrequency par4Enum){
                addAtomOres(
                                par1Name,
@@ -85,11 +109,11 @@ public class ChemiCraftBaseAPI
         * @param par2NewName 新しい名前
         * @param par3Language 言語
         */
-       public void addAtomOresLanguage(String par1Name, String par2NewName, String par3Language){
-               atomOresNameListHash.add(par1Name,
-                               par2NewName);
-               atomOresLangListHash.add(par1Name,
-                               par3Language);
+       public void addAtomOresLanguage(String par1Name, String par2Language){
+               atomOresNameListHash.add(
+                               par2Language,
+                               par1Name
+                               );
        }
 
 
@@ -106,20 +130,14 @@ public class ChemiCraftBaseAPI
 
 
 
-       public ListHash<String, String> getAtomOresLanguage(){
-               return atomOresLangListHash;
-       }
-
-
-
        public int getAtomOresLastIndex(){
-               return atomOresNameListHash.sizeKeysList() / 16;
+               return atomOresEnglishList.size() / 16;
        }
 
 
 
        public int getAtomOresMetaOfLastIndex(){
-               return atomOresNameListHash.sizeKeysList() - getAtomOresLastIndex() * 16;
+               return atomOresEnglishList.size() - getAtomOresLastIndex() * 16;
        }
 
 
@@ -128,4 +146,10 @@ public class ChemiCraftBaseAPI
                return atomOresNameListHash;
        }
 
+
+
+       public String getAtomOreEnglishName(int index) {
+               return this.atomOresEnglishList.get(index);
+       }
+
 }