37 lines
1.4 KiB
Java
37 lines
1.4 KiB
Java
package net.minecraft.client.model.geom;
|
|
|
|
import net.fabricmc.api.EnvType;
|
|
import net.fabricmc.api.Environment;
|
|
|
|
@Environment(EnvType.CLIENT)
|
|
public record PartPose(float x, float y, float z, float xRot, float yRot, float zRot, float xScale, float yScale, float zScale) {
|
|
public static final PartPose ZERO = offsetAndRotation(0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0F);
|
|
|
|
public static PartPose offset(float x, float y, float z) {
|
|
return offsetAndRotation(x, y, z, 0.0F, 0.0F, 0.0F);
|
|
}
|
|
|
|
public static PartPose rotation(float xRot, float yRot, float zRot) {
|
|
return offsetAndRotation(0.0F, 0.0F, 0.0F, xRot, yRot, zRot);
|
|
}
|
|
|
|
public static PartPose offsetAndRotation(float x, float y, float z, float xRot, float yRot, float zRot) {
|
|
return new PartPose(x, y, z, xRot, yRot, zRot, 1.0F, 1.0F, 1.0F);
|
|
}
|
|
|
|
public PartPose translated(float f, float g, float h) {
|
|
return new PartPose(this.x + f, this.y + g, this.z + h, this.xRot, this.yRot, this.zRot, this.xScale, this.yScale, this.zScale);
|
|
}
|
|
|
|
public PartPose withScale(float f) {
|
|
return new PartPose(this.x, this.y, this.z, this.xRot, this.yRot, this.zRot, f, f, f);
|
|
}
|
|
|
|
public PartPose scaled(float f) {
|
|
return f == 1.0F ? this : this.scaled(f, f, f);
|
|
}
|
|
|
|
public PartPose scaled(float f, float g, float h) {
|
|
return new PartPose(this.x * f, this.y * g, this.z * h, this.xRot, this.yRot, this.zRot, this.xScale * f, this.yScale * g, this.zScale * h);
|
|
}
|
|
}
|