| 9 | import net.minecraft.util.IChatComponent; |
| 10 | |
| 11 | public class InventoryBasic implements IInventory |
| 12 | { |
| 13 | private String inventoryTitle; |
| 14 | private int slotsCount; |
| 15 | private ItemStack[] inventoryContents; |
| 16 | private List<IInvBasic> field_70480_d; |
| 17 | private boolean hasCustomName; |
| 18 | |
| 19 | public InventoryBasic(String title, boolean customName, int slotCount) |
| 20 | { |
| 21 | this.inventoryTitle = title; |
| 22 | this.hasCustomName = customName; |
| 23 | this.slotsCount = slotCount; |
| 24 | this.inventoryContents = new ItemStack[slotCount]; |
| 25 | } |
| 26 | |
| 27 | public InventoryBasic(IChatComponent title, int slotCount) |
| 28 | { |
| 29 | this(title.getUnformattedText(), true, slotCount); |
| 30 | } |
| 31 | |
| 32 | public void func_110134_a(IInvBasic p_110134_1_) |
| 33 | { |
| 34 | if (this.field_70480_d == null) |
| 35 | { |
| 36 | this.field_70480_d = Lists.<IInvBasic>newArrayList(); |
| 37 | } |
| 38 | |
| 39 | this.field_70480_d.add(p_110134_1_); |
| 40 | } |
| 41 | |
| 42 | public void func_110132_b(IInvBasic p_110132_1_) |
| 43 | { |
| 44 | this.field_70480_d.remove(p_110132_1_); |
| 45 | } |
| 46 | |
| 47 | /** |
| 48 | * Returns the stack in the given slot. |
| 49 | * |
| 50 | * @param index The slot to retrieve from. |
| 51 | */ |
| 52 | public ItemStack getStackInSlot(int index) |
| 53 | { |
| 54 | return index >= 0 && index < this.inventoryContents.length ? this.inventoryContents[index] : null; |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * Removes up to a specified number of items from an inventory slot and returns them in a new stack. |
| 59 | * |
| 60 | * @param index The slot to remove from. |
| 61 | * @param count The maximum amount of items to remove. |
| 62 | */ |
| 63 | public ItemStack decrStackSize(int index, int count) |
| 64 | { |
| 65 | if (this.inventoryContents[index] != null) |
| 66 | { |
| 67 | if (this.inventoryContents[index].stackSize <= count) |
| 68 | { |
nothing calls this directly
no outgoing calls
no test coverage detected