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:
@@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
package appeng.core.sync.packets;
|
package appeng.core.sync.packets;
|
||||||
|
|
||||||
|
|
||||||
import java.io.ByteArrayInputStream;
|
import java.io.ByteArrayInputStream;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.DataOutputStream;
|
import java.io.DataOutputStream;
|
||||||
@@ -56,6 +57,7 @@ import appeng.util.Platform;
|
|||||||
import appeng.util.item.AEItemStack;
|
import appeng.util.item.AEItemStack;
|
||||||
import appeng.util.prioitylist.IPartitionList;
|
import appeng.util.prioitylist.IPartitionList;
|
||||||
|
|
||||||
|
|
||||||
public class PacketNEIRecipe extends AppEngPacket
|
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 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++ )
|
for ( int y = 0; y < playerInventory.getSizeInventory(); y++ )
|
||||||
{
|
{
|
||||||
// Put the item in the test inventory, and check if the recipe is satisfied
|
// check if the item in slot y matches the required item.
|
||||||
testInv.setInventorySlotContents(x, playerInventory.getStackInSlot(y));
|
playerItemStack = playerInventory.getStackInSlot( y );
|
||||||
if ( r.matches(testInv, pmp.worldObj) )
|
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 = playerInventory.getStackInSlot( y ).copy();
|
||||||
whichItem.stackSize = 1;
|
whichItem.stackSize = 1;
|
||||||
} else {
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
whichItem = playerInventory.decrStackSize( y, 1 );
|
whichItem = playerInventory.decrStackSize( y, 1 );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user