From 27fbe9389f7f3b3558cfca6af81b895c6cf3ed03 Mon Sep 17 00:00:00 2001 From: Atsuihsio <842960157@qq.com> Date: Sun, 19 Jan 2025 18:04:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4lav150=E6=93=8D=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/vehicle/Lav150Entity.java | 15 ++++++++------- .../entity/vehicle/MobileVehicleEntity.java | 5 +++-- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java index 4730852d0..0556d6ebc 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Lav150Entity.java @@ -257,11 +257,12 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC this.setDeltaMovement(this.getDeltaMovement().add(0.0, fluidFloat, 0.0)); if (this.onGround()) { - float f0 = 0.54f + 0.25f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90 - 0.02f * Mth.abs(this.getRudderRot()); + float f0 = 0.54f + 0.25f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90; this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.05 * this.getDeltaMovement().horizontalDistance()))); this.setDeltaMovement(this.getDeltaMovement().multiply(f0, 0.85, f0)); + } else if (this.isInWater()) { - float f1 = 0.74f + 0.09f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90 - 0.01f * Mth.abs(this.getRudderRot()); + float f1 = 0.74f + 0.09f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90; this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).normalize().scale(0.04 * this.getDeltaMovement().horizontalDistance()))); this.setDeltaMovement(this.getDeltaMovement().multiply(f1, 0.85, f1)); } else { @@ -483,11 +484,11 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC } if (forwardInputDown) { - this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.015f, 0.2f)); + this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + (this.entityData.get(POWER) < 0 ? 0.012f : 0.0024f), 0.18f)); } if (backInputDown) { - this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.01f, -0.2f)); + this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - (this.entityData.get(POWER) > 0 ? 0.012f : 0.0024f), -0.13f)); } if (rightInputDown) { @@ -500,7 +501,7 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC this.extraEnergy(VehicleConfig.SPEEDBOAT_ENERGY_COST.get()); } - this.entityData.set(POWER, this.entityData.get(POWER) * 0.97f); + this.entityData.set(POWER, this.entityData.get(POWER) * (upInputDown ? 0.5f : (rightInputDown || leftInputDown) ? 0.977f : 0.99f)); this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * (float)Math.max(0.76f - 0.1f * this.getDeltaMovement().horizontalDistance(), 0.3)); float angle = (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1)); @@ -518,8 +519,8 @@ public class Lav150Entity extends ContainerMobileEntity implements GeoEntity, IC this.setRudderRot(Mth.clamp(this.getRudderRot() - this.entityData.get(DELTA_ROT), -0.8f, 0.8f) * 0.75f); if (this.isInWater() || onGround()) { - this.setYRot((float) (this.getYRot() - Math.max(12 * this.getDeltaMovement().horizontalDistance(), 0) * this.getRudderRot() * (this.entityData.get(POWER) > 0 ? 1 : -1))); - this.setDeltaMovement(this.getDeltaMovement().add(Mth.sin(-this.getYRot() * 0.017453292F) * (isInWater() && !onGround() ? 0.3f : 1) * this.entityData.get(POWER), 0.0, Mth.cos(this.getYRot() * 0.017453292F) * (isInWater() && !onGround() ? 0.3f : 1) * this.entityData.get(POWER))); + this.setYRot((float) (this.getYRot() - Math.max((isInWater() && !onGround() ? 5 : 10) * this.getDeltaMovement().horizontalDistance(), 0) * this.getRudderRot() * (this.entityData.get(POWER) > 0 ? 1 : -1))); + this.setDeltaMovement(this.getDeltaMovement().add(Mth.sin(-this.getYRot() * 0.017453292F) * (!isInWater() && !onGround() ? 0.05f : (isInWater() && !onGround() ? 0.3f : 1)) * this.entityData.get(POWER), 0.0, Mth.cos(this.getYRot() * 0.017453292F) * (!isInWater() && !onGround() ? 0.05f : (isInWater() && !onGround() ? 0.3f : 1)) * this.entityData.get(POWER))); } } diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java index 620b1d937..4d7bee35a 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/MobileVehicleEntity.java @@ -100,16 +100,17 @@ public class MobileVehicleEntity extends EnergyVehicleEntity { } collisionCoolDown = 4; crash = true; + this.entityData.set(POWER, 0.4f * entityData.get(POWER)); } } public void bounceHorizontal(Direction direction) { switch (direction.getAxis()) { case X: - this.setDeltaMovement(this.getDeltaMovement().multiply(-0.8, 0.99, 0.99)); + this.setDeltaMovement(this.getDeltaMovement().multiply(-0.4, 0.99, 0.99)); break; case Z: - this.setDeltaMovement(this.getDeltaMovement().multiply(0.99, 0.99, -0.8)); + this.setDeltaMovement(this.getDeltaMovement().multiply(0.99, 0.99, -0.4)); break; } }