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

Formalize most public API #253

Merged
merged 4 commits into from
Jul 26, 2024
Merged

Conversation

PepperCode1
Copy link
Member

@PepperCode1 PepperCode1 commented Jul 20, 2024

This pull request performs many, mostly minor, changes across most public API to make it nicer to use and more stable in general.

Copy link
Member

@Jozufozu Jozufozu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lots of good stuff in here, just a few things that caught my eye

Comment on lines +37 to +46
if (level == null) {
if (state == null) {
state = Blocks.AIR.defaultBlockState();
}
FabricOriginBlockAndTintGetter originLevel = objects.level;
originLevel.originBlockState(state);
level = originLevel;
} else if (state == null) {
state = level.getBlockState(BlockPos.ZERO);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like complex behavior to hide in the impl. Somewhat related, perhaps there should be explicit methods for defaultLevel and defaultBlockState in the common builder

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All builder methods for all three types of builders are optional and thus have default values. Would it be better to add default*() methods for all properties or accept nullable parameters, where null means default?

- Add Engine#onLightUpdate; remove LightUpdateHolder and backend/ClientChunkCacheMixin
- Add Effect#level
- Add VisualizationHelper#queueAdd and #queueRemove for Effects
- Fix PartialModel not assigning bakedModel field when populating on init
- Fix PartialModel.ALL using weak keys instead of weak values
- Make Simple*Visualizer and corresponding inner Builder classes final
- Restore FlatLit#light overload that accepts block and sky light values separately
- Add AbstractBlockEntityVisual#relight overloads that accept Iterator and Iterable
- Reorganize classes in impl.vizualization
- Move TaskExecutor#sync* methods to TaskExecutorImpl
- Move Flag and RaisePlan to impl
- Remove TaskExecutor#scheduleForMainThread and #isMainThread methods
- Remove SyncedPlan
- Add Engine#setupRender
- Remove TaskExecutor parameters from Engine#render* methods
- Convert Engine$CrumblingBlock into an interface
- Unmark RenderContext as NonExtendable to allow fulfilling the purpose described in the doc of VisualizationManager#renderDispatcher
Copy link
Member

@Jozufozu Jozufozu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice changes ❤️

- Lazily initialize MaterialShaderIndices
- Rename MaterialShaders#*Shader to #*Source
- Move BackendImplemented to api.backend package
@PepperCode1 PepperCode1 marked this pull request as ready for review July 26, 2024 20:17
@PepperCode1
Copy link
Member Author

PepperCode1 commented Jul 26, 2024

I will merge the PR now as there are a lot of changes and waiting for more minor changes is not worth the merge conflicts with other mainline changes that this will cause.
Things to review later:

  • Complex level and state behavior in model builders
  • Default methods for model builders
  • Adding or removing data from RenderContext; passing a reduced RenderContext to Engine#updateRenderOrigin with more than just the Camera
  • More registry refactors, including renames, removing registerAndGet, splitting MaterialShaders, making shader source locations easier to register, and refactoring and freezing VisualizerRegistry

@PepperCode1 PepperCode1 merged commit eb2ba12 into 1.20/dev Jul 26, 2024
2 checks passed
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.

2 participants