Merge pull request #1016 from yueh/fix-1015

Fixes #1015 no longer eat a single item when not able to satisfy the recipe
This commit is contained in:
yueh 2015-03-13 23:49:12 +01:00
commit ece09a956b

View file

@ -18,6 +18,7 @@
package appeng.core.sync.packets;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
@ -56,6 +57,7 @@ import appeng.util.Platform;
import appeng.util.item.AEItemStack;
import appeng.util.prioitylist.IPartitionList;
public class PacketNEIRecipe extends AppEngPacket
{
@ -191,18 +193,22 @@ public class PacketNEIRecipe extends AppEngPacket
}
// If that doesn't work, grab from the player's inventory
if ( whichItem == null && playerInventory != null ) {
if ( whichItem == null && playerInventory != null )
{
ItemStack playerItemStack = null;
for ( int y = 0; y < playerInventory.getSizeInventory(); y++ )
{
// Put the item in the test inventory, and check if the recipe is satisfied
testInv.setInventorySlotContents(x, playerInventory.getStackInSlot(y));
if ( r.matches(testInv, pmp.worldObj) )
// check if the item in slot y matches the required item.
playerItemStack = playerInventory.getStackInSlot( y );
if ( playerItemStack != null && playerItemStack.getItem() == this.recipe[x][y].getItem() )
{
if ( realForFake == Actionable.SIMULATE )
{
// Take the item out.
if ( realForFake == Actionable.SIMULATE ) {
whichItem = playerInventory.getStackInSlot( y ).copy();
whichItem.stackSize = 1;
} else {
}
else
{
whichItem = playerInventory.decrStackSize( y, 1 );
}
break;