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

Add API to allow conditional rendering of block entities #2316

Merged
merged 9 commits into from
Aug 29, 2024

Conversation

Jozufozu
Copy link
Contributor

@Jozufozu Jozufozu commented Feb 3, 2024

This PR aims to provide a way for other mods to fully take over rendering of specific block entities.

The solution here is to expose an API by which users associate a predicate with a block entity type.
If that predicate returns false for a given block entity, that block entity will not be added to a chunk's BuiltSectionInfo, and will therefore never be considered for rendering later on.

The predicate is stored directly in the given block entity type via a mixin'd interface.

Jozufozu and others added 4 commits February 3, 2024 13:42
- Extend BlockEntityType to store a predicate, always returning true by
  default.
- Evaluate the predicate in ChunkBuilderMeshingTask before fetching the
  BlockEntityRenderer.
- Expose a method to set the predicate for a given BlockEntityType in
  the API.
# Conflicts:
#	src/main/java/me/jellysquid/mods/sodium/client/render/chunk/compile/tasks/ChunkBuilderMeshingTask.java
#	src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/BlockEntityRenderHandlerImpl.java
#	src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/ExtendedBlockEntityType.java
#	src/main/java/net/caffeinemc/mods/sodium/mixin/core/render/BlockEntityTypeMixin.java
#	src/main/resources/sodium.mixins.json
@IMS212 IMS212 added this to the Sodium 0.6 milestone Aug 6, 2024
# Conflicts:
#	common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/BlockEntityRenderHandlerImpl.java
#	common/src/main/java/net/caffeinemc/mods/sodium/client/render/chunk/ExtendedBlockEntityType.java
#	common/src/main/java/net/caffeinemc/mods/sodium/mixin/core/render/BlockEntityTypeMixin.java
#	common/src/main/resources/sodium.mixins.json
@IMS212 IMS212 merged commit e7643f4 into CaffeineMC:dev Aug 29, 2024
1 check passed
IThundxr pushed a commit to IThundxr/sodium-fabric that referenced this pull request Sep 2, 2024
…2316)

* Add API to allow conditional rendering of block entities

- Extend BlockEntityType to store a predicate, always returning true by
  default.
- Evaluate the predicate in ChunkBuilderMeshingTask before fetching the
  BlockEntityRenderer.
- Expose a method to set the predicate for a given BlockEntityType in
  the API.

* Update to latest dev

* Fix build

* Merge files

* Make the predicate an array

* Use custom predicate class

---------

Co-authored-by: IMS212 <ims@irisshaders.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants