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

FluidStorage support #92

Open
SirEdvin opened this issue Apr 28, 2022 · 6 comments
Open

FluidStorage support #92

SirEdvin opened this issue Apr 28, 2022 · 6 comments
Labels
enhancement New feature or request

Comments

@SirEdvin
Copy link
Contributor

So, Fabric released FluidStorage logic and I want to try to implement it in cc-restitched.

But seems this required total refactoring of generic peripheral logic, because currently, as I understand, it just checks if this tile can be converted to specific interface.

So, do you have any plans for it?

@SirEdvin SirEdvin added the enhancement New feature or request label Apr 28, 2022
@toad-dev
Copy link
Member

We've had some discussion about adding support for the Fabric Transfer API with respect to item transport. Unfortunately, the way the Fabric API is set up makes it impossible to port the current generic inventory peripheral api over to using that system. One solution to this problem is to make a new generic peripheral api specifically for the Fabric Transfer API (we'll keep the old inventory api around too for backward- and cross-compatibility). If we go this route it would be natural to include support for fluids as well!

One awkward aspect of this, as you noted, is that the Fabric Storage interface is unbounded: Storage<T> rather than Storage<T extends SomeInterfaceRepresentingAResource>. Since the generic system works with reflection at runtime, my understanding is that there's no way for us to figure out what T is for a given implementation of Storage on a block, and we obviously can't build an api around Object :(

If anyone knows a good solution, let me know.

@toad-dev
Copy link
Member

Never mind I was misunderstanding how type erasure is implemented! This is possible with reflection, but the generic peripheral system currently explicitly disallows targeting parameterized types. I guess we would need to change that.

@SirEdvin
Copy link
Contributor Author

Sometimes I hates cc api, especially in this part. I am not defenetly not sure how to do this, because generic api always was a mystery for me(

@Technici4n
Copy link

You should query instances via FluidStorage.SIDED.find(...) (similar to capabilities on forge) for the fluid API. This will always give a Storage<FluidVariant>.

@SirEdvin
Copy link
Contributor Author

SirEdvin commented May 5, 2022

Well, I know how to do this :)

I am hate generic API design, because it focused on some AST magic and I am don't want to touch it :( I will just implement separate mod for this, if no one will fix this issue before I get to this mod

@Merith-TK
Copy link
Collaborator

if you know how, do not be afraid to PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants