Skip to content

Commit ddc5500

Browse files
committed
todo for CraftingModuleItem store
1 parent af86cde commit ddc5500

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/main/java/de/ellpeck/prettypipes/pipe/modules/craft/CraftingModuleItem.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ public Pair<ItemStack, Collection<ActiveCraft>> craft(ItemStack module, PipeBloc
207207
var items = network.getOrderedNetworkItems(tile.getBlockPos());
208208
var slot = tile.getModuleSlot(module);
209209
var contents = module.get(Contents.TYPE);
210-
210+
211211
var equalityTypes = ItemFilter.getEqualityTypes(tile);
212212
var resultAmount = this.getResultAmountPerCraft(module, stack, equalityTypes);
213213
// calculate how many crafting *operations* to do (as opposed to how many *items* to craft)
@@ -264,6 +264,9 @@ public ItemStack store(ItemStack module, PipeBlockEntity tile, ItemStack stack,
264264
var equalityTypes = ItemFilter.getEqualityTypes(tile);
265265
var allCrafts = tile.getActiveCrafts();
266266
for (var craft : allCrafts.stream().filter(c -> c.moduleSlot == slot && !c.getTravelingIngredient(stack, equalityTypes).isEmpty()).toList()) {
267+
// TODO currently, we always shrink by the size of stack, even if the container can't actually accept the entire stack
268+
// some containers' getAvailableDestination method returns an incorrect value (because it's a heuristic), so parts of this stack might be sent back,
269+
// in which case we have to add it back to the collection of items we need to request (as an item stack since we won't have the lock anymore)
267270
var traveling = craft.getTravelingIngredient(stack, equalityTypes);
268271
traveling.shrink(stack.getCount());
269272
if (traveling.isEmpty())

0 commit comments

Comments
 (0)