mirror of
https://github.com/Ellpeck/PrettyPipes.git
synced 2024-11-29 14:28:33 +01:00
fixed crafting items that don't fit being ignored
This commit is contained in:
parent
4340b2ccb4
commit
362a601e0a
1 changed files with 11 additions and 10 deletions
|
@ -82,11 +82,13 @@ 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
|
||||||
|
ItemStack remain = request.stack.copy();
|
||||||
|
remain.shrink(dest.getRight().getCount() - requestRemain.getCount());
|
||||||
if (!remain.isEmpty()) {
|
if (!remain.isEmpty()) {
|
||||||
NetworkLock remainRequest = new NetworkLock(request.location, remain);
|
NetworkLock remainRequest = new NetworkLock(request.location, remain);
|
||||||
tile.craftIngredientRequests.add(remainRequest);
|
tile.craftIngredientRequests.add(remainRequest);
|
||||||
|
@ -94,7 +96,6 @@ public class CraftingModuleItem extends ModuleItem {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
// pull requested crafting results from the network once they are stored
|
// pull requested crafting results from the network once they are stored
|
||||||
if (!tile.craftResultRequests.isEmpty()) {
|
if (!tile.craftResultRequests.isEmpty()) {
|
||||||
List<NetworkLocation> items = network.getOrderedNetworkItems(tile.getPos());
|
List<NetworkLocation> items = network.getOrderedNetworkItems(tile.getPos());
|
||||||
|
|
Loading…
Reference in a new issue