尝试简化履带写法
This commit is contained in:
parent
2bf124d3ce
commit
5e340c2cc0
3 changed files with 43 additions and 4 deletions
|
@ -52,7 +52,7 @@ public class Yx100Model extends GeoModel<Yx100Entity> {
|
||||||
t -= 80;
|
t -= 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
trackAnimation(trackL, trackLRot, t);
|
// trackAnimation(trackL, trackLRot, t);
|
||||||
|
|
||||||
float t2 = animatable.getRightTrack() + 2 * i;
|
float t2 = animatable.getRightTrack() + 2 * i;
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ public class Yx100Model extends GeoModel<Yx100Entity> {
|
||||||
t2 -= 80;
|
t2 -= 80;
|
||||||
}
|
}
|
||||||
|
|
||||||
trackAnimation(trackR, trackRRot, t2);
|
// trackAnimation(trackR, trackRRot, t2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -84,6 +84,7 @@ public class Yx100Renderer extends GeoEntityRenderer<Yx100Entity> {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (name.equals("base")) {
|
if (name.equals("base")) {
|
||||||
|
bone.setHidden(true);
|
||||||
float a = animatable.getEntityData().get(YAW);
|
float a = animatable.getEntityData().get(YAW);
|
||||||
float r = (Mth.abs(a) - 90f) / 90f;
|
float r = (Mth.abs(a) - 90f) / 90f;
|
||||||
|
|
||||||
|
@ -105,6 +106,41 @@ public class Yx100Renderer extends GeoEntityRenderer<Yx100Entity> {
|
||||||
bone.setPosX(r2 * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * 1f);
|
bone.setPosX(r2 * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * 1f);
|
||||||
bone.setRotZ(r2 * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * Mth.DEG_TO_RAD * 1.5f);
|
bone.setRotZ(r2 * Mth.lerp(partialTick, (float) animatable.recoilShakeO, (float) animatable.getRecoilShake()) * Mth.DEG_TO_RAD * 1.5f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (int i = 0; i < 40; i++) {
|
||||||
|
float tO = animatable.leftTrackO + 2 * i;
|
||||||
|
float t = animatable.getLeftTrack() + 2 * i;
|
||||||
|
|
||||||
|
if (t >= 80) {
|
||||||
|
t -= 80;
|
||||||
|
}
|
||||||
|
|
||||||
|
float tO2 = animatable.rightTrackO + 2 * i;
|
||||||
|
float t2 = animatable.getRightTrack() + 2 * i;
|
||||||
|
|
||||||
|
if (t2 >= 80) {
|
||||||
|
t2 -= 80;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name.equals("trackL" + i)) {
|
||||||
|
bone.setPosY(Mth.lerp(partialTick, getBoneMoveY(tO), getBoneMoveY(t)));
|
||||||
|
bone.setPosZ(Mth.lerp(partialTick, getBoneMoveZ(tO), getBoneMoveZ(t)));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (name.equals("trackR" + i)) {
|
||||||
|
bone.setPosY(Mth.lerp(partialTick, getBoneMoveY(tO2), getBoneMoveY(t2)));
|
||||||
|
bone.setPosZ(Mth.lerp(partialTick, getBoneMoveZ(tO2), getBoneMoveZ(t2)));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, red, green, blue, alpha);
|
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, red, green, blue, alpha);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getBoneMoveY(float t) {
|
||||||
|
return y;
|
||||||
|
}
|
||||||
|
|
||||||
|
public float getBoneMoveZ(float t) {
|
||||||
|
return z;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -204,6 +204,9 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
setRightTrack(0);
|
setRightTrack(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
setRightTrack(getRightTrack() + 0.1f);
|
||||||
|
setLeftTrack(getLeftTrack() + 0.1f);
|
||||||
|
|
||||||
if (this.entityData.get(CANNON_FIRE_TIME) > 0) {
|
if (this.entityData.get(CANNON_FIRE_TIME) > 0) {
|
||||||
this.entityData.set(CANNON_FIRE_TIME, this.entityData.get(CANNON_FIRE_TIME) - 1);
|
this.entityData.set(CANNON_FIRE_TIME, this.entityData.get(CANNON_FIRE_TIME) - 1);
|
||||||
}
|
}
|
||||||
|
@ -504,8 +507,8 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti
|
||||||
this.setLeftWheelRot((float) ((this.getLeftWheelRot() - 1.25 * s0) + Mth.clamp(0.75f * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
this.setLeftWheelRot((float) ((this.getLeftWheelRot() - 1.25 * s0) + Mth.clamp(0.75f * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
||||||
this.setRightWheelRot((float) ((this.getRightWheelRot() - 1.25 * s0) - Mth.clamp(0.75f * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
this.setRightWheelRot((float) ((this.getRightWheelRot() - 1.25 * s0) - Mth.clamp(0.75f * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
||||||
|
|
||||||
setLeftTrack((float) ((getLeftTrack() - 1.9 * Math.PI * s0) + Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
// setLeftTrack((float) ((getLeftTrack() - 1.9 * Math.PI * s0) + Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
||||||
setRightTrack((float) ((getRightTrack() - 1.9 * Math.PI * s0) - Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
// setRightTrack((float) ((getRightTrack() - 1.9 * Math.PI * s0) - Mth.clamp(0.4f * Math.PI * this.entityData.get(DELTA_ROT), -5f, 5f)));
|
||||||
|
|
||||||
if (this.isInWater() || onGround()) {
|
if (this.isInWater() || onGround()) {
|
||||||
this.setYRot((float) (this.getYRot() - (isInWater() && !onGround() ? 2.5 : 6) * entityData.get(DELTA_ROT)));
|
this.setYRot((float) (this.getYRot() - (isInWater() && !onGround() ? 2.5 : 6) * entityData.get(DELTA_ROT)));
|
||||||
|
|
Loading…
Add table
Reference in a new issue