Skip to content
This repository has been archived by the owner on Feb 9, 2018. It is now read-only.

Commit

Permalink
Fixed stack splitting.
Browse files Browse the repository at this point in the history
  • Loading branch information
simeonradivoev committed Apr 6, 2015
1 parent f3f1caf commit 74302fc
Showing 1 changed file with 15 additions and 9 deletions.
24 changes: 15 additions & 9 deletions src/main/java/com/MO/MatterOverdrive/data/Inventory.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,29 +107,35 @@ public ItemStack getStackInSlot(int slot)
@Override
public ItemStack decrStackSize(int slot, int size)
{
if(this.slots.get(slot) != null)
if (this.slots.get(slot) != null && this.slots.get(slot).getItem() != null)
{
ItemStack itemstack;

if(this.slots.get(slot).getItem().stackSize <= size)
if (this.slots.get(slot).getItem().stackSize <= size)
{
itemstack = this.slots.get(slot).getItem();
this.slots.get(slot).setItem(null);

entity.updateContainingBlockInfo();
return itemstack;
}else
}
else
{
this.slots.get(slot).getItem().splitStack(size);
itemstack = this.slots.get(slot).getItem().splitStack(size);

if(this.slots.get(slot).getItem().stackSize == 0)
if (this.slots.get(slot).getItem().stackSize == 0)
{
this.slots.get(slot).setItem(null);
}

entity.updateContainingBlockInfo();
return itemstack;
}
}

entity.updateContainingBlockInfo();

return null;
else
{
return null;
}
}

@Override
Expand Down

0 comments on commit 74302fc

Please sign in to comment.