优化手持武器走路动画的触发条件

This commit is contained in:
Atsuihsio 2024-08-29 18:26:23 +08:00
parent e815543041
commit 76e22bbcc6
2 changed files with 7 additions and 20 deletions

View file

@ -167,19 +167,6 @@ public class ClickHandler {
Player player = Minecraft.getInstance().player; Player player = Minecraft.getInstance().player;
if (player == null) return; if (player == null) return;
var options = Minecraft.getInstance().options;
var data = player.getPersistentData();
if (key == options.keyLeft.getKey().getValue()) {
data.putDouble("move_left", state);
} else if (key == options.keyRight.getKey().getValue()) {
data.putDouble("move_right", state);
} else if (key == options.keyUp.getKey().getValue()) {
data.putDouble("move_forward", state);
} else if (key == options.keyDown.getKey().getValue()) {
data.putDouble("move_backward", state);
}
handleDroneMove(key, state, player); handleDroneMove(key, state, player);
} }

View file

@ -212,7 +212,7 @@ public class ClientEventHandler {
on_ground = 0.001; on_ground = 0.001;
} }
if (data.getDouble("move_forward") == 1 && data.getDouble("firetime") == 0 && data.getDouble("zoom_time") == 0) { if (Minecraft.getInstance().options.keyUp.isDown() && data.getDouble("firetime") == 0 && data.getDouble("zoom_time") == 0) {
if (data.getDouble("gun_move_rotZ") < 0.14) { if (data.getDouble("gun_move_rotZ") < 0.14) {
data.putDouble("gun_move_rotZ", data.getDouble("gun_move_rotZ") + 0.007 * times); data.putDouble("gun_move_rotZ", data.getDouble("gun_move_rotZ") + 0.007 * times);
} }
@ -224,10 +224,10 @@ public class ClientEventHandler {
} }
} }
if ((data.getDouble("move_left") == 1 if ((Minecraft.getInstance().options.keyLeft.isDown()
|| data.getDouble("move_right") == 1 || Minecraft.getInstance().options.keyRight.isDown()
|| data.getDouble("move_forward") == 1 || Minecraft.getInstance().options.keyUp.isDown()
|| data.getDouble("move_backward") == 1) && data.getDouble("firetime") == 0) { || Minecraft.getInstance().options.keyDown.isDown()) && data.getDouble("firetime") == 0) {
if (data.getDouble("gun_moveY_time") < 1.25) { if (data.getDouble("gun_moveY_time") < 1.25) {
data.putDouble("gun_moveY_time", data.getDouble("gun_moveY_time") + 1.2 * on_ground * times * move_speed); data.putDouble("gun_moveY_time", data.getDouble("gun_moveY_time") + 1.2 * on_ground * times * move_speed);
@ -279,11 +279,11 @@ public class ClientEventHandler {
data.putDouble("move", ((data.getDouble("move") - 1 * times * Math.pow(data.getDouble("move"), 2) * (1 - 0.6 * data.getDouble("zoom_time"))) data.putDouble("move", ((data.getDouble("move") - 1 * times * Math.pow(data.getDouble("move"), 2) * (1 - 0.6 * data.getDouble("zoom_time")))
* (1 - 1 * data.getDouble("zoom_time")))); * (1 - 1 * data.getDouble("zoom_time"))));
} }
if (data.getDouble("move_right") == 1) { if (Minecraft.getInstance().options.keyRight.isDown()) {
data.putDouble("move", data.putDouble("move",
((data.getDouble("move") + Math.pow(Math.abs(data.getDouble("move")) + 0.05, 2) * 0.2 * times * (1 - 0.1 * data.getDouble("zoom_time"))) ((data.getDouble("move") + Math.pow(Math.abs(data.getDouble("move")) + 0.05, 2) * 0.2 * times * (1 - 0.1 * data.getDouble("zoom_time")))
* (1 - 0.1 * data.getDouble("zoom_time")))); * (1 - 0.1 * data.getDouble("zoom_time"))));
} else if (data.getDouble("move_left") == 1) { } else if (Minecraft.getInstance().options.keyLeft.isDown()) {
data.putDouble("move", data.putDouble("move",
((data.getDouble("move") - Math.pow(Math.abs(data.getDouble("move")) + 0.05, 2) * 0.2 * times * (1 - 0.1 * data.getDouble("zoom_time"))) ((data.getDouble("move") - Math.pow(Math.abs(data.getDouble("move")) + 0.05, 2) * 0.2 * times * (1 - 0.1 * data.getDouble("zoom_time")))
* (1 - 0.1 * data.getDouble("zoom_time")))); * (1 - 0.1 * data.getDouble("zoom_time"))));