    001package net.minecraft.client;
    002
    003import cpw.mods.fml.relauncher.Side;
    004import cpw.mods.fml.relauncher.SideOnly;
    005import net.minecraft.client.settings.GameSettings;
    006import net.minecraft.stats.IStatStringFormat;
    007
    008@SideOnly(Side.CLIENT)
    009public class StatStringFormatKeyInv implements IStatStringFormat
    010{
    011    /** Minecraft instance */
    012    final Minecraft mc;
    013
    014    public StatStringFormatKeyInv(Minecraft par1Minecraft)
    015    {
    016        this.mc = par1Minecraft;
    017    }
    018
    019    /**
    020     * Formats the strings based on 'IStatStringFormat' interface.
    021     */
    022    public String formatString(String par1Str)
    023    {
    024        try
    025        {
    026            return String.format(par1Str, new Object[] {GameSettings.getKeyDisplayString(this.mc.gameSettings.keyBindInventory.keyCode)});
    027        }
    028        catch (Exception exception)
    029        {
    030            return "Error: " + exception.getLocalizedMessage();
    031        }
    032    }
    033}