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

Dont provide ITEM_HANDLER for Inventory instances #88

Merged
merged 2 commits into from
Dec 29, 2023

Conversation

niklaswimmer
Copy link

@niklaswimmer niklaswimmer commented Dec 28, 2023

FFAPI's job is only to bridge implementation of the Fabric transfer API to the capability system, nothing more (at least I see it this way).

Fabric's own lookup API considers Inventory instances to be a valid Storage because otherwise it would have no compat with Vanilla inventories. Forge however chose a different path by explicitly providing capability providers for selected Vanilla blocks. As such it is Forge's responsibility to bridge Vanilla blocks to the capability system and not ours by accidentally making everything that implements Inventory provide an ITEM_HANDLER capability.

This change only affects Forge mods that try to access inventories of Fabric Mods. This will now only work if the Fabric Mod explicitly provides a Storage implementation or implements SidedStorageBlockEntity. I think this is fine, because really that is how Fabric mods should use the transfer API, right?

Fabric mods that access inventories via ItemStorage.SIDED will have the same semantics as before. I was thinking however, that we should maybe move the item handler capability to be the first fallback - in case Forge provides an item handler for a Vanilla block that implements Inventory. Thoughts @Su5eD?

Fixes #87

@niklaswimmer niklaswimmer force-pushed the no-caps-for-inventories branch from ef784cb to aa38007 Compare December 28, 2023 11:17
@Su5eD Su5eD self-assigned this Dec 28, 2023
@Su5eD Su5eD added the bug Something isn't working label Dec 28, 2023
@niklaswimmer niklaswimmer marked this pull request as draft December 28, 2023 11:25
FFAPI's job is only to bridge implementation of the Fabric transfer
API to the capability system, nothing more.

Fabric's own lookup API considers Inventory instances to be a valid
Storage because otherwise it would have no compat with Vanilla
inventories. Forge however chose a different path by explicitly
providing capability providers for selected Vanilla blocks. As such
it is Forge's responsibility to bridge Vanilla blocks to the
capability system and not ours by accidentally making everything that
implements Inventory provide an ITEM_HANDLER capability.

Fixes Sinytra#87

Signed-off-by: Niklas Wimmer <[email protected]>
@niklaswimmer niklaswimmer force-pushed the no-caps-for-inventories branch from aa38007 to d456073 Compare December 28, 2023 11:49
@niklaswimmer
Copy link
Author

Just realized it does not really matter for the composter, because it has no BE, so we will never have the chance for attaching a cap to it...

@niklaswimmer niklaswimmer marked this pull request as ready for review December 28, 2023 12:40
@Su5eD Su5eD merged commit b00938e into Sinytra:1.20.1 Dec 29, 2023
2 checks passed
RainbowTabitha added a commit to RainbowTabitha/ReForgifiedFabricAPI that referenced this pull request Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jukebox plays Music Disc again on the "off" end
2 participants