OSDN Git Service

修正・変更
[chemicraft/chemicraft.git] / common / pcc / chemicraft / base / ore / BlockAtomOres.java
index 9e46de7..dce3bab 100644 (file)
@@ -4,57 +4,64 @@ 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;
 import cpw.mods.fml.relauncher.SideOnly;
 
-public class BlockAtomOres extends Block
-{
+/**
+ * 鉱石のクラスです
+ * @author mozipi,ponkotate
+ */
+public class BlockAtomOres extends Block {
 
-       public BlockAtomOres(int id)
-       {
+       @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 int damageDropped(int par1)
-       {
+       public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) {
+               int var3 = this.blockID - ChemiCraftBase.instance.atomOresID[0];
+               return this.iconArray[var3 - var3 / 16 * 16];
+       }
+
+       @Override
+       public int damageDropped(int par1) {
                return par1;
        }
 
-       public static int getBlockFromDye(int par0)
-       {
+       public static int getBlockFromDye(int par0) {
                return ~par0 & 15;
        }
 
-       public static int getDyeFromBlock(int par0)
-       {
+       public static int getDyeFromBlock(int par0) {
                return ~par0 & 15;
        }
 
        @Override
        @SideOnly(Side.CLIENT)
-       public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List)
-       {
+       public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) {
                for (int var4 = 0; var4 < 16; ++var4) {
                        par3List.add(new ItemStack(par1, 1, var4));
                }
        }
 
-       @Override
-       public String getTextureFile()
-       {
-               return ChemiCraftCore.instance.BLOCK_ATOMS_ORE_TEXTURE;
-       }
-
 }