From 1ad4ea56a957973b2dfab477f3ecb9c0f51d01f5 Mon Sep 17 00:00:00 2001 From: Atsuihsio <842960157@qq.com> Date: Sun, 28 Jul 2024 20:34:38 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BB=A7=E7=BB=AD=E4=BC=98=E5=8C=96=E6=97=A0?= =?UTF-8?q?=E4=BA=BA=E6=9C=BA=E7=9A=84=E9=A3=9E=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superbwarfare/entity/DroneEntity.java | 16 ++++++++-------- .../superbwarfare/event/ClientEventHandler.java | 6 +++--- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/net/mcreator/superbwarfare/entity/DroneEntity.java b/src/main/java/net/mcreator/superbwarfare/entity/DroneEntity.java index cd8d0fc3b..7c177f097 100644 --- a/src/main/java/net/mcreator/superbwarfare/entity/DroneEntity.java +++ b/src/main/java/net/mcreator/superbwarfare/entity/DroneEntity.java @@ -190,17 +190,17 @@ public class DroneEntity extends PathfinderMob implements GeoEntity { if (this.getPersistentData().getBoolean("left")) { this.entityData.set(MOVEX,-1.5f); - this.entityData.set(ROTX,this.entityData.get(ROTX) + 0.13f); + this.entityData.set(ROTX,Mth.clamp(this.entityData.get(ROTX) + 0.05f, -0.5f, 0.5f)); } if (this.getPersistentData().getBoolean("right")) { this.entityData.set(MOVEX,1.5f); - this.entityData.set(ROTX,this.entityData.get(ROTX) - 0.13f); + this.entityData.set(ROTX,Mth.clamp(this.entityData.get(ROTX) - 0.05f, -0.5f, 0.5f)); } if (this.entityData.get(ROTX) > 0) { - this.entityData.set(ROTX, Mth.clamp(this.entityData.get(ROTX) - 0.55f * (float) Math.pow(this.entityData.get(ROTX),2), 0, 1f)); + this.entityData.set(ROTX, Mth.clamp(this.entityData.get(ROTX) - 0.025f, 0, 0.5f)); } else { - this.entityData.set(ROTX, Mth.clamp(this.entityData.get(ROTX) + 0.55f * (float) Math.pow(this.entityData.get(ROTX),2), -1f, 0)); + this.entityData.set(ROTX, Mth.clamp(this.entityData.get(ROTX) + 0.025f, -0.5f, 0)); } if (!this.getPersistentData().getBoolean("left") && !this.getPersistentData().getBoolean("right")) { @@ -214,17 +214,17 @@ public class DroneEntity extends PathfinderMob implements GeoEntity { if (this.getPersistentData().getBoolean("forward")) { this.entityData.set(MOVEZ,this.entityData.get(MOVEZ) - 0.15f); - this.entityData.set(ROTZ,this.entityData.get(ROTZ) - 0.13f); + this.entityData.set(ROTZ,Mth.clamp(this.entityData.get(ROTZ) - 0.05f, -0.5f, 0.5f)); } if (this.getPersistentData().getBoolean("backward")) { this.entityData.set(MOVEZ,this.entityData.get(MOVEZ) + 0.15f); - this.entityData.set(ROTZ,this.entityData.get(ROTZ) + 0.13f); + this.entityData.set(ROTZ,Mth.clamp(this.entityData.get(ROTZ) + 0.05f, -0.5f, 0.5f)); } if (this.entityData.get(ROTZ) > 0) { - this.entityData.set(ROTZ, Mth.clamp(this.entityData.get(ROTZ) - 0.55f * (float) Math.pow(this.entityData.get(ROTZ),2), 0, 1f)); + this.entityData.set(ROTZ, Mth.clamp(this.entityData.get(ROTZ) - 0.025f, 0, 0.5f)); } else { - this.entityData.set(ROTZ, Mth.clamp(this.entityData.get(ROTZ) + 0.55f * (float) Math.pow(this.entityData.get(ROTZ),2), -1f, 0)); + this.entityData.set(ROTZ, Mth.clamp(this.entityData.get(ROTZ) + 0.025f, -0.5f, 0)); } if (this.entityData.get(MOVEZ) >= 0) { diff --git a/src/main/java/net/mcreator/superbwarfare/event/ClientEventHandler.java b/src/main/java/net/mcreator/superbwarfare/event/ClientEventHandler.java index de87088e8..7df6290fd 100644 --- a/src/main/java/net/mcreator/superbwarfare/event/ClientEventHandler.java +++ b/src/main/java/net/mcreator/superbwarfare/event/ClientEventHandler.java @@ -52,7 +52,7 @@ public class ClientEventHandler { data.putDouble("Cannon_xRot", Mth.clamp(0.2 * xRot, -3, 3)); data.putDouble("Cannon_yRot", Mth.clamp(1 * yRot, -15, 15)); - data.putDouble("droneCameraRotX", Mth.clamp(0.5f * xRot, -10, 10)); + data.putDouble("droneCameraRotX", Mth.clamp(0.25f * xRot, -10, 10)); data.putDouble("droneCameraRotY", Mth.clamp(0.25f * yRot, -20, 10)); } @@ -104,8 +104,8 @@ public class ClientEventHandler { data.putDouble("droneRotX", Mth.clamp(data.getDouble("droneRotX") + 0.2 * Math.pow(drone.getEntityData().get(ROTX) - data.getDouble("droneRotX"), 2),Double.NEGATIVE_INFINITY,drone.getEntityData().get(ROTX))); } - event.setPitch((float) (pitch + data.getDouble("droneCameraRotX") - 0.45f * Mth.RAD_TO_DEG * data.getDouble("droneRotZ"))); - event.setRoll((float) (roll + data.getDouble("droneCameraRotY") - 0.8f * Mth.RAD_TO_DEG * data.getDouble("droneRotX"))); + event.setPitch((float) (pitch + data.getDouble("droneCameraRotX") - 0.15f * Mth.RAD_TO_DEG * data.getDouble("droneRotZ"))); + event.setRoll((float) (roll + data.getDouble("droneCameraRotY") - 0.5f * Mth.RAD_TO_DEG * data.getDouble("droneRotX"))); }