CompositeBlockModel .java

net.minecraft.client.renderer.block.model.CompositeBlockModel (class): members: custom, normal, Unbaked, update. imports: BlockModelRenderState, Matrix4fc.

net.minecraft.client.renderer.block.modelclass36 linesclient1.4 KB

Implements

API Surface (2)

void update(final BlockModelRenderState output, final BlockState blockState, final BlockDisplayContext displayContext, final long seed)
BlockModel bake(final BlockModel.BakingContext context, final Matrix4fc transformation)

Fields & Constants (2)

normal
custom

Code Graph: Dependencies (5)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

CompositeBlockModel.java36 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.renderer.block.model;
2
3
import com.mojang.math.Transformation;
4
import java.util.Optional;
5
import net.fabricmc.api.EnvType;
6
import net.fabricmc.api.Environment;
7
import net.minecraft.client.renderer.block.BlockModelRenderState;
8
import net.minecraft.world.level.block.state.BlockState;
9
import org.joml.Matrix4fc;
10
11
@Environment(EnvType.CLIENT)
12
public class CompositeBlockModel implements BlockModel {
13
	private final BlockModel normal;
14
	private final BlockModel custom;
15
16
	public CompositeBlockModel(final BlockModel normal, final BlockModel custom) {
17
		this.normal = normal;
18
		this.custom = custom;
19
	}
20
21
	@Override
22
	public void update(final BlockModelRenderState output, final BlockState blockState, final BlockDisplayContext displayContext, final long seed) {
23
		this.normal.update(output, blockState, displayContext, seed);
24
		this.custom.update(output, blockState, displayContext, seed);
25
	}
26
27
	@Environment(EnvType.CLIENT)
28
	public record Unbaked(BlockModel.Unbaked normal, BlockModel.Unbaked custom, Optional<Transformation> transformation) implements BlockModel.Unbaked {
29
		@Override
30
		public BlockModel bake(final BlockModel.BakingContext context, final Matrix4fc transformation) {
31
			Matrix4fc childTransform = Transformation.compose(transformation, this.transformation);
32
			return new CompositeBlockModel(this.normal.bake(context, childTransform), this.custom.bake(context, childTransform));
33
		}
34
	}
35
}
36

Decompiled Minecraft 26.3 source of CompositeBlockModel (net/minecraft/client/renderer/block/model/CompositeBlockModel.java) with Mojang official mappings, stored verbatim on the site.