优化瞄准动画

This commit is contained in:
Atsuihsio 2024-06-01 23:47:12 +08:00
parent cbce62c0ee
commit 6aa80c7f0b
3 changed files with 4 additions and 4 deletions

View file

@ -88,7 +88,7 @@ public class CrossHairOverlay {
if (player == null) return false; if (player == null) return false;
if (player.isSpectator()) return false; if (player.isSpectator()) return false;
if (!player.getMainHandItem().is(TargetModTags.Items.GUN) || !(player.getPersistentData().getDouble("zoom_animation_time") < 4)) if (!player.getMainHandItem().is(TargetModTags.Items.GUN) || !(player.getPersistentData().getDouble("zoom_animation_time") < 6))
return false; return false;
return !(player.getMainHandItem().getItem() == TargetModItems.M_79.get()) return !(player.getMainHandItem().getItem() == TargetModItems.M_79.get())

View file

@ -342,13 +342,13 @@ public class ClientEventHandler {
if ((entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) { if ((entity.getCapability(TargetModVariables.PLAYER_VARIABLES_CAPABILITY, null).orElse(new TargetModVariables.PlayerVariables())).zooming) {
if (data.getDouble("zoom_time") < 1) { if (data.getDouble("zoom_time") < 1) {
data.putDouble("zoom_time", data.putDouble("zoom_time",
(data.getDouble("zoom_time") + entity.getMainHandItem().getOrCreateTag().getDouble("zoom_speed") * 0.03 * times)); (data.getDouble("zoom_time") + entity.getMainHandItem().getOrCreateTag().getDouble("zoom_speed") * 0.02 * times));
} else { } else {
data.putDouble("zoom_time", 1); data.putDouble("zoom_time", 1);
} }
} else { } else {
if (data.getDouble("zoom_time") > 0) { if (data.getDouble("zoom_time") > 0) {
data.putDouble("zoom_time", (data.getDouble("zoom_time") - 0.04 * times)); data.putDouble("zoom_time", (data.getDouble("zoom_time") - 0.02 * times));
} else { } else {
data.putDouble("zoom_time", 0); data.putDouble("zoom_time", 0);
} }

View file

@ -190,7 +190,7 @@ public class PlayerEventHandler {
}); });
if (player.getPersistentData().getInt("zoom_animation_time") < 10) { if (player.getPersistentData().getInt("zoom_animation_time") < 10) {
player.getPersistentData().putInt("zoom_animation_time", player.getPersistentData().getInt("zoom_animation_time") + 2); player.getPersistentData().putInt("zoom_animation_time", player.getPersistentData().getInt("zoom_animation_time") + 1);
} }
} else { } else {
player.getPersistentData().putInt("zoom_animation_time", 0); player.getPersistentData().putInt("zoom_animation_time", 0);