OSDN Git Service

修正・変更
[chemicraft/chemicraft.git] / common / pcc / chemicraft / base / ore / BlockAtomOres.java
1 package pcc.chemicraft.base.ore;
2
3 import java.util.List;
4
5 import net.minecraft.block.Block;
6 import net.minecraft.block.material.Material;
7 import net.minecraft.client.renderer.texture.IconRegister;
8 import net.minecraft.creativetab.CreativeTabs;
9 import net.minecraft.item.ItemStack;
10 import net.minecraft.util.Icon;
11 import pcc.chemicraft.base.ChemiCraftBase;
12 import pcc.chemicraft.base.ChemiCraftBaseAPI;
13 import pcc.chemicraft.core.ChemiCraftCore;
14 import cpw.mods.fml.relauncher.Side;
15 import cpw.mods.fml.relauncher.SideOnly;
16
17 /**
18  * 鉱石のクラスです
19  * @author mozipi,ponkotate
20  */
21 public class BlockAtomOres extends Block {
22
23         @SideOnly(Side.CLIENT)
24     private Icon[] iconArray;
25
26         public BlockAtomOres(int id) {
27                 super(id, Material.rock);
28                 this.setCreativeTab(ChemiCraftBase.instance.creativeTabAtomsOre);
29         }
30
31         @Override
32         @SideOnly(Side.CLIENT)
33         public void registerIcons(IconRegister par1IconRegister) {
34                 this.iconArray = new Icon[ChemiCraftCore.ATOMSNAME.length];
35
36                 for (int i = 0; i < this.iconArray.length; i++){
37                         this.iconArray[i] = par1IconRegister.registerIcon(ChemiCraftBase.ORE + "WIP");
38                 }
39         }
40
41         @Override
42         public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) {
43                 int var3 = this.blockID - ChemiCraftBase.instance.atomOresID[0];
44                 return this.iconArray[par2 + var3 * 16];
45         }
46
47         @Override
48         public int damageDropped(int par1) {
49                 return par1;
50         }
51
52         public static int getBlockFromDye(int par0) {
53                 return ~par0 & 15;
54         }
55
56         public static int getDyeFromBlock(int par0) {
57                 return ~par0 & 15;
58         }
59
60         @Override
61         @SideOnly(Side.CLIENT)
62         public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) {
63                 int var4 = this.blockID - ChemiCraftBase.instance.atomOresID[0] + 1;
64                 int var5 = 16;
65                 if (var4 == ChemiCraftBase.instance.atomOresID.length){
66                         var5 -= var4 * 16 - ChemiCraftBaseAPI.instance().getAtomOresAtomName().size();
67                 }
68                 for (int i = 0; i < var5; i++) {
69                         par3List.add(new ItemStack(par1, 1, i));
70                 }
71         }
72
73 }