OSDN Git Service

・mcmod.info修正
[chemicraft/chemicraft.git] / common / pcc / chemicraft / base / ore / BlockAtomOres.java
1 package pcc.chemicraft.base.ore;
2
3 import java.util.ArrayList;
4 import java.util.List;
5
6 import net.minecraft.block.Block;
7 import net.minecraft.block.material.Material;
8 import net.minecraft.client.renderer.texture.IconRegister;
9 import net.minecraft.creativetab.CreativeTabs;
10 import net.minecraft.item.ItemStack;
11 import net.minecraft.util.Icon;
12 import pcc.chemicraft.base.ChemiCraftBase;
13 import pcc.chemicraft.base.ChemiCraftBaseAPI;
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[] icons;
25
26         public BlockAtomOres(int id) {
27                 super(id, Material.rock);
28                 this.setCreativeTab(ChemiCraftBase.instance.creativeTabAtomOres);
29         }
30
31         @Override
32         @SideOnly(Side.CLIENT)
33         public void registerIcons(IconRegister par1IconRegister) {
34                 ArrayList<String> atomNames = ChemiCraftBaseAPI.instance().getAtomOresAtomName();
35                 this.icons = new Icon[atomNames.size()];
36
37                 for (int i = 0; i < this.icons.length; i++){
38                         this.icons[i] = par1IconRegister.registerIcon(ChemiCraftBase.ORE + atomNames.get(i));
39                 }
40
41                 // WIP
42                 this.icons[icons.length - 1] = par1IconRegister.registerIcon(ChemiCraftBase.ORE + "WIP");
43                 this.icons[icons.length - 2] = par1IconRegister.registerIcon(ChemiCraftBase.ORE + "WIP");
44         }
45
46         @Override
47         public Icon getBlockTextureFromSideAndMetadata(int par1, int par2) {
48                 int var3 = this.blockID - ChemiCraftBase.instance.atomOresID[0];
49                 return this.icons[par2 + var3 * 16];
50         }
51
52         @Override
53         public int damageDropped(int par1) {
54                 return par1;
55         }
56
57         public static int getBlockFromDye(int par0) {
58                 return ~par0 & 15;
59         }
60
61         public static int getDyeFromBlock(int par0) {
62                 return ~par0 & 15;
63         }
64
65         @Override
66         @SideOnly(Side.CLIENT)
67         public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) {
68                 int var4 = this.blockID - ChemiCraftBase.instance.atomOresID[0] + 1;
69                 int var5 = 16;
70                 if (var4 == ChemiCraftBase.instance.atomOresID.length){
71                         var5 -= var4 * 16 - ChemiCraftBaseAPI.instance().getAtomOresAtomName().size();
72                 }
73                 for (int i = 0; i < var5; i++) {
74                         par3List.add(new ItemStack(par1, 1, i));
75                 }
76         }
77
78 }