Fixed bug where Grid doesn't handle remainder sometimes, fixes #185
This commit is contained in:
		@@ -1,5 +1,10 @@
 | 
				
			|||||||
# Refined Storage Changelog
 | 
					# Refined Storage Changelog
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					### 0.8.9
 | 
				
			||||||
 | 
					**Bugfixes**
 | 
				
			||||||
 | 
					- Several models / texture tweaks
 | 
				
			||||||
 | 
					- Fixed bug where Grid doesn't handle remainder sometimes
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### 0.8.8
 | 
					### 0.8.8
 | 
				
			||||||
**Bugfixes**
 | 
					**Bugfixes**
 | 
				
			||||||
- Use ore dictionary for recipes with glass
 | 
					- Use ore dictionary for recipes with glass
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -25,7 +25,7 @@ public class SlotGridCraftingResult extends SlotCrafting {
 | 
				
			|||||||
        onCrafting(stack);
 | 
					        onCrafting(stack);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!player.worldObj.isRemote) {
 | 
					        if (!player.worldObj.isRemote) {
 | 
				
			||||||
            grid.onCrafted();
 | 
					            grid.onCrafted(player);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            container.sendCraftingSlots();
 | 
					            container.sendCraftingSlots();
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -126,15 +126,23 @@ public class TileGrid extends TileNode implements IGrid {
 | 
				
			|||||||
        result.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(matrix, worldObj));
 | 
					        result.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(matrix, worldObj));
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    public void onCrafted() {
 | 
					    public void onCrafted(EntityPlayer player) {
 | 
				
			||||||
        ItemStack[] remainder = CraftingManager.getInstance().getRemainingItems(matrix, worldObj);
 | 
					        ItemStack[] remainder = CraftingManager.getInstance().getRemainingItems(matrix, worldObj);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for (int i = 0; i < matrix.getSizeInventory(); ++i) {
 | 
					        for (int i = 0; i < matrix.getSizeInventory(); ++i) {
 | 
				
			||||||
            if (i < remainder.length && remainder[i] != null) {
 | 
					            ItemStack slot = matrix.getStackInSlot(i);
 | 
				
			||||||
                matrix.setInventorySlotContents(i, remainder[i].copy());
 | 
					 | 
				
			||||||
            } else {
 | 
					 | 
				
			||||||
                ItemStack slot = matrix.getStackInSlot(i);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					            if (i < remainder.length && remainder[i] != null) {
 | 
				
			||||||
 | 
					                if (slot != null && slot.stackSize > 1) {
 | 
				
			||||||
 | 
					                    if (!player.inventory.addItemStackToInventory(remainder[i].copy())) {
 | 
				
			||||||
 | 
					                        InventoryHelper.spawnItemStack(player.worldObj, player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ(), remainder[i].copy());
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                    matrix.decrStackSize(i, 1);
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    matrix.setInventorySlotContents(i, remainder[i].copy());
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            } else {
 | 
				
			||||||
                if (slot != null) {
 | 
					                if (slot != null) {
 | 
				
			||||||
                    if (slot.stackSize == 1 && isConnected()) {
 | 
					                    if (slot.stackSize == 1 && isConnected()) {
 | 
				
			||||||
                        matrix.setInventorySlotContents(i, RefinedStorageUtils.extractItem(network, slot, 1));
 | 
					                        matrix.setInventorySlotContents(i, RefinedStorageUtils.extractItem(network, slot, 1));
 | 
				
			||||||
@@ -154,7 +162,7 @@ public class TileGrid extends TileNode implements IGrid {
 | 
				
			|||||||
        ItemStack crafted = result.getStackInSlot(0);
 | 
					        ItemStack crafted = result.getStackInSlot(0);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        while (true) {
 | 
					        while (true) {
 | 
				
			||||||
            onCrafted();
 | 
					            onCrafted(player);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            craftedItemsList.add(crafted.copy());
 | 
					            craftedItemsList.add(crafted.copy());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user