package tonius.zoom;

import java.util.List;

import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;

import org.lwjgl.input.Keyboard;

import tonius.zoom.client.KeyHandler;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

public class ItemBinoculars extends Item {
    
    public ItemBinoculars() {
        this.setMaxStackSize(1);
        this.setUnlocalizedName(Zoom.PREFIX + "binoculars");
        this.setTextureName(Zoom.RESOURCE_PREFIX + "binoculars");
        this.setCreativeTab(CreativeTabs.tabTools);
        
        GameRegistry.registerItem(this, "binoculars");
    }
    
    @Override
    public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
        player.setItemInUse(itemStack, this.getMaxItemUseDuration(itemStack));
        return itemStack;
    }
    
    @Override
    public int getMaxItemUseDuration(ItemStack itemStack) {
        return Integer.MAX_VALUE;
    }
    
    @Override
    @SideOnly(Side.CLIENT)
    public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean bool) {
        list.add(StatCollector.translateToLocal("item.zoom.binoculars.desc.1"));
        if (KeyHandler.keyZoom.getKeyCode() != 0) {
            list.add(StatCollector.translateToLocalFormatted("item.zoom.binoculars.desc.2", EnumChatFormatting.AQUA + Keyboard.getKeyName(KeyHandler.keyZoom.getKeyCode()) + EnumChatFormatting.GRAY));
        }
    }
}

@@ -39,16 +39,67 @@
 .List;%0A%0A
+import net.minecraft.client.settings.GameSettings;%0A
 import n
@@ -380,43 +380,8 @@
 ld;%0A
-%0Aimport org.lwjgl.input.Keyboard;%0A%0A
 impo
@@ -1648,27 +1648,40 @@
 A + 
-Keyboard.getKeyName
+GameSettings.getKeyDisplayString
 (Key

Use Minecraft's own utility method for getting the keybind name (also works with mouse buttons). Fixes #1