Open SirEdvin opened 2 years ago
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.
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.
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(
You should query instances via FluidStorage.SIDED.find(...) (similar to capabilities on forge) for the fluid API. This will always give a Storage<FluidVariant>
.
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
if you know how, do not be afraid to PR
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?