1 package pcc.chemicraft.base.item;
3 import net.minecraft.client.renderer.texture.IconRegister;
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 import pcc.chemicraft.ChemiCraft;
10 import pcc.chemicraft.base.ChemiCraftBase;
11 import pcc.chemicraft.core.ChemiCraftCore;
13 public class ItemOreSerarcher extends Item {
15 public ItemOreSerarcher(int par1) {
17 this.setHasSubtypes(true);
18 this.setMaxStackSize(1);
20 this.setCreativeTab(ChemiCraftCore.creativeTabChemiCraft);
24 public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
25 for (int i = 0; i < ChemiCraftBase.instance.atomOresID.length; i++) {
26 if (par3World.getBlockId(par4, par5, par6) == ChemiCraftBase.instance.atomOresID[i]) {
27 if (par1ItemStack.getTagCompound() == null) {
28 par1ItemStack.stackTagCompound = new NBTTagCompound();
30 if (par3World.isRemote) {
31 this.changeItem(par2EntityPlayer);
33 String blockName = ChemiCraftBase.instance.apiBase.getAtomOresAtomName().get(
34 (Math.abs(ChemiCraftBase.instance.atomOresID[ChemiCraftBase.instance.atomOresID.length-1] -
35 (par3World.getBlockId(par4, par5, par6) + 3))) * 16 +
36 par3World.getBlockMetadata(par4, par5, par6));
37 par1ItemStack.getTagCompound().setString("OreName", blockName);
43 public void changeItem(EntityPlayer par1EntityPlayer) {
44 par1EntityPlayer.inventory.inventoryChanged = true;
48 public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
49 this.changeItem(par3EntityPlayer);
53 public String getItemDisplayName(ItemStack par1ItemStack) {
54 if (par1ItemStack.getTagCompound() != null) {
55 return "OreSearcher:" + par1ItemStack.getTagCompound().getString("OreName");
61 public boolean getShareTag() {
66 public void updateIcons(IconRegister par1IconRegister){
67 this.iconIndex = par1IconRegister.registerIcon(ChemiCraft.TEXTURE + "ItemOreSearcher");