fixed crafting items that don't fit being ignored

This commit is contained in:
Ell 2020-10-15 05:00:43 +02:00
parent 4340b2ccb4
commit 362a601e0a

View file

@ -82,16 +82,17 @@ public class CraftingModuleItem extends ModuleItem {
NetworkLock request = tile.craftIngredientRequests.peek(); NetworkLock request = tile.craftIngredientRequests.peek();
Pair<BlockPos, ItemStack> dest = tile.getAvailableDestination(request.stack, true, true); Pair<BlockPos, ItemStack> dest = tile.getAvailableDestination(request.stack, true, true);
if (dest != null) { if (dest != null) {
ItemStack remain = network.requestExistingItem(request.location, tile.getPos(), dest.getLeft(), request, dest.getRight(), ItemEqualityType.NBT); ItemStack requestRemain = network.requestExistingItem(request.location, tile.getPos(), dest.getLeft(), request, dest.getRight(), ItemEqualityType.NBT);
if (remain.getCount() != request.stack.getCount()) { network.resolveNetworkLock(request);
network.resolveNetworkLock(request); tile.craftIngredientRequests.remove();
tile.craftIngredientRequests.remove();
// if we couldn't fit all items into the destination, create another request for the rest // if we couldn't fit all items into the destination, create another request for the rest
if (!remain.isEmpty()) { ItemStack remain = request.stack.copy();
NetworkLock remainRequest = new NetworkLock(request.location, remain); remain.shrink(dest.getRight().getCount() - requestRemain.getCount());
tile.craftIngredientRequests.add(remainRequest); if (!remain.isEmpty()) {
network.createNetworkLock(remainRequest); NetworkLock remainRequest = new NetworkLock(request.location, remain);
} tile.craftIngredientRequests.add(remainRequest);
network.createNetworkLock(remainRequest);
} }
} }
} }