001package net.minecraft.inventory; 002 003import net.minecraft.entity.player.EntityPlayer; 004import net.minecraft.item.ItemStack; 005 006public interface IInventory 007{ 008 /** 009 * Returns the number of slots in the inventory. 010 */ 011 int getSizeInventory(); 012 013 /** 014 * Returns the stack in slot i 015 */ 016 ItemStack getStackInSlot(int i); 017 018 /** 019 * Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a 020 * new stack. 021 */ 022 ItemStack decrStackSize(int i, int j); 023 024 /** 025 * When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem - 026 * like when you close a workbench GUI. 027 */ 028 ItemStack getStackInSlotOnClosing(int i); 029 030 /** 031 * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections). 032 */ 033 void setInventorySlotContents(int i, ItemStack itemstack); 034 035 /** 036 * Returns the name of the inventory. 037 */ 038 String getInvName(); 039 040 /** 041 * If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's 042 * language. Otherwise it will be used directly. 043 */ 044 boolean isInvNameLocalized(); 045 046 /** 047 * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't 048 * this more of a set than a get?* 049 */ 050 int getInventoryStackLimit(); 051 052 /** 053 * Called when an the contents of an Inventory change, usually 054 */ 055 void onInventoryChanged(); 056 057 /** 058 * Do not make give this method the name canInteractWith because it clashes with Container 059 */ 060 boolean isUseableByPlayer(EntityPlayer entityplayer); 061 062 void openChest(); 063 064 void closeChest(); 065 066 /** 067 * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot. 068 */ 069 boolean isStackValidForSlot(int i, ItemStack itemstack); 070}