OSDN Git Service

Merge branch 'master' of https://scm.sourceforge.jp/gitroot/chemicraft/chemicraft
authormozipi <mozipi_2@yahoo.co.jp>
Thu, 4 Apr 2013 03:59:56 +0000 (12:59 +0900)
committermozipi <mozipi_2@yahoo.co.jp>
Thu, 4 Apr 2013 03:59:56 +0000 (12:59 +0900)
common/pcc/chemicraft/base/ChemiCraftBase.java
common/pcc/chemicraft/base/ChemiCraftBaseAPI.java
common/pcc/chemicraft/base/ChemiCraftRegisterChemicalRecipe.java
common/pcc/chemicraft/base/ore/BlockAtomOres.java
resources/mods/ChemiCraft/textures/blocks/AtomsOre_WIP.png [new file with mode: 0644]

index 98201ed..29788e0 100644 (file)
@@ -1,5 +1,7 @@
 package pcc.chemicraft.base;
 
+import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 import net.minecraft.block.Block;
@@ -8,7 +10,6 @@ import net.minecraft.item.Item;
 import net.minecraft.item.ItemStack;
 import net.minecraftforge.common.Configuration;
 import net.minecraftforge.common.Property;
-import net.minecraftforge.oredict.OreDictionary;
 import pcc.chemicraft.ChemiCraft;
 import pcc.chemicraft.ChemiCraftConfiguration;
 import pcc.chemicraft.ChemiCraftRegister;
@@ -28,7 +29,7 @@ import cpw.mods.fml.common.SidedProxy;
 import cpw.mods.fml.common.event.FMLPostInitializationEvent;
 import cpw.mods.fml.common.event.FMLPreInitializationEvent;
 import cpw.mods.fml.common.network.NetworkMod;
-import cpw.mods.fml.common.registry.GameRegistry;
+import cpw.mods.fml.common.registry.LanguageRegistry;
 
 @Mod(modid = "ChemiCraftBase", name = "ChemiCraftBase", version = "beta1")
 @NetworkMod(clientSideRequired = true, serverSideRequired = true, versionBounds = "1.4.7", channels = "chemicraftbase", packetHandler = PacketHandler.class)
