-
Notifications
You must be signed in to change notification settings - Fork 413
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
Render Data API v2 #3140
Render Data API v2 #3140
Conversation
...ata-v2/src/client/java/net/fabricmc/fabric/impl/renderdata/client/RenderDataMapConsumer.java
Outdated
Show resolved
Hide resolved
...client/java/net/fabricmc/fabric/mixin/renderdata/client/ChunkRendererRegionBuilderMixin.java
Outdated
Show resolved
Hide resolved
...client/java/net/fabricmc/fabric/mixin/renderdata/client/ChunkRendererRegionBuilderMixin.java
Outdated
Show resolved
Hide resolved
...client/java/net/fabricmc/fabric/mixin/renderdata/client/ChunkRendererRegionBuilderMixin.java
Outdated
Show resolved
Hide resolved
...ender-data-v2/src/main/java/net/fabricmc/fabric/api/renderdata/v2/RenderDataBlockEntity.java
Outdated
Show resolved
Hide resolved
...ender-data-v2/src/main/java/net/fabricmc/fabric/api/renderdata/v2/RenderDataBlockEntity.java
Outdated
Show resolved
Hide resolved
...-render-data-v2/src/main/java/net/fabricmc/fabric/api/renderdata/v2/RenderDataBlockView.java
Outdated
Show resolved
Hide resolved
fabric-render-data-v2/src/main/resources/fabric-render-data-v2.mixins.json
Outdated
Show resolved
Hide resolved
- Fix mixins of v1 - Use `fabric_` instead of `fabric$`; remove prefix completely in some cases - Improve javadoc - Remove dependencies on `fabric-api-base` - Bump `fabricloader` dependency of v2 - Attempt to fix checkstyle
- Clarify required checks after calling `RenderDataBlockView#getBlockEntityRenderData`
...r-data-api-v2/src/main/java/net/fabricmc/fabric/api/renderdata/v2/RenderDataBlockEntity.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All good now. It would be great to test backwards compatibility in prod, just in case.
Might be a nice idea to edit the PR description to include a short rundown of what is diffrent with this new API as its not that obvious, and possibly a migration guide. I usually copy these into the commit when suqishing+merging. |
Yes this would be nice. We could then reference the PR in the update announcement. Something else we need at the ready for the announcement is the gradle invocation to include the old API back in dev: "The old v0 rendering data attachment module is deprecated, and therefore not in the default dev jar anymore. Here is how to add it back if you don't want to update immediately: " |
Superseded by #3268. |
This pull requests adds the Render Data v2 module, which directly supersedes the existing Rendering Data Attachment v1 module.
The original goal was to interface inject the two interfaces provided by Rendering Data Attachment v1,
RenderAttachmentBlockEntity
andRenderAttachedBlockView
, to allow for an easier to use API. It proved to be impossible to achieve this and still provide a clean API without making a new module, as explained below.The documentation of
RenderAttachedBlockView
states that it is guaranteed to be implemented on all instances ofBlockRenderView
, but this is not the case. The module implementation only guarantees that allWorldView
instances implement the interface.RenderAttachedBlockView
extendsBlockRenderView
, meaning that trying to change the mixin to satisfy the stated contract is not possible; thus, it can be deduced that the mixin is correct but the stated contract is not, though such a contract does not lead to an easy to use API. Such an API design also makes interface injection ofRenderAttachedBlockView
impossible.To allow for the currently stated contract to be satisfied and to allow for interface injection to happen, a new module was made. It uses the same design as the existing module, with two interfaces that each have one method. Of course, the replacement for
RenderAttachedBlockView
no longer extendsBlockRenderView
. Some terminology and class member names were changed when creating the new module. The object that used to be termed "Render Data Attachment" or "Render Attachment" has been renamed to "Block Entity Render Data" or simply "Render Data". All methods, documentation, and other mentions of the old terms, apart from within the existing module, have been changed to use the new terms. Additionally, the documentation was rewritten to be more concise, provide more examples, remove mentions of implementation details, and add concrete requirements for use of certain methods.The existing module has been completely deprecated and its documentation has been updated to state the contract that is actually satisfied and link to the v2 replacements. It was not possible to achieve perfect backward and forward compatibility since this would result in infinite recursion at first thought and degraded performance with an actual implementation. To compromise, it was observed that the
BlockRenderView
extension interface is invoked much more frequently than it is implemented, and that theBlockEntity
extension interface is implemented much more frequently than it is invoked. As such, it was decided that the v1BlockRenderView
extension interface should proxy to v2 and the v2BlockEntity
extension interface should proxy to v1.