@@ -19,23 +19,37 @@ public class MartingCarEntityModel<T extends MartingCarEntity> extends EntityMod
19
19
public static final ModelLayerLocation LAYER_GREEN = new ModelLayerLocation (ResourceLocation .fromNamespaceAndPath (PowerTool .MODID , "marting_car_blue" ), "main" );
20
20
21
21
private final ModelPart kart ;
22
- private final ModelPart steering_inner ; // Mut Y
23
- private final ModelPart front_wheels ; // Front wheels Mut X
24
- private final ModelPart wheel ; // Right-front Mut Y
25
- private final ModelPart wheel2 ; // Left-front Mut Y
26
- private final ModelPart rear_wheels ; // Back wheels Mut X
27
- private final ModelPart wheel3 ; // Left-back
28
- private final ModelPart wheel4 ; // Right-back
22
+ private final ModelPart seat ;
23
+ private final ModelPart steering ;
24
+ private final ModelPart inner ;
25
+ private final ModelPart main_frame ;
26
+ private final ModelPart right_arm ;
27
+ private final ModelPart left_arm ;
28
+ private final ModelPart front_wheels ;
29
+ private final ModelPart wheel ;
30
+ private final ModelPart wheel2 ;
31
+ private final ModelPart rear_wheels ;
32
+ private final ModelPart wheel3 ;
33
+ private final ModelPart wheel4 ;
34
+ private final ModelPart axis ;
35
+ private final ModelPart player ;
29
36
30
37
public MartingCarEntityModel (ModelPart root ) {
31
38
this .kart = root .getChild ("kart" );
32
- this .steering_inner = this .kart .getChild ("steering_outer" ).getChild ("steering_inner" );
39
+ this .seat = this .kart .getChild ("seat" );
40
+ this .steering = this .kart .getChild ("steering" );
41
+ this .inner = this .steering .getChild ("inner" );
42
+ this .main_frame = this .kart .getChild ("main_frame" );
43
+ this .right_arm = this .kart .getChild ("right_arm" );
44
+ this .left_arm = this .kart .getChild ("left_arm" );
33
45
this .front_wheels = this .kart .getChild ("front_wheels" );
34
46
this .wheel = this .front_wheels .getChild ("wheel" );
35
47
this .wheel2 = this .front_wheels .getChild ("wheel2" );
36
48
this .rear_wheels = this .kart .getChild ("rear_wheels" );
37
49
this .wheel3 = this .rear_wheels .getChild ("wheel3" );
38
50
this .wheel4 = this .rear_wheels .getChild ("wheel4" );
51
+ this .axis = this .kart .getChild ("axis" );
52
+ this .player = root .getChild ("player" );
39
53
}
40
54
41
55
public static LayerDefinition createBodyLayer () {
@@ -48,10 +62,9 @@ public static LayerDefinition createBodyLayer() {
48
62
49
63
PartDefinition cube_r1 = seat .addOrReplaceChild ("cube_r1" , CubeListBuilder .create ().texOffs (0 , 0 ).addBox (-5.0F , -11.0F , -2.0F , 10.0F , 11.0F , 2.0F , new CubeDeformation (0.0F )), PartPose .offsetAndRotation (0.0F , -3.0F , 7.0F , -0.2618F , 0.0F , 0.0F ));
50
64
51
- PartDefinition steering_outer = kart .addOrReplaceChild ("steering_outer " , CubeListBuilder .create (), PartPose .offsetAndRotation (0.0F , -11.9497F , -6.2218F , -0.7854F , 0.0F , 0.0F ));
65
+ PartDefinition steering = kart .addOrReplaceChild ("steering " , CubeListBuilder .create (). texOffs ( 0 , 22 ). addBox (- 2.0F , - 1.0F , - 1.0F , 4.0F , 2.0F , 2.0F , new CubeDeformation ( 0.0F ) ), PartPose .offsetAndRotation (0.0F , -11.9497F , -6.2218F , -0.7854F , 0.0F , 0.0F ));
52
66
53
- PartDefinition steering_inner = steering_outer .addOrReplaceChild ("steering_inner" , CubeListBuilder .create ().texOffs (37 , 7 ).addBox (-6.0F , 0.0F , -3.0F , 12.0F , 0.0F , 6.0F , new CubeDeformation (0.0F ))
54
- .texOffs (0 , 22 ).addBox (-2.0F , -1.0F , -1.0F , 4.0F , 2.0F , 2.0F , new CubeDeformation (0.0F )), PartPose .ZERO );
67
+ PartDefinition inner = steering .addOrReplaceChild ("inner" , CubeListBuilder .create ().texOffs (37 , 7 ).addBox (-6.0F , 0.0F , -3.0F , 12.0F , 0.0F , 6.0F , new CubeDeformation (0.0F )), PartPose .offset (0.0F , 0.0F , 0.0F ));
55
68
56
69
PartDefinition main_frame = kart .addOrReplaceChild ("main_frame" , CubeListBuilder .create ().texOffs (0 , 0 ).addBox (-3.5F , -0.2929F , -6.0F , 8.0F , 2.0F , 27.0F , new CubeDeformation (0.0F ))
57
70
.texOffs (29 , 33 ).addBox (-7.5F , -0.2929F , 8.0F , 16.0F , 1.0F , 5.0F , new CubeDeformation (0.0F ))
@@ -80,38 +93,55 @@ public static LayerDefinition createBodyLayer() {
80
93
81
94
PartDefinition cube_r9 = left_arm .addOrReplaceChild ("cube_r9" , CubeListBuilder .create ().texOffs (20 , 51 ).mirror ().addBox (-3.0F , -3.0F , 0.0F , 4.0F , 2.0F , 5.0F , new CubeDeformation (0.0F )).mirror (false ), PartPose .offsetAndRotation (0.0F , -0.2929F , 20.2929F , 0.7854F , 0.0F , 0.0F ));
82
95
83
- //TODO[xkball] 你这轮胎怎么还有缝啊
84
96
PartDefinition front_wheels = kart .addOrReplaceChild ("front_wheels" , CubeListBuilder .create (), PartPose .offset (0.0F , -2.5F , -8.0F ));
85
97
86
- PartDefinition cube_r10 = front_wheels .addOrReplaceChild ("cube_r10" , CubeListBuilder .create ().texOffs (0 , 29 ).addBox (-11.5F , -1.0F , -1.0F , 23.0F , 2.0F , 2.0F , new CubeDeformation (0.0F )), PartPose .offsetAndRotation (0.0F , 0.0F , 0.0F , -0.7854F , 0.0F , 0.0F ));
87
-
88
- PartDefinition wheel = front_wheels .addOrReplaceChild ("wheel" , CubeListBuilder .create ().texOffs (20 , 44 ).addBox (-2.0F , -1.0355F , -2.5F , 4.0F , 2.0711F , 5.0F , new CubeDeformation (0.0F ))
98
+ PartDefinition wheel = front_wheels .addOrReplaceChild ("wheel" , CubeListBuilder .create ().texOffs (0 , 67 ).addBox (-2.0F , -1.0355F , -2.5F , 4.0F , 2.0711F , 5.0F , new CubeDeformation (0.0F ))
89
99
.texOffs (0 , 60 ).addBox (-2.0F , -2.5F , -1.0355F , 4.0F , 5.0F , 2.0711F , new CubeDeformation (0.0F )), PartPose .offset (-9.0F , 0.0F , 0.0F ));
90
100
91
- PartDefinition octagon_r1 = wheel .addOrReplaceChild ("octagon_r1" , CubeListBuilder .create ().texOffs (61 , 13 ).addBox (-2.0F , -2.5F , -1.0355F , 4.0F , 5.0F , 2.0711F , new CubeDeformation (0.0F ))
92
- .texOffs (38 , 45 ).addBox (-2.0F , -1.0355F , -2.5F , 4.0F , 2.0711F , 5.0F , new CubeDeformation (0.0F )), PartPose .offsetAndRotation (0.0F , 0.0F , 0.0F , -0.7854F , 0.0F , 0.0F ));
101
+ PartDefinition octagon_r1 = wheel .addOrReplaceChild ("octagon_r1" , CubeListBuilder .create ().texOffs (0 , 60 ).addBox (-2.0F , -2.5F , -1.0355F , 4.0F , 5.0F , 2.0711F , new CubeDeformation (0.0F ))
102
+ .texOffs (0 , 67 ).addBox (-2.0F , -1.0355F , -2.5F , 4.0F , 2.0711F , 5.0F , new CubeDeformation (0.0F )), PartPose .offsetAndRotation (0.0F , 0.0F , 0.0F , -0.7854F , 0.0F , 0.0F ));
93
103
94
- PartDefinition wheel2 = front_wheels .addOrReplaceChild ("wheel2" , CubeListBuilder .create ().texOffs (20 , 44 ). mirror (). addBox (-2.0F , -1.0355F , -2.5F , 4.0F , 2.0711F , 5.0F , new CubeDeformation (0.0F )). mirror ( false )
95
- .texOffs (0 , 60 ).mirror (). addBox (-2.0F , -2.5F , -1.0355F , 4.0F , 5.0F , 2.0711F , new CubeDeformation (0.0F )). mirror ( false ), PartPose .offset (9.0F , 0.0F , 0.0F ));
104
+ PartDefinition wheel2 = front_wheels .addOrReplaceChild ("wheel2" , CubeListBuilder .create ().texOffs (0 , 67 ). addBox (-2.0F , -1.0355F , -2.5F , 4.0F , 2.0711F , 5.0F , new CubeDeformation (0.0F ))
105
+ .texOffs (0 , 60 ).addBox (-2.0F , -2.5F , -1.0355F , 4.0F , 5.0F , 2.0711F , new CubeDeformation (0.0F )), PartPose .offset (9.0F , 0.0F , 0.0F ));
96
106
97
- PartDefinition octagon_r2 = wheel2 .addOrReplaceChild ("octagon_r2" , CubeListBuilder .create ().texOffs (61 , 13 ). mirror (). addBox (-2.0F , -2.5F , -1.0355F , 4.0F , 5.0F , 2.0711F , new CubeDeformation (0.0F )). mirror ( false )
98
- .texOffs (38 , 45 ). mirror (). addBox (-2.0F , -1.0355F , -2.5F , 4.0F , 2.0711F , 5.0F , new CubeDeformation (0.0F )). mirror ( false ), PartPose .offsetAndRotation (0.0F , 0.0F , 0.0F , -0.7854F , 0.0F , 0.0F ));
107
+ PartDefinition octagon_r2 = wheel2 .addOrReplaceChild ("octagon_r2" , CubeListBuilder .create ().texOffs (0 , 60 ). addBox (-2.0F , -2.5F , -1.0355F , 4.0F , 5.0F , 2.0711F , new CubeDeformation (0.0F ))
108
+ .texOffs (0 , 67 ). addBox (-2.0F , -1.0355F , -2.5F , 4.0F , 2.0711F , 5.0F , new CubeDeformation (0.0F )), PartPose .offsetAndRotation (0.0F , 0.0F , 0.0F , -0.7854F , 0.0F , 0.0F ));
99
109
100
110
PartDefinition rear_wheels = kart .addOrReplaceChild ("rear_wheels" , CubeListBuilder .create (), PartPose .offset (0.0F , -2.5F , 9.0F ));
101
111
102
- PartDefinition cube_r11 = rear_wheels .addOrReplaceChild ("cube_r11" , CubeListBuilder .create ().texOffs (0 , 29 ).addBox (-11.5F , -1.0F , -1.0F , 23.0F , 2.0F , 2.0F , new CubeDeformation (0.0F )), PartPose .offsetAndRotation (0.0F , 0.0F , 0.0F , -0.7854F , 0.0F , 0.0F ));
103
-
104
- PartDefinition wheel3 = rear_wheels .addOrReplaceChild ("wheel3" , CubeListBuilder .create ().texOffs (20 , 44 ).mirror ().addBox (-2.0F , -1.0355F , -2.5F , 4.0F , 2.0711F , 5.0F , new CubeDeformation (0.0F )).mirror (false )
105
- .texOffs (0 , 60 ).mirror ().addBox (-2.0F , -2.5F , -1.0355F , 4.0F , 5.0F , 2.0711F , new CubeDeformation (0.0F )).mirror (false ), PartPose .offset (9.0F , 0.0F , 0.0F ));
112
+ PartDefinition wheel3 = rear_wheels .addOrReplaceChild ("wheel3" , CubeListBuilder .create ().texOffs (0 , 67 ).addBox (-2.0F , -1.0355F , -2.5F , 4.0F , 2.0711F , 5.0F , new CubeDeformation (0.0F ))
113
+ .texOffs (0 , 60 ).addBox (-2.0F , -2.5F , -1.0355F , 4.0F , 5.0F , 2.0711F , new CubeDeformation (0.0F )), PartPose .offset (9.0F , 0.0F , 0.0F ));
106
114
107
- PartDefinition octagon_r3 = wheel3 .addOrReplaceChild ("octagon_r3" , CubeListBuilder .create ().texOffs (61 , 13 ). mirror (). addBox (-2.0F , -2.5F , -1.0355F , 4.0F , 5.0F , 2.0711F , new CubeDeformation (0.0F )). mirror ( false )
108
- .texOffs (38 , 45 ). mirror (). addBox (-2.0F , -1.0355F , -2.5F , 4.0F , 2.0711F , 5.0F , new CubeDeformation (0.0F )). mirror ( false ), PartPose .offsetAndRotation (0.0F , 0.0F , 0.0F , -0.7854F , 0.0F , 0.0F ));
115
+ PartDefinition octagon_r3 = wheel3 .addOrReplaceChild ("octagon_r3" , CubeListBuilder .create ().texOffs (0 , 60 ). addBox (-2.0F , -2.5F , -1.0355F , 4.0F , 5.0F , 2.0711F , new CubeDeformation (0.0F ))
116
+ .texOffs (0 , 67 ). addBox (-2.0F , -1.0355F , -2.5F , 4.0F , 2.0711F , 5.0F , new CubeDeformation (0.0F )), PartPose .offsetAndRotation (0.0F , 0.0F , 0.0F , -0.7854F , 0.0F , 0.0F ));
109
117
110
- PartDefinition wheel4 = rear_wheels .addOrReplaceChild ("wheel4" , CubeListBuilder .create ().texOffs (20 , 44 ).addBox (-2.0F , -1.0355F , -2.5F , 4.0F , 2.0711F , 5.0F , new CubeDeformation (0.0F ))
118
+ PartDefinition wheel4 = rear_wheels .addOrReplaceChild ("wheel4" , CubeListBuilder .create ().texOffs (0 , 67 ).addBox (-2.0F , -1.0355F , -2.5F , 4.0F , 2.0711F , 5.0F , new CubeDeformation (0.0F ))
111
119
.texOffs (0 , 60 ).addBox (-2.0F , -2.5F , -1.0355F , 4.0F , 5.0F , 2.0711F , new CubeDeformation (0.0F )), PartPose .offset (-9.0F , 0.0F , 0.0F ));
112
120
113
- PartDefinition octagon_r4 = wheel4 .addOrReplaceChild ("octagon_r4" , CubeListBuilder .create ().texOffs (61 , 13 ).addBox (-2.0F , -2.5F , -1.0355F , 4.0F , 5.0F , 2.0711F , new CubeDeformation (0.0F ))
114
- .texOffs (38 , 45 ).addBox (-2.0F , -1.0355F , -2.5F , 4.0F , 2.0711F , 5.0F , new CubeDeformation (0.0F )), PartPose .offsetAndRotation (0.0F , 0.0F , 0.0F , -0.7854F , 0.0F , 0.0F ));
121
+ PartDefinition octagon_r4 = wheel4 .addOrReplaceChild ("octagon_r4" , CubeListBuilder .create ().texOffs (0 , 60 ).addBox (-2.0F , -2.5F , -1.0355F , 4.0F , 5.0F , 2.0711F , new CubeDeformation (0.0F ))
122
+ .texOffs (0 , 67 ).addBox (-2.0F , -1.0355F , -2.5F , 4.0F , 2.0711F , 5.0F , new CubeDeformation (0.0F )), PartPose .offsetAndRotation (0.0F , 0.0F , 0.0F , -0.7854F , 0.0F , 0.0F ));
123
+
124
+ PartDefinition axis = kart .addOrReplaceChild ("axis" , CubeListBuilder .create (), PartPose .offset (0.0F , 0.0F , 0.0F ));
125
+
126
+ PartDefinition cube_r10 = axis .addOrReplaceChild ("cube_r10" , CubeListBuilder .create ().texOffs (0 , 29 ).addBox (-11.5F , -1.0F , -1.0F , 23.0F , 2.0F , 2.0F , new CubeDeformation (0.0F )), PartPose .offsetAndRotation (0.0F , -2.5F , 9.0F , -0.7854F , 0.0F , 0.0F ));
127
+
128
+ PartDefinition cube_r11 = axis .addOrReplaceChild ("cube_r11" , CubeListBuilder .create ().texOffs (0 , 29 ).addBox (-11.5F , -1.0F , -1.0F , 23.0F , 2.0F , 2.0F , new CubeDeformation (0.0F )), PartPose .offsetAndRotation (0.0F , -2.5F , -8.0F , -0.7854F , 0.0F , 0.0F ));
129
+
130
+ PartDefinition player = partdefinition .addOrReplaceChild ("player" , CubeListBuilder .create ().texOffs (63 , 63 ).addBox (-4.0F , -20.0F , -4.0F , 8.0F , 8.0F , 8.0F , new CubeDeformation (0.0F ))
131
+ .texOffs (95 , 63 ).addBox (-4.0F , -20.0F , -4.0F , 8.0F , 8.0F , 8.0F , new CubeDeformation (0.5F ))
132
+ .texOffs (79 , 79 ).addBox (-4.0F , -12.0F , -2.0F , 8.0F , 12.0F , 4.0F , new CubeDeformation (0.0F ))
133
+ .texOffs (79 , 95 ).addBox (-4.0F , -12.0F , -2.0F , 8.0F , 12.0F , 4.0F , new CubeDeformation (0.25F )), PartPose .offset (0.0F , 17.0F , 6.0F ));
134
+
135
+ PartDefinition left_pants_r1 = player .addOrReplaceChild ("left_pants_r1" , CubeListBuilder .create ().texOffs (63 , 111 ).addBox (0.0F , 0.0F , -2.0F , 4.0F , 12.0F , 4.0F , new CubeDeformation (0.25F ))
136
+ .texOffs (79 , 111 ).addBox (0.0F , 0.0F , -2.0F , 4.0F , 12.0F , 4.0F , new CubeDeformation (0.0F )), PartPose .offsetAndRotation (0.0F , 0.0F , 0.0F , -1.5708F , -0.3927F , 0.0F ));
137
+
138
+ PartDefinition right_pants_r1 = player .addOrReplaceChild ("right_pants_r1" , CubeListBuilder .create ().texOffs (63 , 95 ).addBox (-4.0F , 0.0F , -2.0F , 4.0F , 12.0F , 4.0F , new CubeDeformation (0.25F ))
139
+ .texOffs (63 , 79 ).addBox (-4.0F , 0.0F , -2.0F , 4.0F , 12.0F , 4.0F , new CubeDeformation (0.0F )), PartPose .offsetAndRotation (0.0F , 0.0F , 0.0F , -1.5708F , 0.3927F , 0.0F ));
140
+
141
+ PartDefinition right_sleeve_r1 = player .addOrReplaceChild ("right_sleeve_r1" , CubeListBuilder .create ().texOffs (103 , 95 ).addBox (-8.0F , -2.0F , -2.0F , 4.0F , 12.0F , 4.0F , new CubeDeformation (0.25F ))
142
+ .texOffs (103 , 79 ).addBox (-8.0F , -2.0F , -2.0F , 4.0F , 12.0F , 4.0F , new CubeDeformation (0.0F ))
143
+ .texOffs (111 , 111 ).addBox (4.0F , -2.0F , -2.0F , 4.0F , 12.0F , 4.0F , new CubeDeformation (0.25F ))
144
+ .texOffs (95 , 111 ).addBox (4.0F , -2.0F , -2.0F , 4.0F , 12.0F , 4.0F , new CubeDeformation (0.0F )), PartPose .offsetAndRotation (0.0F , -10.0F , 0.0F , -1.1781F , 0.0F , 0.0F ));
115
145
116
146
return LayerDefinition .create (meshdefinition , 128 , 128 );
117
147
}
@@ -130,7 +160,7 @@ public void renderToBuffer(@NotNull PoseStack poseStack, @NotNull VertexConsumer
130
160
131
161
public void updateAnimate (@ NotNull MartingCarEntity entity , float partialTicks ) {
132
162
var steeringRad = entity .getSteeringRotateRadian ();
133
- steering_inner .yRot = Mth .rotLerp (partialTicks , prevSteeringRad , steeringRad );
163
+ inner .yRot = Mth .rotLerp (partialTicks , prevSteeringRad , steeringRad );
134
164
// Fixme: rotation vector to euler angles, needs some linear algebra staff.
135
165
// wheel.yRot = Mth.rotLerp(partialTicks, prevSteeringRad, steeringRad);
136
166
// wheel2.yRot = Mth.rotLerp(partialTicks, prevSteeringRad, steeringRad);
@@ -139,7 +169,7 @@ public void updateAnimate(@NotNull MartingCarEntity entity, float partialTicks)
139
169
front_wheels .xRot = Mth .rotLerp (partialTicks , prevWheelsRad , wheelRad );
140
170
rear_wheels .xRot = Mth .rotLerp (partialTicks , prevWheelsRad , wheelRad );
141
171
142
- prevSteeringRad = steering_inner .yRot ;
172
+ prevSteeringRad = inner .yRot ;
143
173
prevWheelsRad = rear_wheels .xRot ;
144
174
}
145
175
}
0 commit comments