1 package pcc.chemicraft.base.item;
3 import cpw.mods.fml.common.registry.LanguageRegistry;
4 import cpw.mods.fml.relauncher.SideOnly;
5 import pcc.chemicraft.ChemiCraft;
6 import pcc.chemicraft.base.ChemiCraftBase;
7 import pcc.chemicraft.core.ChemiCraftCore;
8 import net.minecraft.client.renderer.texture.IconRegister;
9 import net.minecraft.entity.player.EntityPlayer;
10 import net.minecraft.item.Item;
11 import net.minecraft.item.ItemStack;
12 import net.minecraft.nbt.NBTTagCompound;
13 import net.minecraft.util.StringTranslate;
14 import net.minecraft.world.World;
16 public class ItemOreSerarcher extends Item {
18 public ItemOreSerarcher(int par1) {
20 this.setHasSubtypes(true);
21 this.setMaxStackSize(1);
23 this.setCreativeTab(ChemiCraftCore.creativeTabChemiCraft);
27 public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
28 for (int i = 0; i < ChemiCraftBase.instance.atomOresID.length; i++) {
29 if (par3World.getBlockId(par4, par5, par6) == ChemiCraftBase.instance.atomOresID[i]) {
30 if (par1ItemStack.getTagCompound() == null) {
31 par1ItemStack.stackTagCompound = new NBTTagCompound();
33 if (par3World.isRemote) {
34 this.changeItem(par2EntityPlayer);
36 String blockName = ChemiCraftBase.instance.apiBase.getAtomOreEnglishName(
37 (Math.abs(ChemiCraftBase.instance.atomOresID[ChemiCraftBase.instance.atomOresID.length-1] -
38 (par3World.getBlockId(par4, par5, par6) + 3))) * 16 +
39 par3World.getBlockMetadata(par4, par5, par6));
40 par1ItemStack.getTagCompound().setString("OreName", blockName);
46 public void changeItem(EntityPlayer par1EntityPlayer) {
47 par1EntityPlayer.inventory.inventoryChanged = true;
51 public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
52 this.changeItem(par3EntityPlayer);
56 public String getItemDisplayName(ItemStack par1ItemStack) {
57 if (par1ItemStack.getTagCompound() != null) {
58 return "OreSearcher:" + par1ItemStack.getTagCompound().getString("OreName");
64 public boolean getShareTag() {
69 public void updateIcons(IconRegister par1IconRegister){
70 this.iconIndex = par1IconRegister.registerIcon(ChemiCraft.ITEM_TEXTURE + "ItemOreSearcher");