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