    001    package net.minecraft.src;
    002
    003    public class InventoryCraftResult implements IInventory
    004    {
    005        /** A list of one item containing the result of the crafting formula */
    006        private ItemStack[] stackResult = new ItemStack[1];
    007
    008        /**
    009         * Returns the number of slots in the inventory.
    010         */
    011        public int getSizeInventory()
    012        {
    013            return 1;
    014        }
    015
    016        /**
    017         * Returns the stack in slot i
    018         */
    019        public ItemStack getStackInSlot(int par1)
    020        {
    021            return this.stackResult[par1];
    022        }
    023
    024        /**
    025         * Returns the name of the inventory.
    026         */
    027        public String getInvName()
    028        {
    029            return "Result";
    030        }
    031
    032        /**
    033         * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a
    034         * new stack.
    035         */
    036        public ItemStack decrStackSize(int par1, int par2)
    037        {
    038            if (this.stackResult[par1] != null)
    039            {
    040                ItemStack var3 = this.stackResult[par1];
    041                this.stackResult[par1] = null;
    042                return var3;
    043            }
    044            else
    045            {
    046                return null;
    047            }
    048        }
    049
    050        /**
    051         * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem -
    052         * like when you close a workbench GUI.
    053         */
    054        public ItemStack getStackInSlotOnClosing(int par1)
    055        {
    056            if (this.stackResult[par1] != null)
    057            {
    058                ItemStack var2 = this.stackResult[par1];
    059                this.stackResult[par1] = null;
    060                return var2;
    061            }
    062            else
    063            {
    064                return null;
    065            }
    066        }
    067
    068        /**
    069         * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
    070         */
    071        public void setInventorySlotContents(int par1, ItemStack par2ItemStack)
    072        {
    073            this.stackResult[par1] = par2ItemStack;
    074        }
    075
    076        /**
    077         * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't
    078         * this more of a set than a get?*
    079         */
    080        public int getInventoryStackLimit()
    081        {
    082            return 64;
    083        }
    084
    085        /**
    086         * Called when an the contents of an Inventory change, usually
    087         */
    088        public void onInventoryChanged() {}
    089
    090        /**
    091         * Do not make give this method the name canInteractWith because it clashes with Container
    092         */
    093        public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer)
    094        {
    095            return true;
    096        }
    097
    098        public void openChest() {}
    099
    100        public void closeChest() {}
    101    }