CubeDefinition .java

net.minecraft.client.model.geom.builders.CubeDefinition (class): members: visibleFaces, yTexScale, texCoord, texScale, comment, xTexScale, xTexOffs, grow.

net.minecraft.client.model.geom.buildersclass69 linesclient1.8 KB

API Surface (1)

ModelPart.Cube bake(final int texScaleX, final int texScaleY)

Fields & Constants (18)

comment
origin
dimensions
grow
mirror
texCoord
texScale
visibleFaces
xTexOffs
yTexOffs
minX
minY
minZ
width
height
depth
xTexScale
yTexScale

Code Graph: Dependencies (4)

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

Full Source

CubeDefinition.java69 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.model.geom.builders;
2
3
import java.util.Set;
4
import net.fabricmc.api.EnvType;
5
import net.fabricmc.api.Environment;
6
import net.minecraft.client.model.geom.ModelPart;
7
import net.minecraft.core.Direction;
8
import org.joml.Vector3f;
9
import org.joml.Vector3fc;
10
import org.jspecify.annotations.Nullable;
11
12
@Environment(EnvType.CLIENT)
13
public final class CubeDefinition {
14
	private final @Nullable String comment;
15
	private final Vector3fc origin;
16
	private final Vector3fc dimensions;
17
	private final CubeDeformation grow;
18
	private final boolean mirror;
19
	private final UVPair texCoord;
20
	private final UVPair texScale;
21
	private final Set<Direction> visibleFaces;
22
23
	public CubeDefinition(
24
		final @Nullable String comment,
25
		final float xTexOffs,
26
		final float yTexOffs,
27
		final float minX,
28
		final float minY,
29
		final float minZ,
30
		final float width,
31
		final float height,
32
		final float depth,
33
		final CubeDeformation grow,
34
		final boolean mirror,
35
		final float xTexScale,
36
		final float yTexScale,
37
		final Set<Direction> visibleFaces
38
	) {
39
		this.comment = comment;
40
		this.texCoord = new UVPair(xTexOffs, yTexOffs);
41
		this.origin = new Vector3f(minX, minY, minZ);
42
		this.dimensions = new Vector3f(width, height, depth);
43
		this.grow = grow;
44
		this.mirror = mirror;
45
		this.texScale = new UVPair(xTexScale, yTexScale);
46
		this.visibleFaces = visibleFaces;
47
	}
48
49
	public ModelPart.Cube bake(final int texScaleX, final int texScaleY) {
50
		return new ModelPart.Cube(
51
			(int)this.texCoord.u(),
52
			(int)this.texCoord.v(),
53
			this.origin.x(),
54
			this.origin.y(),
55
			this.origin.z(),
56
			this.dimensions.x(),
57
			this.dimensions.y(),
58
			this.dimensions.z(),
59
			this.grow.growX,
60
			this.grow.growY,
61
			this.grow.growZ,
62
			this.mirror,
63
			texScaleX * this.texScale.u(),
64
			texScaleY * this.texScale.v(),
65
			this.visibleFaces
66
		);
67
	}
68
}
69

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