Пример #1
0
  @Override
  public void setInventorySlotContents(int slotId, ItemStack itemstack) {
    if (slotId >= _contents.length) {
      return;
    }
    _contents[slotId] = itemstack;

    if (itemstack != null && itemstack.stackSize > this.getInventoryStackLimit()) {
      itemstack.stackSize = this.getInventoryStackLimit();
    }
    markDirty();
  }
Пример #2
0
 @Override
 public ItemStack decrStackSize(int slotId, int count) {
   if (slotId < _contents.length && _contents[slotId] != null) {
     if (_contents[slotId].stackSize > count) {
       ItemStack result = _contents[slotId].splitStack(count);
       markDirty();
       return result;
     }
     ItemStack stack = _contents[slotId];
     setInventorySlotContents(slotId, null);
     return stack;
   }
   return null;
 }