PartPose .java

net.minecraft.client.model.geom.PartPose (record): members: xRot, yRot, zRot, xScale, yScale, zScale, offsetAndRotation, translated, withScale, scaled.

net.minecraft.client.model.geomrecord42 linesclient1.6 KB

API Surface (8)

record PartPose(float x, float y, float z, float xRot, float yRot, float zRot, float xScale, float yScale, float zScale)
PartPose offset(final float x, final float y, final float z)
PartPose rotation(final float x, final float y, final float z)
PartPose offsetAndRotation(final float offsetX, final float offsetY, final float offsetZ, final float rotationX, final float rotationY, final float rotationZ)
PartPose translated(final float x, final float y, final float z)
PartPose withScale(final float scale)
PartPose scaled(final float factor)
PartPose scaled(final float scaleX, final float scaleY, final float scaleZ)

Fields & Constants (2)

ZERO
rotationY

Full Source

PartPose.java42 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.client.model.geom;
2
3
import net.fabricmc.api.EnvType;
4
import net.fabricmc.api.Environment;
5
6
@Environment(EnvType.CLIENT)
7
public record PartPose(float x, float y, float z, float xRot, float yRot, float zRot, float xScale, float yScale, float zScale) {
8
	public static final PartPose ZERO = offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
9
10
	public static PartPose offset(final float x, final float y, final float z) {
11
		return offsetAndRotation(x, y, z, 0.0F, 0.0F, 0.0F);
12
	}
13
14
	public static PartPose rotation(final float x, final float y, final float z) {
15
		return offsetAndRotation(0.0F, 0.0F, 0.0F, x, y, z);
16
	}
17
18
	public static PartPose offsetAndRotation(
19
		final float offsetX, final float offsetY, final float offsetZ, final float rotationX, final float rotationY, final float rotationZ
20
	) {
21
		return new PartPose(offsetX, offsetY, offsetZ, rotationX, rotationY, rotationZ, 1.0F, 1.0F, 1.0F);
22
	}
23
24
	public PartPose translated(final float x, final float y, final float z) {
25
		return new PartPose(this.x + x, this.y + y, this.z + z, this.xRot, this.yRot, this.zRot, this.xScale, this.yScale, this.zScale);
26
	}
27
28
	public PartPose withScale(final float scale) {
29
		return new PartPose(this.x, this.y, this.z, this.xRot, this.yRot, this.zRot, scale, scale, scale);
30
	}
31
32
	public PartPose scaled(final float factor) {
33
		return factor == 1.0F ? this : this.scaled(factor, factor, factor);
34
	}
35
36
	public PartPose scaled(final float scaleX, final float scaleY, final float scaleZ) {
37
		return new PartPose(
38
			this.x * scaleX, this.y * scaleY, this.z * scaleZ, this.xRot, this.yRot, this.zRot, this.xScale * scaleX, this.yScale * scaleY, this.zScale * scaleZ
39
		);
40
	}
41
}
42

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