-
-
Notifications
You must be signed in to change notification settings - Fork 42
Description
Slots that return ItemStack.EMPTY upon simulated extraction because they're a machine's input-only slots should return isDone() = true because there's nothing to extract, but since we're using getStackInSlot() in peekExtractPotential here, such slots report extract-able items and never become Done.
Since LimitedInputSlot doesn't actually keep a running total of all possible items that could be extracted, I think we can safely change this back to the commented-out type.extract(handler, slot, Long.MAX_VALUE, true) line just below. LimitedInputSlot clears extractSimulateCache to null upon the actual extract operation, so we only need peekExtractPotential predict how many items could be extracted from the next single extract instance.
peekExtractPotential is used:
- in
moveToto limit the number of items SFM tries to move between two slots, but if the inventory is reporting only a 64 in a simulated extract it should by all rights only allow us to extract 64 when it comes time to do the move anyway. - in
SFMASTUtils.getInputStatementForSlotand a couple other places used to generate example extracts from inventories for the various ways of inspecting that. I think we should refactor all these a little bit so that more of the logic lies insideSFMASTUtils, which we would have check bothgetStackInSlotand a simulatedextractdirectly using theResourceTypebefore deciding if it should return an INPUT or OUTPUT statement. If it has items but returns EMPTY upon simulated extract, SFM giving an example OUTPUT statement would be more helpful to the player than the current INPUT one.