Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Quern now properly stacks output (Close #498).
  • Loading branch information
DisasterMoo committed Nov 12, 2019
1 parent a8f3dc1 commit 5a76e63
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/main/java/net/dries007/tfc/objects/te/TEQuern.java
Expand Up @@ -180,18 +180,16 @@ private void grindItem()
if (recipe != null && !world.isRemote)
{
inputStack.shrink(1);
ItemStack currentStack = inventory.getStackInSlot(SLOT_OUTPUT);
ItemStack outputStack = recipe.getOutputItem(inputStack);
if (currentStack.isEmpty())
ItemStack remainder = inventory.insertItem(SLOT_OUTPUT, recipe.getOutputItem(inputStack), false);
if (!remainder.isEmpty())
{
inventory.setStackInSlot(SLOT_OUTPUT, outputStack);
}
else
{
ItemStack leftover = CapabilityFood.mergeStack(outputStack, currentStack);
// Failed inserting/merging output directly
ItemStack currentStack = inventory.getStackInSlot(SLOT_OUTPUT);
ItemStack leftover = CapabilityFood.mergeStack(remainder, currentStack);
inventory.setStackInSlot(SLOT_OUTPUT, currentStack);
if (!leftover.isEmpty())
{
// Still having leftover items, dumping in world
InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY() + 1, pos.getZ(), leftover);
}
}
Expand Down

0 comments on commit 5a76e63

Please sign in to comment.