| 1 | package net.minecraft.inventory;
|
| 2 |
|
| 3 | import net.minecraft.entity.player.EntityPlayer;
|
| 4 | import net.minecraft.item.ItemStack;
|
| 5 | import net.minecraft.world.IWorldNameable;
|
| 6 |
|
| 7 | public interface IInventory extends IWorldNameable
|
| 8 | {
|
| 9 | /**
|
| 10 | * Returns the number of slots in the inventory.
|
| 11 | */
|
| 12 | int getSizeInventory();
|
| 13 |
|
| 14 | /**
|
| 15 | * Returns the stack in the given slot.
|
| 16 | */
|
| 17 | ItemStack getStackInSlot(int index);
|
| 18 |
|
| 19 | /**
|
| 20 | * Removes up to a specified number of items from an inventory slot and returns them in a new stack.
|
| 21 | */
|
| 22 | ItemStack decrStackSize(int index, int count);
|
| 23 |
|
| 24 | /**
|
| 25 | * Removes a stack from the given slot and returns it.
|
| 26 | */
|
| 27 | ItemStack removeStackFromSlot(int index);
|
| 28 |
|
| 29 | /**
|
| 30 | * Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
|
| 31 | */
|
| 32 | void setInventorySlotContents(int index, ItemStack stack);
|
| 33 |
|
| 34 | /**
|
| 35 | * Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended.
|
| 36 | */
|
| 37 | int getInventoryStackLimit();
|
| 38 |
|
| 39 | /**
|
| 40 | * For tile entities, ensures the chunk containing the tile entity is saved to disk later - the game won't think it
|
| 41 | * hasn't changed and skip it.
|
| 42 | */
|
| 43 | void markDirty();
|
| 44 |
|
| 45 | /**
|
| 46 | * Do not make give this method the name canInteractWith because it clashes with Container
|
| 47 | */
|
| 48 | boolean isUseableByPlayer(EntityPlayer player);
|
| 49 |
|
| 50 | void openInventory(EntityPlayer player);
|
| 51 |
|
| 52 | void closeInventory(EntityPlayer player);
|
| 53 |
|
| 54 | /**
|
| 55 | * Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
|
| 56 | */
|
| 57 | boolean isItemValidForSlot(int index, ItemStack stack);
|
| 58 |
|
| 59 | int getField(int id);
|
| 60 |
|
| 61 | void setField(int id, int value);
|
| 62 |
|
| 63 | int getFieldCount();
|
| 64 |
|
| 65 | void clear();
|
| 66 | }
|
| 67 |
|