From bfb9ca04cfd5cc6e27a0e3900d7a002459ebc3df Mon Sep 17 00:00:00 2001 From: Atsuishio <842960157@qq.com> Date: Mon, 23 Jun 2025 10:15:33 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A0=94=E7=A9=B6=E5=87=BA=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E5=90=91=E9=87=8F=E8=A7=A3=E7=AE=97=E6=AD=A6=E5=99=A8=E7=AB=99?= =?UTF-8?q?=E8=A7=92=E5=BA=A6=E7=9A=84=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../superbwarfare/entity/vehicle/Yx100Entity.java | 12 ++++++++++++ .../entity/vehicle/base/VehicleEntity.java | 12 +++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java index 4fbd2614a..92f85fb38 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Yx100Entity.java @@ -333,6 +333,18 @@ public class Yx100Entity extends ContainerMobileVehicleEntity implements GeoEnti this.refreshDimensions(); } +// public void autoAimTest() { +// Entity target = EntityFindUtil.findEntity(level(), entityData.get(LAST_ATTACKER_UUID)); +// if (target != null) { +// Matrix4f transform = getGunTransform(1); +// Vector4f worldPosition = transformPosition(transform, 0, -0.25f, 0); +// Vec3 shootVec = new Vec3(getGunnerVector(1).x, getGunnerVector(1).y + 0.01f, getGunnerVector(1).z); +// Vec3 shootPos = new Vec3(worldPosition.x, worldPosition.y, worldPosition.z); +// Vec3 targetVec = shootPos.vectorTo(target.getBoundingBox().getCenter()); +// passengerWeaponAutoAimFormVector(15, 15 , -10, 45, shootVec, targetVec); +// } +// } + @Override public void terrainCompact(float w, float l) { if (onGround()) { diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java index e26b271b0..2d50f7bd5 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/base/VehicleEntity.java @@ -889,7 +889,7 @@ public abstract class VehicleEntity extends Entity { } } - public void autoAimFormVector(float ySpeed, float xSpeed, float minXAngle, float maxXAngle, Vec3 shootVec, Vec3 targetVec) { + public void turretAutoAimFormVector(float ySpeed, float xSpeed, float minXAngle, float maxXAngle, Vec3 shootVec, Vec3 targetVec) { float diffY = (float) Mth.wrapDegrees(-getYRotFromVector(targetVec) + getYRotFromVector(shootVec)); float diffX = (float) Mth.wrapDegrees(-getXRotFromVector(targetVec) + getXRotFromVector(shootVec)); @@ -908,6 +908,16 @@ public abstract class VehicleEntity extends Entity { turretYRotLock = Mth.clamp(0.9f * diffY, min, max); } + public void passengerWeaponAutoAimFormVector(float ySpeed, float xSpeed, float minXAngle, float maxXAngle, Vec3 shootVec, Vec3 targetVec) { + float diffY = (float) Mth.wrapDegrees(-getYRotFromVector(targetVec) + getYRotFromVector(shootVec)); + float diffX = (float) Mth.wrapDegrees(-getXRotFromVector(targetVec) + getXRotFromVector(shootVec)); + + turretTurnSound(diffX, diffY, 0.95f); + + this.setGunXRot(Mth.clamp(this.getGunXRot() + Mth.clamp(0.5f * diffX, -xSpeed, xSpeed), -maxXAngle, -minXAngle)); + this.setGunYRot(this.getGunYRot() - Mth.clamp(0.5f * diffY, -ySpeed, ySpeed)); + } + public void gunnerAngle(float ySpeed, float xSpeed) { Entity gunner = this.getNthEntity(1);