Let vanilla try to handle Container interactions before checking for item handlers #1787
+94
−185
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Move our
IItemHandler
interaction hooks after vanilla checks forContainer
interactions. This gives vanilla control over interactions withContainer
s. Fixes #1750. Fixes #1770. (Did not test the latter but I assume it gets fixed).As a side effect, this greatly simplifies our hooks since we don't need to handle vanilla edge cases such as hopper - hopper interactions having special interactions when it comes to cooldowns.
Breaking change
Modders need to be careful that their
Container
s will be interacted with asContainer
s before an item handler is even attempted to be found. I'd suggest not implementingContainer
directly on block entities to avoid this problem. Nevertheless, this counts as a breaking change.Lookup order
Currently,
Container
entities are preferred overIItemHandler
blocks. What do people think about that?Current order:
Container block > Container entity > IItemHandler block > IItemHandler entity
.I think that it would be preferable to check in this order:
Container block > IItemHandler block > Container entity > IItemHandler entity
.