-
Notifications
You must be signed in to change notification settings - Fork 212
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
Clone and simulate moving items and fluids to a peripheral #1839
Comments
Could you expand on in which situations you could be not 100% sure it will be moved or not? If you know exactly what state target and source inventories/tanks are you should be able to predict if that move call will succeed fully, partially or not at all. |
How does this virtual peripheral know how the real one would behave to thus simulate that behaviour? I think that a better way would be to calculate the free space remaining in the real peripheral before the push/pull. Or maybe, if this is possible on the Java side, the push/pull methods should have a flag to abort the transfer of fluids/items if the transfer would be partially complete. |
Or argument to indicate minimal amount to transfer to counterpoint with |
This is mostly for use in GregTech machines. There are dozens of machines with different amounts of input slots so it would be a huge pain to say what the input slots are. You would have to consider partially full slots and items rolling over to the next slot. Being able to simulate what would happen would greatly simplify the problem.
This wouldn't be a great solution, if you need to move 5 types of items and the 3rd one fails, you would need to backtrack, take the first 2 out, then try another machine. |
Why not just take the free space in the slot and use that as the limit for the transfer? |
Do gregtech machines not show up as different peripheral types to CC? It makes no sense to me that you're trying to essentially brute-force find what machine a recipe should be for (at least, from the little explanation you've given, this is what it sounds like you're trying to do). You know the recipe, you know the machine, only push the recipe ingredients to the right machine? This is how systems like AE2's ME does it, you cannot just push a recipe to any machine without care, you must designate a machine for every recipe. |
I have already encoded recipes and the type of machine it uses, I just need some way of checking that all the ingredients for the recipe will be pushed into the machine. |
So can't you look in machine input and detect if they will fit or not? I am sorry if we seem repetitive but solution just seem to be to look at machine inputs state and calculate if they will fit, and i wonder if there is something about gregtech that stops you from doing that? |
Like I said, I could probably do that, but just being able to simulate what would happen would greatly simplify the problem |
Currently there is no good way of moving a set of items to a peripheral while being confident all items will be moved. For this I would need a way to test what will happen before doing it for real. This is especially necessary for when you can't take items and fluids back out of input slots.
I believe the easiest way for the user would be to have a
peripheral.virtual(name)
function that clones the peripheral (including its inventory and tanks), then have some way of pushing fake items and fluids into it.The text was updated successfully, but these errors were encountered: