OSDN Git Service

修正・変更
[chemicraft/chemicraft.git] / common / pcc / chemicraft / base / ore / BlockAtomOres.java
index 1a38df1..dce3bab 100644 (file)
@@ -4,8 +4,10 @@ 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;
 import pcc.chemicraft.base.ChemiCraftBase;
 import pcc.chemicraft.core.ChemiCraftCore;
 import cpw.mods.fml.relauncher.Side;
@@ -17,14 +19,28 @@ 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);
        }
 
        @Override
-       public int getBlockTextureFromSideAndMetadata(int par1, int par2) {
-               return (this.blockID - ChemiCraftBase.instance.atomOresID[0]) * 16 + par2;
+       @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) {
+               int var3 = this.blockID - ChemiCraftBase.instance.atomOresID[0];
+               return this.iconArray[var3 - var3 / 16 * 16];
        }
 
        @Override
@@ -48,9 +64,4 @@ public class BlockAtomOres extends Block {
                }
        }
 
-       @Override
-       public String getTextureFile() {
-               return ChemiCraftCore.instance.BLOCK_ATOMS_ORE_TEXTURE;
-       }
-
 }