@@ -97,6 +98,11 @@ public class ChemiCraftBase extends ChemiCraft {
        public ChemiCraftRegister registerRecipe;
        public ChemiCraftRegister registerEntitys;
 
+       /**
+        * the Textures
+        */
+       public static final String ORE = ChemiCraft.TEXTURE + "AtomsOre_";
+
        public ChemiCraftBase() {
                this.registerCompounds = new ChemiCraftRegisterCompounds(this);
                this.registerCompoundsHandler = new ChemiCraftRegisterCompoundsHandler(this);
@@ -194,20 +200,18 @@ public class ChemiCraftBase extends ChemiCraft {
 
        private void apiProcessing(final FMLPostInitializationEvent event) {
                // API用の処理
-               for (int i = 0; i < apiBase.getAtomOresName().sizeKeysList(); i++) {
-                       for (int j = 0; j < apiBase.getAtomOresName().sizeElementsList(apiBase.getAtomOresName().getKeyList(i)); j++) {
-                               ChemiCraftCore.logger.write("OreAddName:" + "Name-" + apiBase.getAtomOresName().get(apiBase.getAtomOresName().getKeyList(i), j) +
-                                               "/Lang-" + apiBase.getAtomOresLanguage().get(apiBase.getAtomOresName().getKeyList(i), j),
+               Iterator<String> langoresItr = this.apiBase.getAtomOresName().iterator();
+               while (langoresItr.hasNext()){
+                       String lang = langoresItr.next();
+                       ArrayList<String> names = this.apiBase.getAtomOresName().get(lang);
+                       for (int i = 0; i < names.size(); i++) {
+                               ChemiCraftCore.logger.write("AtomOresAddName:" + "Name-" + names.get(i) + "/Damage-" + (i - i / 16 * 16) + "/Lang-" + lang,
                                                EnumLoggingType.INFO);
 
-                               this.nameAuxiliary.addName(
-                                               new ItemStack(
-                                                               blockAtomOres[i / 16], 0, i - i / 16 * 16),
-                                                               apiBase.getAtomOresLanguage().get(apiBase.getAtomOresName().getKeyList(i), j),
-                                                               apiBase.getAtomOresName().get(apiBase.getAtomOresName().getKeyList(i), j));
-                               OreDictionary.registerOre("ore" + apiBase.getAtomOresName().getKeyList(i),
-                                               new ItemStack(blockAtomOres[i / 16], 1, i - i / 16 * 16));
-                               GameRegistry.registerWorldGenerator(apiBase.getAtomOres().get(i));
+                               LanguageRegistry.instance().addNameForObject(
+                                               new ItemStack(this.blockAtomOres[i / 16], 1, i - i / 16 * 16),
+                                               lang,
+                                               names.get(i));
                        }
                }
        }
index a4a2f6c..42fbf02 100644 (file)
@@ -5,7 +5,6 @@ import java.util.HashMap;
 
 import pcc.chemicraft.base.gen.EnumOreSpawnFrequency;
 import pcc.chemicraft.base.gen.WorldGenAtomsOre;
-import pcc.chemicraft.util.AtomInfo;
 import pcc.chemicraft.util.Formula;
 import pcc.chemicraft.util.ListHash;
 
@@ -37,12 +36,6 @@ public class ChemiCraftBaseAPI {
 
 
        /**
-        * 鉱石の言語リスト
-        */
-       private ListHash<String, String> atomOresLangListHash = new ListHash<String, String>();
-
-
-       /**
         * 鉱石リスト
         */
        private ArrayList<WorldGenAtomsOre> atomOresList = new ArrayList<WorldGenAtomsOre>();
@@ -84,8 +77,8 @@ public class ChemiCraftBaseAPI {
                        var7 = var7.concat(" Ore");
                }
 
-               this.atomOresEnglishList.add(par1Name + " Ore");
-               addAtomOresLanguage(par1Name, var7, "en_US");
+               this.atomOresEnglishList.add(var7);
+               addAtomOresLanguage(var7, "en_US");
        }
 
 
@@ -116,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
+                               );
        }
 
 
@@ -137,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;
        }
 
 
index d2fbda0..fb1dbb6 100644 (file)
@@ -28,7 +28,7 @@ public class ChemiCraftRegisterChemicalRecipe extends ChemiCraftBaseRegister {
                                                this.mod.atomOresID[this.mod.apiBase.getAtomOresLastIndex()],
                                                EnumOreSpawnFrequency.NORMAL);
                                //日本語名で追加
-                               this.mod.apiBase.addAtomOresLanguage(ChemiCraftCore.ATOMSNAME[i], ChemiCraftCore.ATOMSNAMEJP[i] + "鉱石", "ja_JP");
+                               this.mod.apiBase.addAtomOresLanguage(ChemiCraftCore.ATOMSNAMEJP[i] + "鉱石", "ja_JP");
                        }
                }
 
@@ -39,7 +39,7 @@ public class ChemiCraftRegisterChemicalRecipe extends ChemiCraftBaseRegister {
                                this.mod.atomOresID[this.mod.apiBase.getAtomOresLastIndex()],
                                EnumOreSpawnFrequency.RARE);
                // LaCePrNdPmSmEuGdTbDyHoErTmYbLu
-               this.mod.apiBase.addAtomOresLanguage("Lanthanoid", "ランタノイド鉱石", "ja_JP");
+               this.mod.apiBase.addAtomOresLanguage("ランタノイド鉱石", "ja_JP");
 
                // アクチノイド鉱石
                this.mod.apiBase.addAtomOres(
@@ -48,7 +48,7 @@ public class ChemiCraftRegisterChemicalRecipe extends ChemiCraftBaseRegister {
                                this.mod.atomOresID[this.mod.apiBase.getAtomOresLastIndex()],
                                EnumOreSpawnFrequency.RARE);
                // AcThPaUNpPuAmCmBkCfEsFmMdNoLr
-               this.mod.apiBase.addAtomOresLanguage("Actinoid", "アクチノイド鉱石", "ja_JP");
+               this.mod.apiBase.addAtomOresLanguage("アクチノイド鉱石", "ja_JP");
 
        }
 
index 96bb8bb..dce3bab 100644 (file)
@@ -4,6 +4,7 @@ import java.util.List;
 
 import net.minecraft.block.Block;
 import net.minecraft.block.material.Material;
+import net.minecraft.client.renderer.texture.IconRegister;
 import net.minecraft.creativetab.CreativeTabs;
 import net.minecraft.item.ItemStack;
 import net.minecraft.util.Icon;
@@ -18,17 +19,29 @@ import cpw.mods.fml.relauncher.SideOnly;
  */
 public class BlockAtomOres extends Block {
 
+       @SideOnly(Side.CLIENT)
+    private Icon[] iconArray;
+
        public BlockAtomOres(int id) {
                super(id, Material.rock);
                this.setCreativeTab(ChemiCraftBase.instance.creativeTabAtomsOre);
        }
 
-       /* 一時保留。詳しい事が決まらないと、変更が難しいため。 --WIP--
+       @Override
+       @SideOnly(Side.CLIENT)
+       public void registerIcons(IconRegister par1IconRegister) {
+               this.iconArray = new Icon[ChemiCraftCore.ATOMSNAME.length];
+
+               for (int i = 0; i < this.iconArray.length; i++){
+                       this.iconArray[i] = par1IconRegister.registerIcon(ChemiCraftBase.ORE + "WIP");
+               }
+       }
+
        @Override
        public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) {
-               return (this.blockID - ChemiCraftBase.instance.atomOresID[0]) * 16 + par2;
+               int var3 = this.blockID - ChemiCraftBase.instance.atomOresID[0];
+               return this.iconArray[var3 - var3 / 16 * 16];
        }
-       */
 
        @Override
        public int damageDropped(int par1) {
diff --git a/resources/mods/ChemiCraft/textures/blocks/AtomsOre_WIP.png b/resources/mods/ChemiCraft/textures/blocks/AtomsOre_WIP.png
new file mode 100644 (file)
index 0000000..dc85615
Binary files /dev/null and b/resources/mods/ChemiCraft/textures/blocks/AtomsOre_WIP.png differ