优化动画
This commit is contained in:
parent
fe9d843e6d
commit
148e80bd2a
9 changed files with 186 additions and 57 deletions
|
@ -41,7 +41,6 @@ public class AK12ItemModel extends GeoModel<AK12Item> {
|
||||||
@Override
|
@Override
|
||||||
public void setCustomAnimations(AK12Item animatable, long instanceId, AnimationState animationState) {
|
public void setCustomAnimations(AK12Item animatable, long instanceId, AnimationState animationState) {
|
||||||
CoreGeoBone gun = getAnimationProcessor().getBone("bone");
|
CoreGeoBone gun = getAnimationProcessor().getBone("bone");
|
||||||
CoreGeoBone shen = getAnimationProcessor().getBone("shen");
|
|
||||||
CoreGeoBone scope1 = getAnimationProcessor().getBone("Scope1");
|
CoreGeoBone scope1 = getAnimationProcessor().getBone("Scope1");
|
||||||
CoreGeoBone scope2 = getAnimationProcessor().getBone("Scope2");
|
CoreGeoBone scope2 = getAnimationProcessor().getBone("Scope2");
|
||||||
CoreGeoBone scope3 = getAnimationProcessor().getBone("Scope3");
|
CoreGeoBone scope3 = getAnimationProcessor().getBone("Scope3");
|
||||||
|
@ -54,6 +53,7 @@ public class AK12ItemModel extends GeoModel<AK12Item> {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (!stack.is(ModTags.Items.GUN)) return;
|
if (!stack.is(ModTags.Items.GUN)) return;
|
||||||
|
|
||||||
|
float times = 0.6f * (float) Math.min(Minecraft.getInstance().getDeltaFrameTime(), 1.6);
|
||||||
double zt = ClientEventHandler.zoomTime;
|
double zt = ClientEventHandler.zoomTime;
|
||||||
double zp = ClientEventHandler.zoomPos;
|
double zp = ClientEventHandler.zoomPos;
|
||||||
double zpz = ClientEventHandler.zoomPosZ;
|
double zpz = ClientEventHandler.zoomPosZ;
|
||||||
|
@ -67,12 +67,11 @@ public class AK12ItemModel extends GeoModel<AK12Item> {
|
||||||
double turnRotX = ClientEventHandler.turnRot[0];
|
double turnRotX = ClientEventHandler.turnRot[0];
|
||||||
double turnRotY = ClientEventHandler.turnRot[1];
|
double turnRotY = ClientEventHandler.turnRot[1];
|
||||||
double turnRotZ = ClientEventHandler.turnRot[2];
|
double turnRotZ = ClientEventHandler.turnRot[2];
|
||||||
double fpz = ClientEventHandler.firePosZ;
|
double fpz = ClientEventHandler.firePosZ * 13 * times;;
|
||||||
double fp = ClientEventHandler.firePos;
|
double fp = ClientEventHandler.firePos;
|
||||||
double fr = ClientEventHandler.fireRot;
|
double fr = ClientEventHandler.fireRot;
|
||||||
|
|
||||||
int type = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
int type = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||||
float times = 0.6f * (float) Math.min(Minecraft.getInstance().getDeltaFrameTime(), 1.6);
|
|
||||||
|
|
||||||
float posY = switch (type) {
|
float posY = switch (type) {
|
||||||
case 0 -> 0.781f;
|
case 0 -> 0.781f;
|
||||||
|
@ -110,22 +109,35 @@ public class AK12ItemModel extends GeoModel<AK12Item> {
|
||||||
|
|
||||||
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 1.85));
|
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 1.85));
|
||||||
|
|
||||||
fireRotY = (float) Mth.lerp(0.35f * times, fireRotY, 0.26f * ClientEventHandler.recoilHorizon * fpz);
|
CoreGeoBone shen;
|
||||||
fireRotZ = (float) Mth.lerp(0.35f * times, fireRotZ, (0.4f + 0.5 * fr) * ClientEventHandler.recoilHorizon);
|
if (zt < 0.5) {
|
||||||
|
shen = getAnimationProcessor().getBone("fireRootNormal");
|
||||||
|
} else {
|
||||||
|
shen = switch (type) {
|
||||||
|
case 0 -> getAnimationProcessor().getBone("fireRoot0");
|
||||||
|
case 1 -> getAnimationProcessor().getBone("fireRoot1");
|
||||||
|
case 2 -> getAnimationProcessor().getBone("fireRoot2");
|
||||||
|
case 3 -> getAnimationProcessor().getBone("fireRoot3");
|
||||||
|
default -> getAnimationProcessor().getBone("fireRootNormal");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
shen.setPosX((float) (0.95f * ClientEventHandler.recoilHorizon * fpz * fp));
|
fireRotY = (float) Mth.lerp(0.5f * times, fireRotY, 0.2f * ClientEventHandler.recoilHorizon * fpz);
|
||||||
|
fireRotZ = (float) Mth.lerp(0.7f * times, fireRotZ, (0.4f + 0.5 * fr) * ClientEventHandler.recoilHorizon);
|
||||||
|
|
||||||
|
shen.setPosX((float) (-1.65f * ClientEventHandler.recoilHorizon * fpz * fp));
|
||||||
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
||||||
shen.setPosZ((float) (0.275 * fp + 0.34f * fr + 0.65 * fpz));
|
shen.setPosZ((float) (0.275 * fp + 0.34f * fr + 0.65 * fpz));
|
||||||
shen.setRotX((float) (0.01f * fp + 0.05f * fr + 0.01f * fpz));
|
shen.setRotX((float) (0.01f * fp + 0.08f * fr + 0.01f * fpz));
|
||||||
shen.setRotY(fireRotY);
|
shen.setRotY(fireRotY);
|
||||||
shen.setRotZ(fireRotZ);
|
shen.setRotZ(fireRotZ);
|
||||||
|
|
||||||
shen.setPosX((float) (shen.getPosX() * (1 - 0.5 * zt)));
|
shen.setPosX((float) (shen.getPosX() * (1 - 0.1 * zt)));
|
||||||
shen.setPosY((float) (shen.getPosY() * (-1 + 0.8 * zt)));
|
shen.setPosY((float) (shen.getPosY() * (-1 + 0.8 * zt)));
|
||||||
shen.setPosZ((float) (shen.getPosZ() * (1 - 0.3 * zt)));
|
shen.setPosZ((float) (shen.getPosZ() * (1 - 0.6 * zt)));
|
||||||
shen.setRotX((float) (shen.getRotX() * (1 - 0.9 * zt)));
|
shen.setRotX((float) (shen.getRotX() * (1 - 0.9 * zt)));
|
||||||
shen.setRotY((float) (shen.getRotY() * (1 - 0.9 * zt)));
|
shen.setRotY((float) (shen.getRotY() * (1 - 0.75 * zt)));
|
||||||
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.9 * zt)));
|
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.4 * zt)));
|
||||||
|
|
||||||
shuan.setPosZ(2.4f * (float) fp);
|
shuan.setPosZ(2.4f * (float) fp);
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@ public class AK47ItemModel extends GeoModel<AK47Item> {
|
||||||
@Override
|
@Override
|
||||||
public void setCustomAnimations(AK47Item animatable, long instanceId, AnimationState animationState) {
|
public void setCustomAnimations(AK47Item animatable, long instanceId, AnimationState animationState) {
|
||||||
CoreGeoBone gun = getAnimationProcessor().getBone("bone");
|
CoreGeoBone gun = getAnimationProcessor().getBone("bone");
|
||||||
CoreGeoBone shen = getAnimationProcessor().getBone("shen");
|
|
||||||
CoreGeoBone scope = getAnimationProcessor().getBone("Scope1");
|
CoreGeoBone scope = getAnimationProcessor().getBone("Scope1");
|
||||||
CoreGeoBone scope2 = getAnimationProcessor().getBone("Scope2");
|
CoreGeoBone scope2 = getAnimationProcessor().getBone("Scope2");
|
||||||
CoreGeoBone scope3 = getAnimationProcessor().getBone("Scope3");
|
CoreGeoBone scope3 = getAnimationProcessor().getBone("Scope3");
|
||||||
|
@ -49,6 +48,7 @@ public class AK47ItemModel extends GeoModel<AK47Item> {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (!stack.is(ModTags.Items.GUN)) return;
|
if (!stack.is(ModTags.Items.GUN)) return;
|
||||||
|
|
||||||
|
float times = 0.6f * (float) Math.min(Minecraft.getInstance().getDeltaFrameTime(), 1.6);
|
||||||
double zt = ClientEventHandler.zoomTime;
|
double zt = ClientEventHandler.zoomTime;
|
||||||
double zp = ClientEventHandler.zoomPos;
|
double zp = ClientEventHandler.zoomPos;
|
||||||
double zpz = ClientEventHandler.zoomPosZ;
|
double zpz = ClientEventHandler.zoomPosZ;
|
||||||
|
@ -62,12 +62,11 @@ public class AK47ItemModel extends GeoModel<AK47Item> {
|
||||||
double turnRotX = ClientEventHandler.turnRot[0];
|
double turnRotX = ClientEventHandler.turnRot[0];
|
||||||
double turnRotY = ClientEventHandler.turnRot[1];
|
double turnRotY = ClientEventHandler.turnRot[1];
|
||||||
double turnRotZ = ClientEventHandler.turnRot[2];
|
double turnRotZ = ClientEventHandler.turnRot[2];
|
||||||
double fpz = ClientEventHandler.firePosZ;
|
double fpz = ClientEventHandler.firePosZ * 13 * times;
|
||||||
double fp = ClientEventHandler.firePos;
|
double fp = ClientEventHandler.firePos;
|
||||||
double fr = ClientEventHandler.fireRot;
|
double fr = ClientEventHandler.fireRot;
|
||||||
|
|
||||||
int type = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
int type = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||||
float times = 0.6f * (float) Math.min(Minecraft.getInstance().getDeltaFrameTime(), 1.6);
|
|
||||||
|
|
||||||
float posYAlt = switch (type) {
|
float posYAlt = switch (type) {
|
||||||
case 2 -> 0.45f;
|
case 2 -> 0.45f;
|
||||||
|
@ -111,22 +110,35 @@ public class AK47ItemModel extends GeoModel<AK47Item> {
|
||||||
|
|
||||||
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 1.8));
|
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 1.8));
|
||||||
|
|
||||||
fireRotY = (float) Mth.lerp(0.3f * times, fireRotY, 0.3f * ClientEventHandler.recoilHorizon * fpz);
|
CoreGeoBone shen;
|
||||||
fireRotZ = (float) Mth.lerp(0.3f * times, fireRotZ, (0.5f + 0.7 * fr) * ClientEventHandler.recoilHorizon);
|
if (zt < 0.5) {
|
||||||
|
shen = getAnimationProcessor().getBone("fireRootNormal");
|
||||||
|
} else {
|
||||||
|
shen = switch (type) {
|
||||||
|
case 0 -> getAnimationProcessor().getBone("fireRoot0");
|
||||||
|
case 1 -> getAnimationProcessor().getBone("fireRoot1");
|
||||||
|
case 2 -> getAnimationProcessor().getBone("fireRoot2");
|
||||||
|
case 3 -> getAnimationProcessor().getBone("fireRoot3");
|
||||||
|
default -> getAnimationProcessor().getBone("fireRootNormal");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
shen.setPosX((float) (0.95f * ClientEventHandler.recoilHorizon * fpz * fp));
|
fireRotY = (float) Mth.lerp(0.5f * times, fireRotY, 0.2f * ClientEventHandler.recoilHorizon * fpz);
|
||||||
|
fireRotZ = (float) Mth.lerp(0.7f * times, fireRotZ, (0.4f + 0.5 * fr) * ClientEventHandler.recoilHorizon);
|
||||||
|
|
||||||
|
shen.setPosX((float) (-1.65f * ClientEventHandler.recoilHorizon * fpz * fp));
|
||||||
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
||||||
shen.setPosZ((float) (0.275 * fp + 0.34f * fr + 0.65 * fpz));
|
shen.setPosZ((float) (0.275 * fp + 0.34f * fr + 0.65 * fpz));
|
||||||
shen.setRotX((float) (0.01f * fp + 0.08f * fr + 0.01f * fpz));
|
shen.setRotX((float) (0.01f * fp + 0.08f * fr + 0.01f * fpz));
|
||||||
shen.setRotY(fireRotY);
|
shen.setRotY(fireRotY);
|
||||||
shen.setRotZ(fireRotZ);
|
shen.setRotZ(fireRotZ);
|
||||||
|
|
||||||
shen.setPosX((float) (shen.getPosX() * (1 - 0.5 * zt)));
|
shen.setPosX((float) (shen.getPosX() * (1 - 0.1 * zt)));
|
||||||
shen.setPosY((float) (shen.getPosY() * (-1 + 0.8 * zt)));
|
shen.setPosY((float) (shen.getPosY() * (-1 + 0.8 * zt)));
|
||||||
shen.setPosZ((float) (shen.getPosZ() * (1 - 0.6 * zt)));
|
shen.setPosZ((float) (shen.getPosZ() * (1 - 0.6 * zt)));
|
||||||
shen.setRotX((float) (shen.getRotX() * (1 - 0.9 * zt)));
|
shen.setRotX((float) (shen.getRotX() * (1 - 0.9 * zt)));
|
||||||
shen.setRotY((float) (shen.getRotY() * (1 - 0.8 * zt)));
|
shen.setRotY((float) (shen.getRotY() * (1 - 0.75 * zt)));
|
||||||
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.8 * zt)));
|
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.4 * zt)));
|
||||||
|
|
||||||
shuan.setPosZ(2.4f * (float) fp);
|
shuan.setPosZ(2.4f * (float) fp);
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,6 @@ public class Hk416ItemModel extends GeoModel<Hk416Item> {
|
||||||
@Override
|
@Override
|
||||||
public void setCustomAnimations(Hk416Item animatable, long instanceId, AnimationState animationState) {
|
public void setCustomAnimations(Hk416Item animatable, long instanceId, AnimationState animationState) {
|
||||||
CoreGeoBone gun = getAnimationProcessor().getBone("bone");
|
CoreGeoBone gun = getAnimationProcessor().getBone("bone");
|
||||||
CoreGeoBone shen = getAnimationProcessor().getBone("shen");
|
|
||||||
CoreGeoBone scope = getAnimationProcessor().getBone("Scope1");
|
CoreGeoBone scope = getAnimationProcessor().getBone("Scope1");
|
||||||
CoreGeoBone scope2 = getAnimationProcessor().getBone("Scope2");
|
CoreGeoBone scope2 = getAnimationProcessor().getBone("Scope2");
|
||||||
CoreGeoBone scope3 = getAnimationProcessor().getBone("Scope3");
|
CoreGeoBone scope3 = getAnimationProcessor().getBone("Scope3");
|
||||||
|
@ -52,6 +51,8 @@ public class Hk416ItemModel extends GeoModel<Hk416Item> {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (!stack.is(ModTags.Items.GUN)) return;
|
if (!stack.is(ModTags.Items.GUN)) return;
|
||||||
|
|
||||||
|
float times = 0.6f * (float) Math.min(Minecraft.getInstance().getDeltaFrameTime(), 1.6);
|
||||||
|
|
||||||
double zt = ClientEventHandler.zoomTime;
|
double zt = ClientEventHandler.zoomTime;
|
||||||
double zp = ClientEventHandler.zoomPos;
|
double zp = ClientEventHandler.zoomPos;
|
||||||
double zpz = ClientEventHandler.zoomPosZ;
|
double zpz = ClientEventHandler.zoomPosZ;
|
||||||
|
@ -65,12 +66,11 @@ public class Hk416ItemModel extends GeoModel<Hk416Item> {
|
||||||
double turnRotX = ClientEventHandler.turnRot[0];
|
double turnRotX = ClientEventHandler.turnRot[0];
|
||||||
double turnRotY = ClientEventHandler.turnRot[1];
|
double turnRotY = ClientEventHandler.turnRot[1];
|
||||||
double turnRotZ = ClientEventHandler.turnRot[2];
|
double turnRotZ = ClientEventHandler.turnRot[2];
|
||||||
double fpz = ClientEventHandler.firePosZ;
|
double fpz = ClientEventHandler.firePosZ * 17 * times;
|
||||||
double fp = ClientEventHandler.firePos;
|
double fp = ClientEventHandler.firePos;
|
||||||
double fr = ClientEventHandler.fireRot;
|
double fr = ClientEventHandler.fireRot;
|
||||||
|
|
||||||
int type = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
int type = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||||
float times = 0.6f * (float) Math.min(Minecraft.getInstance().getDeltaFrameTime(), 1.6);
|
|
||||||
|
|
||||||
float posY = switch (type) {
|
float posY = switch (type) {
|
||||||
case 0 -> 1.04f;
|
case 0 -> 1.04f;
|
||||||
|
@ -102,22 +102,35 @@ public class Hk416ItemModel extends GeoModel<Hk416Item> {
|
||||||
|
|
||||||
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 3.1));
|
stack.getOrCreateTag().putBoolean("HoloHidden", !(gun.getPosX() > 3.1));
|
||||||
|
|
||||||
fireRotY = (float) Mth.lerp(0.4f * times, fireRotY, 0.2f * ClientEventHandler.recoilHorizon * fpz);
|
CoreGeoBone shen;
|
||||||
fireRotZ = (float) Mth.lerp(0.4f * times, fireRotZ, (0.3f + 0.4 * fr) * ClientEventHandler.recoilHorizon);
|
if (zt < 0.5) {
|
||||||
|
shen = getAnimationProcessor().getBone("fireRootNormal");
|
||||||
|
} else {
|
||||||
|
shen = switch (type) {
|
||||||
|
case 0 -> getAnimationProcessor().getBone("fireRoot0");
|
||||||
|
case 1 -> getAnimationProcessor().getBone("fireRoot1");
|
||||||
|
case 2 -> getAnimationProcessor().getBone("fireRoot2");
|
||||||
|
case 3 -> getAnimationProcessor().getBone("fireRoot3");
|
||||||
|
default -> getAnimationProcessor().getBone("fireRootNormal");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
shen.setPosX((float) (0.95f * ClientEventHandler.recoilHorizon * fpz * fp));
|
fireRotY = (float) Mth.lerp(0.5f * times, fireRotY, 0.2f * ClientEventHandler.recoilHorizon * fpz);
|
||||||
|
fireRotZ = (float) Mth.lerp(0.9f * times, fireRotZ, (0.2f + 0.3 * fr) * ClientEventHandler.recoilHorizon);
|
||||||
|
|
||||||
|
shen.setPosX((float) (-3.45f * ClientEventHandler.recoilHorizon * fpz * fp));
|
||||||
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
||||||
shen.setPosZ((float) (0.275 * fp + 0.34f * fr + 0.65 * fpz));
|
shen.setPosZ((float) (0.275 * fp + 0.34f * fr + 0.65 * fpz));
|
||||||
shen.setRotX((float) (0.01f * fp + 0.05f * fr + 0.01f * fpz));
|
shen.setRotX((float) (0.01f * fp + 0.05f * fr + 0.01f * fpz));
|
||||||
shen.setRotY(fireRotY);
|
shen.setRotY(fireRotY);
|
||||||
shen.setRotZ(fireRotZ);
|
shen.setRotZ(fireRotZ);
|
||||||
|
|
||||||
shen.setPosX((float) (shen.getPosX() * (1 - 0.5 * zt)));
|
shen.setPosX((float) (shen.getPosX() * (1 - 0.1 * zt)));
|
||||||
shen.setPosY((float) (shen.getPosY() * (-1 + 0.4 * zt)));
|
shen.setPosY((float) (shen.getPosY() * (-1 + 0.8 * zt)));
|
||||||
shen.setPosZ((float) (shen.getPosZ() * (1 - 0.6 * zt)));
|
shen.setPosZ((float) (shen.getPosZ() * (1 - 0.6 * zt)));
|
||||||
shen.setRotX((float) (shen.getRotX() * (1 - 0.9 * zt)));
|
shen.setRotX((float) (shen.getRotX() * (1 - 0.9 * zt)));
|
||||||
shen.setRotY((float) (shen.getRotY() * (1 - 0.9 * zt)));
|
shen.setRotY((float) (shen.getRotY() * (1 - 0.75 * zt)));
|
||||||
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.9 * zt)));
|
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.4 * zt)));
|
||||||
|
|
||||||
cross1.setPosY(-0.75f * (float) fpz);
|
cross1.setPosY(-0.75f * (float) fpz);
|
||||||
cross2.setPosY(-0.7f * (float) fpz);
|
cross2.setPosY(-0.7f * (float) fpz);
|
||||||
|
|
|
@ -44,7 +44,6 @@ public class M4ItemModel extends GeoModel<M4Item> {
|
||||||
@Override
|
@Override
|
||||||
public void setCustomAnimations(M4Item animatable, long instanceId, AnimationState animationState) {
|
public void setCustomAnimations(M4Item animatable, long instanceId, AnimationState animationState) {
|
||||||
CoreGeoBone gun = getAnimationProcessor().getBone("bone");
|
CoreGeoBone gun = getAnimationProcessor().getBone("bone");
|
||||||
CoreGeoBone shen = getAnimationProcessor().getBone("shen");
|
|
||||||
CoreGeoBone scope = getAnimationProcessor().getBone("Scope1");
|
CoreGeoBone scope = getAnimationProcessor().getBone("Scope1");
|
||||||
CoreGeoBone scope2 = getAnimationProcessor().getBone("Scope2");
|
CoreGeoBone scope2 = getAnimationProcessor().getBone("Scope2");
|
||||||
CoreGeoBone scope3 = getAnimationProcessor().getBone("Scope3");
|
CoreGeoBone scope3 = getAnimationProcessor().getBone("Scope3");
|
||||||
|
@ -61,6 +60,7 @@ public class M4ItemModel extends GeoModel<M4Item> {
|
||||||
ItemStack stack = player.getMainHandItem();
|
ItemStack stack = player.getMainHandItem();
|
||||||
if (!stack.is(ModTags.Items.GUN)) return;
|
if (!stack.is(ModTags.Items.GUN)) return;
|
||||||
|
|
||||||
|
float times = 0.6f * (float) Math.min(Minecraft.getInstance().getDeltaFrameTime(), 1.6);
|
||||||
double zt = ClientEventHandler.zoomTime;
|
double zt = ClientEventHandler.zoomTime;
|
||||||
double zp = ClientEventHandler.zoomPos;
|
double zp = ClientEventHandler.zoomPos;
|
||||||
double zpz = ClientEventHandler.zoomPosZ;
|
double zpz = ClientEventHandler.zoomPosZ;
|
||||||
|
@ -74,12 +74,11 @@ public class M4ItemModel extends GeoModel<M4Item> {
|
||||||
double turnRotX = ClientEventHandler.turnRot[0];
|
double turnRotX = ClientEventHandler.turnRot[0];
|
||||||
double turnRotY = ClientEventHandler.turnRot[1];
|
double turnRotY = ClientEventHandler.turnRot[1];
|
||||||
double turnRotZ = ClientEventHandler.turnRot[2];
|
double turnRotZ = ClientEventHandler.turnRot[2];
|
||||||
double fpz = ClientEventHandler.firePosZ;
|
double fpz = ClientEventHandler.firePosZ * 17 * times;
|
||||||
double fp = ClientEventHandler.firePos;
|
double fp = ClientEventHandler.firePos;
|
||||||
double fr = ClientEventHandler.fireRot;
|
double fr = ClientEventHandler.fireRot;
|
||||||
|
|
||||||
int type = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
int type = GunsTool.getAttachmentType(stack, GunsTool.AttachmentType.SCOPE);
|
||||||
float times = 0.6f * (float) Math.min(Minecraft.getInstance().getDeltaFrameTime(), 1.6);
|
|
||||||
|
|
||||||
posYAlt = Mth.lerp(times, posYAlt, stack.getOrCreateTag().getBoolean("ScopeAlt")? -0.6875f : 0.5625f);
|
posYAlt = Mth.lerp(times, posYAlt, stack.getOrCreateTag().getBoolean("ScopeAlt")? -0.6875f : 0.5625f);
|
||||||
scaleZAlt = Mth.lerp(times, scaleZAlt, stack.getOrCreateTag().getBoolean("ScopeAlt")? 0.4f : 0.88f);
|
scaleZAlt = Mth.lerp(times, scaleZAlt, stack.getOrCreateTag().getBoolean("ScopeAlt")? 0.4f : 0.88f);
|
||||||
|
@ -125,27 +124,40 @@ public class M4ItemModel extends GeoModel<M4Item> {
|
||||||
if (type == 3 && zt > 0.5) {
|
if (type == 3 && zt > 0.5) {
|
||||||
lh.setPosY((float) (-zt * 4));
|
lh.setPosY((float) (-zt * 4));
|
||||||
}
|
}
|
||||||
|
CoreGeoBone shen;
|
||||||
|
if (zt < 0.5) {
|
||||||
|
shen = getAnimationProcessor().getBone("fireRootNormal");
|
||||||
|
} else {
|
||||||
|
shen = switch (type) {
|
||||||
|
case 0 -> getAnimationProcessor().getBone("fireRoot0");
|
||||||
|
case 1 -> getAnimationProcessor().getBone("fireRoot1");
|
||||||
|
case 2 -> getAnimationProcessor().getBone("fireRoot2");
|
||||||
|
case 3 -> getAnimationProcessor().getBone("fireRoot3");
|
||||||
|
default -> getAnimationProcessor().getBone("fireRootNormal");
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
fireRotY = (float) Mth.lerp(0.38f * times, fireRotY, 0.25f * ClientEventHandler.recoilHorizon * fpz);
|
fireRotY = (float) Mth.lerp(0.5f * times, fireRotY, 0.2f * ClientEventHandler.recoilHorizon * fpz);
|
||||||
fireRotZ = (float) Mth.lerp(0.38f * times, fireRotZ, (0.3f + 0.5 * fr) * ClientEventHandler.recoilHorizon);
|
fireRotZ = (float) Mth.lerp(0.9f * times, fireRotZ, (0.2f + 0.3 * fr) * ClientEventHandler.recoilHorizon);
|
||||||
|
|
||||||
shen.setPosX((float) (1.35f * ClientEventHandler.recoilHorizon * fpz * fp));
|
shen.setPosX((float) (-3.45f * ClientEventHandler.recoilHorizon * fpz * fp));
|
||||||
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
shen.setPosY((float) (0.15f * fp + 0.18f * fr));
|
||||||
shen.setPosZ((float) (0.345 * fp + 0.44f * fr + 0.75 * fpz));
|
shen.setPosZ((float) (0.275 * fp + 0.34f * fr + 0.65 * fpz));
|
||||||
shen.setRotX((float) (0.01f * fp + 0.05f * fr + 0.01f * fpz));
|
shen.setRotX((float) (0.01f * fp + 0.05f * fr + 0.01f * fpz));
|
||||||
shen.setRotY(fireRotY);
|
shen.setRotY(fireRotY);
|
||||||
shen.setRotZ(fireRotZ);
|
shen.setRotZ(fireRotZ);
|
||||||
cross1.setPosY(-0.75f * (float) fpz);
|
|
||||||
|
cross1.setPosY(-0.25f * (float) fpz);
|
||||||
cross2.setPosY(-0.1f * (float) fpz);
|
cross2.setPosY(-0.1f * (float) fpz);
|
||||||
crossAlt.setPosY(-0.2f * (float) fpz);
|
crossAlt.setPosY(-0.2f * (float) fpz);
|
||||||
cross3.setPosY(-0.2f * (float) fpz);
|
cross3.setPosY(-0.2f * (float) fpz);
|
||||||
|
|
||||||
shen.setPosX((float) (shen.getPosX() * (1 - 0.8 * zt)));
|
shen.setPosX((float) (shen.getPosX() * (1 - 0.1 * zt)));
|
||||||
shen.setPosY((float) (shen.getPosY() * (-1 + 0.8 * zt)));
|
shen.setPosY((float) (shen.getPosY() * (-1 + 0.8 * zt)));
|
||||||
shen.setPosZ((float) (shen.getPosZ() * (1 - 0.6 * zt)));
|
shen.setPosZ((float) (shen.getPosZ() * (1 - 0.6 * zt)));
|
||||||
shen.setRotX((float) (shen.getRotX() * (1 - (type == 3 ? 0.96 : type == 1 ? 0.4 : 0.9) * zt)));
|
shen.setRotX((float) (shen.getRotX() * (1 - (type == 3 ? 0.96 : type == 1 ? 0.8 : 0.9) * zt)));
|
||||||
shen.setRotY((float) (shen.getRotY() * (1 - (type == 3 ? 0.98 : 0.9) * zt)));
|
shen.setRotY((float) (shen.getRotY() * (1 - (type == 3 ? 0.95 : 0.9) * zt)));
|
||||||
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.9 * zt)));
|
shen.setRotZ((float) (shen.getRotZ() * (1 - 0.4 * zt)));
|
||||||
|
|
||||||
shen.setPosX(0.2f * (float) (ClientEventHandler.recoilHorizon * (0.5 + 0.4 * ClientEventHandler.fireSpread)));
|
shen.setPosX(0.2f * (float) (ClientEventHandler.recoilHorizon * (0.5 + 0.4 * ClientEventHandler.fireSpread)));
|
||||||
|
|
||||||
|
|
|
@ -509,7 +509,7 @@ public class ClientEventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void handleWeaponFire(ViewportEvent.ComputeCameraAngles event, LivingEntity entity) {
|
private static void handleWeaponFire(ViewportEvent.ComputeCameraAngles event, LivingEntity entity) {
|
||||||
float times = 2f * Math.min(Minecraft.getInstance().getDeltaFrameTime(), 0.8f);
|
float times = 2f * Math.min(Minecraft.getInstance().getDeltaFrameTime(), 0.48f);
|
||||||
float yaw = event.getYaw();
|
float yaw = event.getYaw();
|
||||||
float pitch = event.getPitch();
|
float pitch = event.getPitch();
|
||||||
float roll = event.getRoll();
|
float roll = event.getRoll();
|
||||||
|
@ -520,8 +520,8 @@ public class ClientEventHandler {
|
||||||
firePosTimer = 0.001;
|
firePosTimer = 0.001;
|
||||||
fireRotTimer = 0.001;
|
fireRotTimer = 0.001;
|
||||||
fireRecoilTime -= 7 * times;
|
fireRecoilTime -= 7 * times;
|
||||||
fireSpread += 0.1;
|
fireSpread += 0.1 * times;
|
||||||
firePosZ += 0.5 * firePosZ + 0.15;
|
firePosZ += (0.8 * firePosZ + 0.25) * (4 * Math.random() + 0.85) * times;
|
||||||
recoilTime = 0.01;
|
recoilTime = 0.01;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,13 +25,33 @@
|
||||||
"pivot": [0, 0, 0]
|
"pivot": [0, 0, 0]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "shen",
|
"name": "fireRootNormal",
|
||||||
"parent": "bone",
|
"parent": "bone",
|
||||||
"pivot": [0.5, 3, 2]
|
"pivot": [0.5, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireRoot0",
|
||||||
|
"parent": "fireRootNormal",
|
||||||
|
"pivot": [0.5, 3.55, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireRoot1",
|
||||||
|
"parent": "fireRoot0",
|
||||||
|
"pivot": [0.5, 4.42656, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireRoot2",
|
||||||
|
"parent": "fireRoot1",
|
||||||
|
"pivot": [0.59609, 4.52187, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireRoot3",
|
||||||
|
"parent": "fireRoot2",
|
||||||
|
"pivot": [0.5, 4.58828, 2]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "0",
|
"name": "0",
|
||||||
"parent": "shen",
|
"parent": "fireRoot3",
|
||||||
"pivot": [0, 0, 0]
|
"pivot": [0, 0, 0]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,13 +25,33 @@
|
||||||
"pivot": [0, 0, 0]
|
"pivot": [0, 0, 0]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "shen",
|
"name": "fireRootNormal",
|
||||||
"parent": "bone",
|
"parent": "bone",
|
||||||
"pivot": [0.5, 3.5, 3]
|
"pivot": [0.5, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireRoot0",
|
||||||
|
"parent": "fireRootNormal",
|
||||||
|
"pivot": [0.5, 3.86953, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireRoot1",
|
||||||
|
"parent": "fireRoot0",
|
||||||
|
"pivot": [0.5, 4.20703, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireRoot2",
|
||||||
|
"parent": "fireRoot1",
|
||||||
|
"pivot": [0.5, 4.70625, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireRoot3",
|
||||||
|
"parent": "fireRoot2",
|
||||||
|
"pivot": [0.5, 4.6625, 2]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "0",
|
"name": "0",
|
||||||
"parent": "shen",
|
"parent": "fireRoot3",
|
||||||
"pivot": [0, 0, 0]
|
"pivot": [0, 0, 0]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,13 +21,33 @@
|
||||||
"pivot": [0, 0, 0]
|
"pivot": [0, 0, 0]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "shen",
|
"name": "fireRootNormal",
|
||||||
"parent": "bone",
|
"parent": "bone",
|
||||||
"pivot": [0, 3.4, 3]
|
"pivot": [0.5, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireRoot0",
|
||||||
|
"parent": "fireRootNormal",
|
||||||
|
"pivot": [0, 4.25, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireRoot1",
|
||||||
|
"parent": "fireRoot0",
|
||||||
|
"pivot": [0, 4.78437, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireRoot2",
|
||||||
|
"parent": "fireRoot1",
|
||||||
|
"pivot": [0, 5.02187, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireRoot3",
|
||||||
|
"parent": "fireRoot2",
|
||||||
|
"pivot": [0, 4.78828, 2]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "0",
|
"name": "0",
|
||||||
"parent": "shen",
|
"parent": "fireRoot3",
|
||||||
"pivot": [0, 0, 0]
|
"pivot": [0, 0, 0]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,13 +25,33 @@
|
||||||
"pivot": [0, 0, 0]
|
"pivot": [0, 0, 0]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "shen",
|
"name": "fireRootNormal",
|
||||||
"parent": "bone",
|
"parent": "bone",
|
||||||
"pivot": [0, 3, 3.25]
|
"pivot": [0.5, 0, 3]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireRoot0",
|
||||||
|
"parent": "fireRootNormal",
|
||||||
|
"pivot": [0, 4.64609, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireRoot1",
|
||||||
|
"parent": "fireRoot0",
|
||||||
|
"pivot": [0, 5.07578, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireRoot2",
|
||||||
|
"parent": "fireRoot1",
|
||||||
|
"pivot": [0, 4.92187, 2]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "fireRoot3",
|
||||||
|
"parent": "fireRoot2",
|
||||||
|
"pivot": [0, 4.63125, 2]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "0",
|
"name": "0",
|
||||||
"parent": "shen",
|
"parent": "fireRoot3",
|
||||||
"pivot": [0, 0, 0]
|
"pivot": [0, 0, 0]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Reference in a new issue