OSDN Git Service

また代理コミット
authorinaka <inaka@tcrsnc.com>
Thu, 22 Nov 2012 12:23:42 +0000 (21:23 +0900)
committerinaka <inaka@tcrsnc.com>
Thu, 22 Nov 2012 12:23:42 +0000 (21:23 +0900)
classの追加

src/AtomInfo.java [new file with mode: 0644]
src/Auxiliary.java
src/ChemiCraft.java
src/ChemiCraftAPI.java
src/ItemCompounds.java
src/ItemGasCollectingBottle.java [new file with mode: 0644]

diff --git a/src/AtomInfo.java b/src/AtomInfo.java
new file mode 100644 (file)
index 0000000..c26a475
--- /dev/null
@@ -0,0 +1,93 @@
+package net.minecraft.src.ChemiCraft;\r
+\r
+import net.minecraft.src.EntityPlayer;\r
+import net.minecraft.src.ItemStack;\r
+import net.minecraft.src.World;\r
+\r
+public class AtomInfo {\r
+\r
+       protected static int posX;\r
+       protected static int posY;\r
+       protected static int posZ;\r
+       protected static String biomeName;\r
+       protected static String weather;\r
+\r
+       public AtomInfo(World par1World, EntityPlayer par2EntityPlayer){\r
+\r
+               this.biomeName = par1World.getBiomeGenForCoords(posX, posZ).biomeName;\r
+\r
+               this.posX = (int) par2EntityPlayer.posX; // X\8dÀ\95W\r
+               this.posY = (int) par2EntityPlayer.posY; // Y\8dÀ\95W\r
+               this.posZ = (int) par2EntityPlayer.posZ; // Z\8dÀ\95W\r
+\r
+               boolean rainy = par1World.isRaining();\r
+               boolean thunder = par1World.isThundering();\r
+               if (rainy && thunder){ // \89J\8a\8e\82Â\97\8b\r
+                       this.weather = "THUNDER";\r
+               }else if(rainy){ // \89J\82Ü\82½\82Í\90á\r
+                       this.weather = "RAINY";\r
+               }else{ //\90°\82ê\r
+                       this.weather = "SUNNY";\r
+               }\r
+       }\r
+\r
+       /**\r
+        * Y\8dÀ\95W\82Æ\82Ì\94ä\8ar\r
+        * @param EntityPlayer EntityPlayer\r
+        * @param y Y\8dÀ\95W\r
+        * @param biomeName \83o\83C\83I\81[\83\80\82Ì\96¼\91O(null\82Å\82à\89Â)\r
+        * @param weather \93V\8bC(null\82Å\82à\89Â)\r
+        * @param par1 \93ü\8eè\90\94\r
+        * @param par2 \8eí\97Þ(\83_\83\81\81[\83W\92l)\r
+        */\r
+       private boolean equivalentBiome(String biomeName){\r
+               boolean ver1 = biomeName != null ? ((this.biomeName == biomeName) ? true : false) : true;\r
+               return ver1;\r
+       }\r
+       private boolean equivalentWeather(String weather){\r
+               boolean ver1 = weather != null ? ((this.weather == weather) ? true : false) : true;\r
+               return ver1;\r
+       }\r
+\r
+       protected void overY(EntityPlayer EntityPlayer, int y, String biomeName, String weather, int par1, int par2){\r
+               if(this.posY >= y && this.equivalentBiome(biomeName) && this.equivalentWeather(weather)){\r
+                       if (!EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ChemiCraft.itemAtoms, par1, par2)))\r
+                       {\r
+                               EntityPlayer.dropPlayerItem(new ItemStack(ChemiCraft.itemAtoms.shiftedIndex, par1, par2));\r
+                       }\r
+               }\r
+       }\r
+       protected void aboveY(EntityPlayer EntityPlayer, int y, String biomeName, String weather, int par1, int par2){\r
+               if(this.posY > y && this.equivalentBiome(biomeName) && this.equivalentWeather(weather)){\r
+                       if (!EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ChemiCraft.itemAtoms, par1, par2)))\r
+                       {\r
+                               EntityPlayer.dropPlayerItem(new ItemStack(ChemiCraft.itemAtoms.shiftedIndex, par1, par2));\r
+                       }\r
+               }\r
+       }\r
+       protected void equivalentY(EntityPlayer EntityPlayer, int y, String biomeName, String weather, int par1, int par2){\r
+               if(this.posY == y && this.equivalentBiome(biomeName) && this.equivalentWeather(weather)){\r
+                       if (!EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ChemiCraft.itemAtoms, par1, par2)))\r
+                       {\r
+                               EntityPlayer.dropPlayerItem(new ItemStack(ChemiCraft.itemAtoms.shiftedIndex, par1, par2));\r
+                       }\r
+               }\r
+       }\r
+       protected void lessY(EntityPlayer EntityPlayer, int y, String biomeName, String weather, int par1, int par2){\r
+               if(this.posY < y && this.equivalentBiome(biomeName) && this.equivalentWeather(weather)){\r
+                       if (!EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ChemiCraft.itemAtoms, par1, par2)))\r
+                       {\r
+                               EntityPlayer.dropPlayerItem(new ItemStack(ChemiCraft.itemAtoms.shiftedIndex, par1, par2));\r
+                       }\r
+               }\r
+       }\r
+       protected void belowY(EntityPlayer EntityPlayer, int y, String biomeName, String weather, int par1, int par2){\r
+               if(this.posY <= y && this.equivalentBiome(biomeName) && this.equivalentWeather(weather)){\r
+                       if (!EntityPlayer.inventory.addItemStackToInventory(new ItemStack(ChemiCraft.itemAtoms, par1, par2)))\r
+                       {\r
+                               EntityPlayer.dropPlayerItem(new ItemStack(ChemiCraft.itemAtoms.shiftedIndex, par1, par2));\r
+                       }\r
+               }\r
+       }\r
+\r
+}\r
index 2473a02..ef6bb52 100644 (file)
@@ -13,7 +13,7 @@ public class Auxiliary {
        class NameAuxiliary{\r
 \r
                /**\r
-                * \82Æ\82è\82 \82¦\82¸\8dì\90¬\81B\82 \82é\82Ì\82Å\83{\83c\r
+                * \96¼\91O\82ð\92Ç\89Á\82·\82é\81B\r
                 * @param object\r
                 * @param Name\r
                 */\r
@@ -22,7 +22,7 @@ public class Auxiliary {
                }\r
 \r
                /**\r
-                * \82±\82¿\82ç\82à\82 \82é\82Ì\82Å\83{\83c\r
+                * \96¼\91O\82ð\92Ç\89Á\82·\82é(ItemStack\94Å)\r
                 * @param object\r
                 * @param name\r
                 * @param meta\r
@@ -30,13 +30,33 @@ public class Auxiliary {
                public void addName(ItemStack itemstack,Object name){\r
                        LanguageRegistry.addName(itemstack, (String) name);\r
                }\r
+               \r
+\r
+               /**\r
+                * \8ew\92è\82µ\82½\8c¾\8cê\82Å\96¼\91O\82ð\92Ç\89Á\82·\82é\81B\r
+                * @param object\r
+                * @param name\r
+                */\r
+               public void addName(Object object,String lang,Object name){\r
+                       LanguageRegistry.instance().addNameForObject(object, lang, (String) name);\r
+               }\r
+\r
+               /**\r
+                * \8ew\92è\82µ\82½\8c¾\8cê\82Å\96¼\91O\82ð\92Ç\89Á\82·\82é(ItemStack\94Å)\r
+                * @param object\r
+                * @param name\r
+                */\r
+\r
+               public void addName(ItemStack object,String lang,Object name){\r
+                       LanguageRegistry.instance().addNameForObject(object, lang, (String) name);\r
+               }\r
 \r
                /**\r
                 * \83\81\83^\83f\81[\83^+\94z\97ñ\82Å\96¼\91O\82ð\92Ç\89Á\82·\82é(Block\94Å)\r
                 * @param object\r
                 * @param name\r
                 */\r
-               public void addForName(Block object,Object[] name){\r
+               public void addName(Block object,Object[] name){\r
                        for(int i=0;i<name.length;i++){\r
                                LanguageRegistry.addName(new ItemStack(object,0,i), (String) name[i]);\r
                        }\r
@@ -47,7 +67,7 @@ public class Auxiliary {
                 * @param object\r
                 * @param name\r
                 */\r
-               public void addForName(Item object,Object[] name){\r
+               public void addName(Item object,Object[] name){\r
                        for(int i=0;i<name.length;i++){\r
                                LanguageRegistry.addName(new ItemStack(object,0,i), (String) name[i]);\r
                        }\r
@@ -58,7 +78,7 @@ public class Auxiliary {
                 * @param object\r
                 * @param name\r
                 */\r
-               public void addForLangName(Block object,String lang,Object[] name){\r
+               public void addName(Block object,String lang,Object[] name){\r
                        for(int i=0;i<name.length;i++){\r
                                LanguageRegistry.instance().addNameForObject(new ItemStack(object,0,i), lang, (String) name[i]);\r
                        }\r
@@ -69,7 +89,7 @@ public class Auxiliary {
                 * @param object\r
                 * @param name\r
                 */\r
-               public void addForLangName(Item object,String lang, Object[] name){\r
+               public void addName(Item object,String lang, Object[] name){\r
                        for(int i=0;i<name.length;i++){\r
                                LanguageRegistry.instance().addNameForObject(new ItemStack(object,0,i), lang, (String) name[i]);\r
                        }\r
index 905682b..6628332 100644 (file)
@@ -38,16 +38,29 @@ public class ChemiCraft
        };\r
 \r
        public static final String[] atomsNameJP = {\r
-               "\90\85\91f", "\83w\83\8a\83E\83\80"\r
+               "\90\85\91f", "\83w\83\8a\83E\83\80", "\83\8a\83`\83E\83\80", "\83x\83\8a\83E\83\80", "\83z\83E\91f", "\92Y\91f", "\92\82\91f", "\8e_\91f", "\83t\83b\91f", "\83l\83I\83\93",\r
+               "\83i\83g\83\8a\83E\83\80", "\83}\83O\83l\83V\83E\83\80", "\83A\83\8b\83~\83j\83E\83\80", "\83P\83C\91f", "\83\8a\83\93", "\97°\89©", "\89\96\91f", "\83A\83\8b\83S\83\93", "\83J\83\8a\83E\83\80", "\83J\83\8b\83V\83E\83\80",\r
+               "\83X\83J\83\93\83W\83E\83\80", "\83`\83^\83\93", "\83o\83i\83W\83E\83\80", "\83N\83\8d\83\80", "\83}\83\93\83K\83\93", "\93S", "\83R\83o\83\8b\83g", "\83j\83b\83P\83\8b", "\93º", "\88\9f\89\94",\r
+               "\83K\83\8a\83E\83\80", "\83Q\83\8b\83}\83j\83E\83\80", "\83q\91f", "\83Z\83\8c\83\93", "\8fL\91f", "\83N\83\8a\83v\83g\83\93", "\83\8b\83r\83W\83E\83\80", "\83X\83g\83\8d\83\93\83`\83E\83\80", "\83C\83b\83g\83\8a\83E\83\80", "\83W\83\8b\83R\83j\83E\83\80",\r
+               "\83j\83I\83u", "\83\82\83\8a\83u\83f\83\93", "\83e\83N\83l\83`\83E\83\80", "\83\8b\83e\83j\83E\83\80", "\83\8d\83W\83E\83\80", "\83p\83\89\83W\83E\83\80", "\8bâ", "\83J\83h\83~\83E\83\80", "\83C\83\93\83W\83E\83\80", "\83X\83Y",\r
+               "\83A\83\93\83`\83\82\83\93", "\83e\83\8b\83\8b", "\83\88\83E\91f", "\83L\83Z\83m\83\93", "\83Z\83V\83E\83\80", "\83o\83\8a\83E\83\80", "\83\89\83\93\83^\83\93", "\83Z\83\8a\83E\83\80", "\83v\83\89\83Z\83I\83W\83\80", "\83l\83I\83W\83\80",\r
+               "\83v\83\8d\83\81\83`\83E\83\80", "\83T\83}\83\8a\83E\83\80", "\83\86\83E\83\8d\83r\83E\83\80", "\83K\83h\83\8a\83j\83E\83\80", "\83e\83\8b\83r\83E\83\80", "\83W\83X\83v\83\8d\83j\83E\83\80", "\83z\83\8b\83~\83E\83\80", "\83G\83\8b\83r\83E\83\80", "\83c\83\8a\83E\83\80", "\83C\83b\83e\83\8b\83r\83E\83\80",\r
+               "\83\8b\83e\83`\83E\83\80", "\83n\83t\83j\83E\83\80", "\83^\83\93\83^\83\8b", "\83^\83\93\83O\83X\83e\83\93", "\83\8c\83j\83E\83\80", "\83I\83X\83~\83E\83\80", "\83C\83\8a\83W\83E\83\80", "\94\92\8bà", "\8bà", "\90\85\8bâ",\r
+               "\83^\83\8a\83E\83\80", "\89\94", "\83r\83X\83}\83X", "\83|\83\8d\83j\83E\83\80", "\83A\83X\83^\83`\83\93", "\83\89\83h\83\93", "\83t\83\89\83\93\83V\83E\83\80", "\83\89\83W\83E\83\80", "\83A\83N\83`\83j\83E\83\80", "\83g\83\8a\83E\83\80",\r
+               "\83v\83\8d\83g\83A\83N\83`\83E\83\80", "\83E\83\89\83\93", "\83l\83v\83c\83j\83E\83\80", "\83v\83\8b\83g\83j\83E\83\80", "\83A\83\81\83\8a\83V\83E\83\80", "\83L\83\85\83\8a\83E\83\80", "\83o\81[\83N\83\8a\83E\83\80", "\83J\83\8b\83z\83\8b\83j\83E\83\80", "\83A\83C\83\93\83X\83^\83C\83j\83E\83\80", "\83t\83F\83\8b\83~\83E\83\80",\r
+               "\83\81\83\93\83f\83\8c\83r\83E\83\80", "\83m\81[\83x\83\8a\83E\83\80", "\83\8d\81[\83\8c\83\93\83V\83E\83\80", "\83\89\83T\83z\81[\83W\83E\83\80", "\83h\83u\83j\83E\83\80", "\83V\81[\83{\81[\83M\83E\83\80", "\83{\81[\83\8a\83E\83\80", "\83n\83b\83V\83E\83\80", "\83}\83C\83g\83l\83\8a\83E\83\80", "\83_\81[\83\80\83X\83^\83`\83E\83\80",\r
+               "\83\8c\83\93\83g\83Q\83j\83E\83\80", "\83R\83y\83\8b\83j\83V\83E\83\80", "\83E\83\93\83E\83\93\83g\83\8a\83E\83\80", "\83t\83\8c\83\8d\83r\83E\83\80", "\83E\83\93\83E\83\93\83y\83\93\83`\83E\83\80", "\83\8a\83o\83\82\83\8a\83E\83\80", "\83E\83\93\83E\83\93\83Z\83v\83`\83E\83\80", "\83E\83\93\83E\83\93\83I\83N\83`\83E\83\80"\r
        };\r
 \r
        private ChemiCraftAPI chemiCraftAPI = ChemiCraftAPI.instance;\r
 \r
        public static int atomsID;\r
        public static int compoundsID;\r
+       public static int gasCollectingBottleID;\r
 \r
        public static Item itemAtoms;\r
        public static Item itemCompounds;\r
+       public static Item itemGasCollectingBottle;\r
 \r
        private Auxiliary Auxiliary = new Auxiliary();\r
        private Auxiliary.NameAuxiliary NameAuxiliary = Auxiliary.new NameAuxiliary();\r
@@ -57,7 +70,8 @@ public class ChemiCraft
        public void chemiLoadMethod(FMLInitializationEvent event)\r
        {\r
                //\89»\8d\87\95¨\82Ì\92Ç\89Á\r
-               ChemiCraftAPI.addLangCompound("ja_JP", "Salt", "\89\96(\89\96\89»\83i\83g\83\8a\83E\83\80)");\r
+               ChemiCraftAPI.addCompound("Salt(Sodium chloride)");\r
+               ChemiCraftAPI.addLangCompound("ja_JP", "\89\96(\89\96\89»\83i\83g\83\8a\83E\83\80)");\r
        }\r
 \r
        @Mod.PreInit  // \91O\8f\88\97\9d\r
@@ -67,8 +81,10 @@ public class ChemiCraft
                cfg.load();\r
                Property atomsIDProp = cfg.getItem("atomsID", 25000);\r
                Property compoundsIDProp = cfg.getItem("compoundsID", 25001);\r
+               Property gasCollectingBottleIDProp = cfg.getItem("gasCollectingBottleID", 25002);\r
                atomsID = atomsIDProp.getInt();\r
                compoundsID = compoundsIDProp.getInt();\r
+               gasCollectingBottleID = gasCollectingBottleIDProp.getInt();\r
                cfg.save();\r
        }\r
 \r
@@ -77,14 +93,14 @@ public class ChemiCraft
        {\r
                itemAtoms = new ItemAtoms(atomsID).setItemName("atoms");\r
                itemCompounds = new ItemCompounds(compoundsID).setItemName("compounds");\r
-\r
-               NameAuxiliary.addForName(itemAtoms, atomsName);\r
-               NameAuxiliary.addForLangName(itemAtoms, "ja_JP", atomsNameJP);\r
-               NameAuxiliary.addForName(itemCompounds, ChemiCraftAPI.getCompoundsName().toArray());\r
-               NameAuxiliary.addForLangName(itemCompounds, "ja_JP", ChemiCraftAPI.getCompoundsLangName().toArray());\r
-\r
-               ChemiCraftAPI.addCompoundHandler("Salt", new CompoundHandlerTest());\r
-\r
+               itemGasCollectingBottle = new ItemGasCollectingBottle(gasCollectingBottleID).setItemName("gasCollectingBottle");\r
+\r
+               NameAuxiliary.addName(itemAtoms, atomsName);\r
+               NameAuxiliary.addName(itemAtoms, "ja_JP", atomsNameJP);\r
+               NameAuxiliary.addName(itemCompounds, ChemiCraftAPI.getCompoundsName().toArray());\r
+               NameAuxiliary.addName(itemCompounds, "ja_JP", ChemiCraftAPI.getCompoundsLangName().toArray());\r
+               NameAuxiliary.addName(itemGasCollectingBottle, "GasCollectingBottle");\r
+               NameAuxiliary.addName(itemGasCollectingBottle, "ja_JP", "\8fW\8bC\95r");\r
        }\r
 \r
 }
\ No newline at end of file
index f624aa7..5d5be58 100644 (file)
@@ -10,18 +10,13 @@ public class ChemiCraftAPI {
        private static ArrayList<String> compoundsNameList = new ArrayList();
        private static ArrayList<String> compoundsLangNameList = new ArrayList();
        private static ArrayList<String> compoundsLangList = new ArrayList();
-       private static ArrayList<ICompoundHandler> compoundHandlers = new ArrayList<ICompoundHandler>();
-       private static ArrayList<String> compoundHandlerItemNames = new ArrayList<String>();
 
        public static void addCompound(String name){
                compoundsNameList.add(name);
-               compoundsLangNameList.add("");
-               compoundsLangList.add("");
        }
 
-       public static void addLangCompound(String lang, String englishName, String langName){
-               compoundsNameList.add(englishName);
-               compoundsLangNameList.add(langName);
+       public static void addLangCompound(String lang, String name){
+               compoundsLangNameList.add(name);
                compoundsLangList.add(lang);
        }
 
@@ -40,20 +35,4 @@ public class ChemiCraftAPI {
                return compoundsLangList;
        }
 
-       public static void addCompoundHandler(String handlerItemName, ICompoundHandler compoundHandler){
-               ChemiCraftAPI.compoundHandlers.add(compoundHandler);
-               compoundHandlerItemNames.add(handlerItemName);
-       }
-
-       public static ArrayList<ICompoundHandler> getCompoundHandler(){
-               compoundHandlers.trimToSize();
-               return compoundHandlers;
-
-       }
-
-       public static ArrayList<String> getCompoundHandlerItemName(){
-               compoundHandlerItemNames.trimToSize();
-               return compoundHandlerItemNames;
-       }
-
 }
index 36bad92..6c521b5 100644 (file)
@@ -5,10 +5,8 @@ import java.util.List;
 import cpw.mods.fml.common.Side;
 import cpw.mods.fml.common.asm.SideOnly;
 import net.minecraft.src.CreativeTabs;
-import net.minecraft.src.Entity;
 import net.minecraft.src.Item;
 import net.minecraft.src.ItemStack;
-import net.minecraft.src.World;
 
 public class ItemCompounds extends Item {
 
@@ -20,17 +18,6 @@ public class ItemCompounds extends Item {
                this.setCreativeTab(CreativeTabs.tabMaterials);
        }
 
-       @Override
-       public void onUpdate(ItemStack par1ItemStack, World par2World, Entity par3Entity, int par4, boolean par5){
-               for(int i=0;i < ChemiCraftAPI.getCompoundsName().size();i++){
-                       for(int j=0;j < ChemiCraftAPI.getCompoundHandlerItemName().size();j++){
-                               if(ChemiCraftAPI.getCompoundsName().get(i).equals(ChemiCraftAPI.getCompoundHandlerItemName().get(i))){
-                                       ChemiCraftAPI.getCompoundHandler().get(j).onUpdateHandler(par1ItemStack, par2World, par3Entity, par4, par5);
-                               }
-                       }
-               }
-       }
-
        @SideOnly(Side.CLIENT)
        @Override
        public void getSubItems(int par1, CreativeTabs par2CreativeTabs, List par3List)
diff --git a/src/ItemGasCollectingBottle.java b/src/ItemGasCollectingBottle.java
new file mode 100644 (file)
index 0000000..9fd8d53
--- /dev/null
@@ -0,0 +1,32 @@
+package net.minecraft.src.ChemiCraft;
+
+import java.util.Random;
+
+import net.minecraft.src.*;
+
+public class ItemGasCollectingBottle extends Item {
+
+       protected ItemGasCollectingBottle(int id) {
+               super(id);
+               this.setMaxStackSize(1);
+               this.setMaxDamage(2);
+               this.setCreativeTab(CreativeTabs.tabMaterials);
+       }
+
+       @Override
+       public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer){
+
+               par1ItemStack.damageItem(1, par3EntityPlayer);
+               AtomInfo AtomInfo = new AtomInfo(par2World, par3EntityPlayer);
+               AtomInfo.aboveY(par3EntityPlayer, 128, null, null, 0, 7);
+               return par1ItemStack;
+       }
+
+       @Override
+    public String getTextureFile()
+    {
+        this.isDefaultTexture = false;
+        return "/ChemiCraft/items.png";
+    }
+
+}