修复切换武器漏弹壳的bug
This commit is contained in:
parent
ad0a3f6e03
commit
32efb2cf6b
1 changed files with 15 additions and 7 deletions
|
@ -507,11 +507,11 @@ public class ClientEventHandler {
|
|||
fireRecoilTime = time;
|
||||
shellIndex++;
|
||||
|
||||
shellIndexTime[shellIndex] = 0;
|
||||
shellIndexTime[shellIndex] = 0.001;
|
||||
|
||||
randomShell[0] = (1 + 2 * Math.random());
|
||||
randomShell[1] = (1 + 2 * Math.random());
|
||||
randomShell[2] = (1 + 2 * Math.random());
|
||||
randomShell[0] = (1 + 2.5 * Math.random());
|
||||
randomShell[1] = (0.2 * Math.random());
|
||||
randomShell[2] = (0.7 * Math.random());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -576,12 +576,17 @@ public class ClientEventHandler {
|
|||
|
||||
float times = Minecraft.getInstance().getDeltaFrameTime();
|
||||
|
||||
shellIndex %= 5;
|
||||
if (shellIndex >= 5) {
|
||||
shellIndex = 0;
|
||||
shellIndexTime[0] = 0.001;
|
||||
}
|
||||
|
||||
for (int i = 0; i < 5; i++) {
|
||||
if (shellIndexTime[i] > 0) {
|
||||
shellIndexTime[i] = Math.min(shellIndexTime[i] + 6 * times * ((50 - shellIndexTime[i]) / 50), 50);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void handleGunRecoil() {
|
||||
Player player = Minecraft.getInstance().player;
|
||||
|
@ -825,6 +830,9 @@ public class ClientEventHandler {
|
|||
) {
|
||||
if (newStack.getItem() instanceof GunItem) {
|
||||
drawTime = 1;
|
||||
for (int i = 0; i < 5; i++) {
|
||||
shellIndexTime[i] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -852,7 +860,7 @@ public class ClientEventHandler {
|
|||
if (i >= 5) break;
|
||||
|
||||
shells[i].setPosX((float) (-x * shellIndexTime[i]));
|
||||
shells[i].setPosY((float) (randomShell[0] * y * Math.sin(0.15 * shellIndexTime[i])));
|
||||
shells[i].setPosY((float) (randomShell[0] * y * Math.sin(0.18 * shellIndexTime[i])));
|
||||
shells[i].setRotX((float) (randomShell[1] * shellIndexTime[i]));
|
||||
shells[i].setRotY((float) (randomShell[2] * shellIndexTime[i]));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue