OSDN Git Service

いろいろした
[chemicraft/chemicraft.git] / common / pcc / chemicraft / base / item / ItemOreSerarcher.java
1 package pcc.chemicraft.base.item;
2
3 import pcc.chemicraft.base.ChemiCraftBase;
4 import net.minecraft.entity.player.EntityPlayer;
5 import net.minecraft.item.Item;
6 import net.minecraft.item.ItemStack;
7 import net.minecraft.nbt.NBTTagCompound;
8 import net.minecraft.world.World;
9
10 public class ItemOreSerarcher extends Item {
11
12         public ItemOreSerarcher(int par1) {
13                 super(par1);
14                 this.setMaxStackSize(1);
15         }
16
17         @Override
18         public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
19                 for (int i = 0; i < ChemiCraftBase.instance.atomOresID.length; i++) {
20                         if (par3World.getBlockId(par4, par5, par6) == ChemiCraftBase.instance.atomOresID[i]) {
21                                 if (par1ItemStack.getTagCompound() == null) par1ItemStack.stackTagCompound = new NBTTagCompound();
22                                 par1ItemStack.getTagCompound().setString("OreName", ChemiCraftBase.instance.blockAtomOres[i].getBlockName());
23                         }
24                 }
25                 return true;
26         }
27
28         @Override
29         public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
30                 return par1ItemStack;
31         }
32
33
34
35         @Override
36         public String getItemNameIS(ItemStack par1ItemStack) {
37                 if (par1ItemStack.getTagCompound() != null) {
38                         return super.getItemName() + "." + par1ItemStack.getTagCompound().getString("OreName");
39                 }
40                 return super.getItemName();
41         }
42
43         @Override
44         public boolean getShareTag() {
45                 return super.getShareTag();
46         }
47
48
49
50 }