-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLODModelPart.java
More file actions
72 lines (58 loc) · 2.52 KB
/
LODModelPart.java
File metadata and controls
72 lines (58 loc) · 2.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
package cn.tohsaka.factory.rotationcraft.client.utils;
import com.mojang.math.Vector3f;
import net.minecraft.client.model.geom.PartPose;
import net.minecraft.client.model.geom.builders.CubeListBuilder;
import net.minecraft.client.model.geom.builders.PartDefinition;
public class LODModelPart {
private CubeListBuilder builder;
public static LODModelPart create(int texX,int texY){
return new LODModelPart(texX,texY);
}
public LODModelPart(int texX,int texY){
builder = CubeListBuilder.create().texOffs(texX,texY);
}
public static PartDefinition simpleCreate(String name,PartDefinition partDefinition,int texX,int texY,float x,float y,float z,float xx,float yy,float zz,float rx,float ry,float rz){
return new LODModelPart(texX,texY).addBox(x,y,z,xx,yy,zz).setRotationPofloat(rx,ry,rz).mirror().build(name,partDefinition);
}
public static PartDefinition simpleCreate(String name,PartDefinition partDefinition,int texX,int texY,float x,float y,float z,float xx,float yy,float zz,float rx,float ry,float rz,float rrx,float rry,float rrz){
return new LODModelPart(texX,texY).addBox(x,y,z,xx,yy,zz).setRotationPofloat(rx,ry,rz).setRotation(rrx,rry,rrz).mirror().build(name,partDefinition);
}
public LODModelPart addBox(float x,float y,float z,float xx,float yy,float zz){
builder.addBox(x,y,z,xx,yy,zz);
return this;
}
Vector3f rotationpofloat;
public LODModelPart setRotationPofloat(float x,float y,float z){
rotationpofloat = new Vector3f(x,y,z);
return this;
}
public LODModelPart mirror(boolean m){
builder.mirror(m);
return this;
}
public LODModelPart mirror(){
builder.mirror(true);
return this;
}
Vector3f rotation;
public LODModelPart setRotation(float x,float y,float z){
rotation = new Vector3f(x,y,z);
return this;
}
public PartDefinition build(String partName, PartDefinition partDefinition){
PartPose pose = null;
if(rotationpofloat!=null){
if(rotation!=null){
pose = PartPose.offsetAndRotation(rotationpofloat.x(),rotationpofloat.y(),rotationpofloat.z(),rotation.x(),rotation.y(),rotation.z());
}else{
pose = PartPose.offset(rotationpofloat.x(),rotationpofloat.y(),rotationpofloat.z());
}
}else {
pose = PartPose.ZERO;
}
return partDefinition.addOrReplaceChild(partName,
builder
, pose
);
}
}