From 8397b2154e3600d34ef2a623c25cfce3d2392628 Mon Sep 17 00:00:00 2001 From: Atsuihsio <842960157@qq.com> Date: Mon, 5 Aug 2024 01:06:24 +0800 Subject: [PATCH] =?UTF-8?q?=E9=99=8D=E4=BD=8E=E6=95=B4=E4=BD=93=E5=90=8E?= =?UTF-8?q?=E5=9D=90=E5=8A=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mcreator/superbwarfare/event/PlayerEventHandler.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/main/java/net/mcreator/superbwarfare/event/PlayerEventHandler.java b/src/main/java/net/mcreator/superbwarfare/event/PlayerEventHandler.java index a88c828d5..bab1422e8 100644 --- a/src/main/java/net/mcreator/superbwarfare/event/PlayerEventHandler.java +++ b/src/main/java/net/mcreator/superbwarfare/event/PlayerEventHandler.java @@ -383,8 +383,10 @@ public class PlayerEventHandler { CompoundTag tag = player.getMainHandItem().getOrCreateTag(); float recoilX = (float) tag.getDouble("recoil_x"); float recoilY = (float) tag.getDouble("recoil_y"); + float recoilPitch = 3f; + float recoilYaw = 2f; - float recoilYaw = player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).map(c -> c.recoilHorizon).orElse(0d).floatValue(); + float horizonRecoil = player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).map(c -> c.recoilHorizon).orElse(0d).floatValue(); if (tag.getBoolean("shoot")) { player.getCapability(ModVariables.PLAYER_VARIABLES_CAPABILITY, null).ifPresent(capability -> { @@ -472,11 +474,11 @@ public class PlayerEventHandler { } if (0 < recoil && recoil < 2.5) { - float newPitch = (float) (player.getXRot() - 6f * recoilY * ry * (sinRes + Mth.clamp(0.8 - recoil, 0, 0.8))); + float newPitch = (float) (player.getXRot() - recoilPitch * recoilY * ry * (sinRes + Mth.clamp(0.8 - recoil, 0, 0.8))); player.setXRot(newPitch); player.xRotO = player.getXRot(); - float newYaw = (float) (player.getYRot() - 4f * recoilYaw * recoilX * rx * sinRes); + float newYaw = (float) (player.getYRot() - recoilYaw * horizonRecoil * recoilX * rx * sinRes); player.setYRot(newYaw); player.yRotO = player.getYRot(); }