Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Round Robin with Priority voids items #2548

Open
ProTriforcer opened this issue Jul 21, 2024 · 4 comments
Open

Round Robin with Priority voids items #2548

ProTriforcer opened this issue Jul 21, 2024 · 4 comments

Comments

@ProTriforcer
Copy link
Contributor

ProTriforcer commented Jul 21, 2024

GregTech CEu Version

2.8.10-beta

Modpack Used

Nomi-CEu 1.7-beta-5c

Addons Installed

No response

Environment

Singleplayer

New Worlds

Yes

Cross-Mod Interaction

No

Expected Behavior

Expected conveyors set to Round Robin with Priority to not void items

Actual Behavior

Conveyors set to Round Robin with Priority voided items

Steps to Reproduce

  1. Place a chest and two macerators (or any other inventory with one free slot), connect them with an item pipe
  2. Place a conveyor to import from the chest, set it to Round Robin with Priority
    2024-07-22_02 13 43
  3. Place four stacks of cobblestone into the chest. Two of them will be moved into the macerators with two remaining, as expected
  4. Open a macerator and right click the cobblestone to take half of the stack. It will be immediately refilled, as expected
    2024-07-22_02 16 46
  5. Open the chest and observe a single stack of cobblestone, instead of expected one and a half
    2024-07-22_02 18 36
@ProTriforcer ProTriforcer added the status: unverified Issue is unverified label Jul 21, 2024
@ProTriforcer
Copy link
Contributor Author

It looks like you lose stack size/number of inventories items for every inventory you top up

@bruberu bruberu added status: verified and removed status: unverified Issue is unverified labels Jul 22, 2024
@ProTriforcer
Copy link
Contributor Author

So i renamed some variables and did some logging, but i'm way too tired to make sense of it all myself. I'll just post a slightly edited log output and the code that made it here. Hope it helps.

https://pastebin.com/3k56sMcm
https://pastebin.com/6ccush0A

@jkieberking
Copy link

jkieberking commented Aug 26, 2024

After some debugging, it appears that this block of code, that runs when attempting a dry run here of inserting items into the conveyor from the chest

stack = insertToHandlers(routePathsCopy, stack, simulate);
if (!stack.isEmpty() && !routePathsCopy.isEmpty())
    stack = insertToHandlers(routePathsCopy, stack, simulate);

From what I can tell via debugging, it appears that the first stack = insertToHandlers(routePathsCopy, stack, simulate); tries to split up the stack and insert it to all inventories along the connected network of pipes (but! it looks like it will only insert a max of size of stack / number of connected output inventories into each attached inventory), and the second insertToHandlers() call inserts any remaining items equally into any remaining non-full inventories attached to the network of pipes.

so, for ex: if we have a chest filled with a stack of 64 cobble with 4 macerators attached, each filled with 64 cobble, and we remove half a stack:

  • the first insertToHandlers() call will return with a stackSize of 48 (inserting 16 into the macerator)
  • the second call will return 16
  • the chest will have 16 cobble remaining

my hypothesis (don't have more time right now to further investigate) is that since we are doing a dry run, it still thinks the macerator has free space available (since we aren't actually inserting items into it during the dry run), so it will "insert" 32 cobble from the 48 remaining, which leaves 16 cobble in the chest

I'll investigate further and attempt a fix, but also wanted to update on my findings

@jkieberking
Copy link

my hypothesis (don't have more time right now to further investigate) is that since we are doing a dry run, it still thinks the macerator has free space available (since we aren't actually inserting items into it during the dry run), so it will "insert" 32 cobble from the 48 remaining, which leaves 16 cobble in the chest

confirmed this is the case

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants