Skip to content

Conversation

@PepperCode1
Copy link
Member

@PepperCode1 PepperCode1 commented Aug 27, 2025

  • Additionally provide AO to material function
  • Optimize mesh count by not preserving quad order between blocks
  • Optimize mesh count by not splitting meshes when different inputs to the material function (except RenderType) produce the same material
  • Add missing Nullable annotations

TODO

  • Respect AO passed to new ModelUtil.getMaterial overload and add new LightShaders if necessary.
  • Optimize memory usage of BufferBuilders.
  • Consider caching results of BlockMaterialFunction in ModelBuilderResultConsumer as createKey will be called a lot of times.

public static final Material SOLID_BLOCK = SimpleMaterial.builder()
.build();
public static final Material SOLID_UNSHADED_BLOCK = SimpleMaterial.builder()
public static final Material SOLID_UNSHADED_BLOCK = SimpleMaterial.builderOf(SOLID_BLOCK)
Copy link
Member

Choose a reason for hiding this comment

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

Is adding new static final field in the middle binary compat safe?

Copy link
Member Author

Choose a reason for hiding this comment

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

How a static final field is computed should never impact binary compat. Right now, no new fields are added, but adding new fields should not affect binary compat either as they are referenced by name.

RenderType defaultLayer = ItemBlockRenderTypes.getChunkRenderType(state);
universalEmitter.prepare(defaultLayer);
model = universalEmitter.wrapModel(model);
boolean defaultAo = useAo && state.getLightEmission() == 0 && model.useAmbientOcclusion();
Copy link
Member

Choose a reason for hiding this comment

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

Is this logic copied from vanilla somewhere? Should we reference where so we can check for consistency later on?

return this;
}

public BlockModelBuilder materialFunc(@Nullable BlockMaterialFunction materialFunc) {
Copy link
Member

Choose a reason for hiding this comment

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

Binary compat?

PepperCode1 and others added 2 commits November 1, 2025 22:31
- Additionally provide AO to material function
- Optimize mesh count by not preserving quad order between blocks
- Optimize mesh count by not splitting meshes when different inputs to the material function (except RenderType) produce the same material
@Jozufozu Jozufozu force-pushed the 1.20.1/improve-model-builders branch from 7c2d5ab to 15cef3f Compare November 2, 2025 18:57
- Completely inline result consumer
- MeshEmitterManager now directly creates the SimpleModel
- Inline ArrayList and directly use parallel arrays in MeshEmitter
@PepperCode1 PepperCode1 marked this pull request as ready for review November 3, 2025 00:58
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.

3 participants