优化手仓手持武器视角,修复单发换弹类武器狂按R无法换弹bug

This commit is contained in:
Atsuihsio 2025-01-11 00:38:47 +08:00
parent 0d29a1a022
commit f9b8f9d055
8 changed files with 17 additions and 15 deletions

View file

@ -63,9 +63,9 @@ public class Glock17ItemModel extends GeoModel<Glock17Item> {
double fp = ClientEventHandler.firePos; double fp = ClientEventHandler.firePos;
double fr = ClientEventHandler.fireRot; double fr = ClientEventHandler.fireRot;
gun.setPosX(2.96f * (float) zp); gun.setPosX(1.23f * (float) zp);
gun.setPosY(2.43f * (float) zp - (float) (0.2f * zpz)); gun.setPosY(1.43f * (float) zp - (float) (0.2f * zpz));
gun.setPosZ(7f * (float) zp + (float) (0.3f * zpz)); gun.setPosZ(7f * (float) zp + (float) (0.3f * zpz));
@ -74,7 +74,7 @@ public class Glock17ItemModel extends GeoModel<Glock17Item> {
shen.setPosX((float) (0.95f * ClientEventHandler.recoilHorizon * fpz * fp)); shen.setPosX((float) (0.95f * ClientEventHandler.recoilHorizon * fpz * fp));
shen.setPosY((float) (0.25f * fp + 0.28f * fr)); shen.setPosY((float) (0.25f * fp + 0.28f * fr));
shen.setPosZ((float) (2.375 * fp + 0.44f * fr + 0.75 * fpz)); shen.setPosZ((float) (2.375 * fp + 0.44f * fr + 0.75 * fpz));
shen.setRotX((float) (0.15f * fp + 0.3f * fr + 0.3f * fpz)); shen.setRotX((float) (0.1f * fp + 0.15f * fr + 0.15f * fpz));
shen.setRotY((float) (0.1f * ClientEventHandler.recoilHorizon * fpz)); shen.setRotY((float) (0.1f * ClientEventHandler.recoilHorizon * fpz));
shen.setRotZ((float) ((0.08f + 0.1 * fr) * ClientEventHandler.recoilHorizon)); shen.setRotZ((float) ((0.08f + 0.1 * fr) * ClientEventHandler.recoilHorizon));

View file

@ -72,9 +72,9 @@ public class Glock18ItemModel extends GeoModel<Glock18Item> {
double fp = ClientEventHandler.firePos; double fp = ClientEventHandler.firePos;
double fr = ClientEventHandler.fireRot; double fr = ClientEventHandler.fireRot;
gun.setPosX(2.96f * (float) zp); gun.setPosX(1.23f * (float) zp);
gun.setPosY(2.43f * (float) zp - (float) (0.2f * zpz)); gun.setPosY(1.43f * (float) zp - (float) (0.2f * zpz));
gun.setPosZ(7f * (float) zp + (float) (0.3f * zpz)); gun.setPosZ(7f * (float) zp + (float) (0.3f * zpz));
@ -83,7 +83,7 @@ public class Glock18ItemModel extends GeoModel<Glock18Item> {
shen.setPosX((float) (0.95f * ClientEventHandler.recoilHorizon * fpz * fp)); shen.setPosX((float) (0.95f * ClientEventHandler.recoilHorizon * fpz * fp));
shen.setPosY((float) (0.25f * fp + 0.28f * fr)); shen.setPosY((float) (0.25f * fp + 0.28f * fr));
shen.setPosZ((float) (2.375 * fp + 0.44f * fr + 0.75 * fpz)); shen.setPosZ((float) (2.375 * fp + 0.44f * fr + 0.75 * fpz));
shen.setRotX((float) (0.15f * fp + 0.3f * fr + 0.3f * fpz)); shen.setRotX((float) (0.1f * fp + 0.15f * fr + 0.15f * fpz));
shen.setRotY((float) (0.1f * ClientEventHandler.recoilHorizon * fpz)); shen.setRotY((float) (0.1f * ClientEventHandler.recoilHorizon * fpz));
shen.setRotZ((float) ((0.08f + 0.1 * fr) * ClientEventHandler.recoilHorizon)); shen.setRotZ((float) ((0.08f + 0.1 * fr) * ClientEventHandler.recoilHorizon));

View file

@ -64,9 +64,9 @@ public class M1911ItemModel extends GeoModel<M1911Item> {
double fp = ClientEventHandler.firePos; double fp = ClientEventHandler.firePos;
double fr = ClientEventHandler.fireRot; double fr = ClientEventHandler.fireRot;
gun.setPosX(2.96f * (float) zp); gun.setPosX(1.23f * (float) zp);
gun.setPosY(2.53f * (float) zp - (float) (0.2f * zpz)); gun.setPosY(1.53f * (float) zp - (float) (0.2f * zpz));
gun.setPosZ(7f * (float) zp + (float) (0.3f * zpz)); gun.setPosZ(7f * (float) zp + (float) (0.3f * zpz));

View file

@ -64,8 +64,8 @@ public class Mp443ItemModel extends GeoModel<Mp443Item> {
double fp = ClientEventHandler.firePos; double fp = ClientEventHandler.firePos;
double fr = ClientEventHandler.fireRot; double fr = ClientEventHandler.fireRot;
gun.setPosX(2.96f * (float) zp); gun.setPosX(1.23f * (float) zp);
gun.setPosY(2.53f * (float) zp - (float) (0.2f * zpz)); gun.setPosY(1.53f * (float) zp - (float) (0.2f * zpz));
gun.setPosZ(7f * (float) zp + (float) (0.3f * zpz)); gun.setPosZ(7f * (float) zp + (float) (0.3f * zpz));
gun.setScaleZ(1f - (0.55f * (float) zp)); gun.setScaleZ(1f - (0.55f * (float) zp));

View file

@ -971,7 +971,7 @@ public class ClientEventHandler {
} }
fireSpread = Mth.clamp(fireSpread - 0.1 * (Math.pow(fireSpread, 2) * times), 0, 2); fireSpread = Mth.clamp(fireSpread - 0.1 * (Math.pow(fireSpread, 2) * times), 0, 2);
firePosZ = Mth.clamp(firePosZ - 1.2 * (Math.pow(firePosZ, 2) * times), 0, 1.5) * 0.98; firePosZ = Mth.clamp(firePosZ - 1.2 * (Math.pow(firePosZ, 2) * times), 0, 1.5) * 0.95;
if (0 < firePosTimer) { if (0 < firePosTimer) {
firePosTimer += 0.35 * (1.1 - firePosTimer) * times; firePosTimer += 0.35 * (1.1 - firePosTimer) * times;

View file

@ -54,6 +54,8 @@ public class ReloadMessage {
&& !GunsTool.getGunBooleanTag(stack, "Charging") && !GunsTool.getGunBooleanTag(stack, "Charging")
&& GunsTool.getGunIntTag(stack, "ReloadTime") == 0 && GunsTool.getGunIntTag(stack, "ReloadTime") == 0
&& GunsTool.getGunIntTag(stack, "BoltActionTick") == 0 && GunsTool.getGunIntTag(stack, "BoltActionTick") == 0
&& !GunsTool.getGunBooleanTag(stack, "Reloading")
) { ) {
CompoundTag tag = stack.getOrCreateTag(); CompoundTag tag = stack.getOrCreateTag();

View file

@ -33,8 +33,8 @@
}, },
"firstperson_righthand": { "firstperson_righthand": {
"translation": [ "translation": [
-6.0, -7.75,
2.5, 3.5,
-1.5 -1.5
] ]
}, },

View file

@ -33,8 +33,8 @@
}, },
"firstperson_righthand": { "firstperson_righthand": {
"translation": [ "translation": [
-6.75, -7.75,
2.75, 3.75,
-1.25 -1.25
] ]
}, },