diff --git a/src/main/java/com/atsuishio/superbwarfare/block/entity/AircraftCatapultBlockEntity.java b/src/main/java/com/atsuishio/superbwarfare/block/entity/AircraftCatapultBlockEntity.java index 05581a689..5d0bb30c3 100644 --- a/src/main/java/com/atsuishio/superbwarfare/block/entity/AircraftCatapultBlockEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/block/entity/AircraftCatapultBlockEntity.java @@ -25,11 +25,13 @@ public class AircraftCatapultBlockEntity extends BlockEntity { var list = pLevel.getEntitiesOfClass(Entity.class, new AABB(pPos.above())); list.forEach(entity -> { - float rate = power / 800f; + float rate = power / 1200f; if (entity instanceof LivingEntity) { rate = power / 100f; } - entity.addDeltaMovement(new Vec3(direction.getStepX() * rate, 0, direction.getStepZ() * rate)); + if (entity.getDeltaMovement().dot(new Vec3(direction.getStepX(), 0, direction.getStepZ())) < 0.2 * power) { + entity.addDeltaMovement(new Vec3(direction.getStepX() * rate, 0, direction.getStepZ() * rate)); + } }); } diff --git a/src/main/java/com/atsuishio/superbwarfare/client/overlay/AircraftOverlay.java b/src/main/java/com/atsuishio/superbwarfare/client/overlay/AircraftOverlay.java index 57e4ab9a1..da8808ea8 100644 --- a/src/main/java/com/atsuishio/superbwarfare/client/overlay/AircraftOverlay.java +++ b/src/main/java/com/atsuishio/superbwarfare/client/overlay/AircraftOverlay.java @@ -229,7 +229,7 @@ public class AircraftOverlay implements LayeredDraw.Layer { RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO); RenderSystem.setShaderColor(1, 1, 1, 1); - preciseBlit(guiGraphics, Mod.loc("textures/screens/aircraft/hud_base2.png"), x - 72 + diffX, y - 72 + diffY, 0, 0, 144, 144, 144, 144); + preciseBlit(guiGraphics, Mod.loc("textures/screens/aircraft/hud_base2.png"), x - 72 + diffY, y - 72 + diffX, 0, 0, 144, 144, 144, 144); preciseBlit(guiGraphics, Mod.loc("textures/screens/aircraft/crosshair_ind.png"), x - 16, y - 16, 0, 0, 32, 32, 32, 32); renderKillIndicator(guiGraphics, x - 7.5f + (float) (2 * (Math.random() - 0.5f)), y - 7.5f + (float) (2 * (Math.random() - 0.5f))); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmallCannonShellEntity.java b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmallCannonShellEntity.java index 2afb25934..50b1f8037 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmallCannonShellEntity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/projectile/SmallCannonShellEntity.java @@ -118,9 +118,7 @@ public class SmallCannonShellEntity extends FastThrowableProjectile implements G vec3.y, vec3.z, explosionRadius, - this.blockInteraction != null ? this.blockInteraction : - hitEntity ? Explosion.BlockInteraction.KEEP : - (ExplosionConfig.EXPLOSION_DESTROY.get() ? Explosion.BlockInteraction.DESTROY : Explosion.BlockInteraction.KEEP) + hitEntity ? Explosion.BlockInteraction.KEEP : (ExplosionConfig.EXPLOSION_DESTROY.get() ? (this.blockInteraction != null ? this.blockInteraction : Explosion.BlockInteraction.DESTROY) : Explosion.BlockInteraction.KEEP) ).setDamageMultiplier(1.25f); explosion.explode(); EventHooks.onExplosionStart(this.level(), explosion); diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/A10Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/A10Entity.java index a695aa41e..8dd248b21 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/A10Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/A10Entity.java @@ -221,11 +221,10 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity lockingTargetO = getTargetUuid(); super.baseTick(); - float f = (float) Mth.clamp(Math.max((onGround() ? 0.805f : 0.81f) - 0.004 * getDeltaMovement().length(), 0.5) + 0.001f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90, 0.01, 0.99); + float f = (float) Mth.clamp(Math.max((onGround() ? 0.815f : 0.82f) - 0.003 * getDeltaMovement().length(), 0.5) + 0.001f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90, 0.01, 0.99); - boolean forward = Mth.abs((float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) < 90; - - this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).scale((forward ? 0.23 : -0.02) * this.getDeltaMovement().length()))); + boolean forward = getDeltaMovement().dot(getViewVector(1)) > 0; + this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).scale((forward ? 0.23 : 0.1) * getDeltaMovement().dot(getViewVector(1))))); this.setDeltaMovement(this.getDeltaMovement().multiply(f, f, f)); if (this.isInWater() && this.tickCount % 4 == 0) { @@ -517,11 +516,11 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity } else if (passenger instanceof Player) { if (getEnergy() > 0) { if (forwardInputDown) { - this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.001f, 1f)); + this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.005f, 1f)); } if (backInputDown) { - this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.001f, onGround() ? -0.04f : 0.01f)); + this.entityData.set(POWER, Math.max(this.entityData.get(POWER) - 0.004f, -0.6f)); } } @@ -535,7 +534,7 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity // 刹车 if (upInputDown) { this.entityData.set(POWER, this.entityData.get(POWER) * 0.8f); - this.setDeltaMovement(this.getDeltaMovement().multiply(0.98, 1, 0.98)); + this.setDeltaMovement(this.getDeltaMovement().multiply(0.97, 1, 0.97)); } } @@ -544,8 +543,8 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity float roll = Mth.abs(Mth.clamp(getRoll() / 60, -1.5f, 1.5f)); - float addY = Mth.clamp(Math.max((this.onGround() ? 0.1f : 0.2f) * (float) getDeltaMovement().length(), 0f) * diffY - 0.5f * this.entityData.get(DELTA_ROT), -2f * (roll + 1), 2f * (roll + 1)); - float addX = Mth.clamp(Math.min((float) Math.max(getDeltaMovement().dot(getViewVector(1)) - 0.15, 0.01), 0.7f) * diffX, -3.4f, 3.4f); + float addY = Mth.clamp(Math.max((this.onGround() ? 0.1f : 0.2f) * (float) getDeltaMovement().length(), 0f) * diffY - 0.5f * this.entityData.get(DELTA_ROT), -1.5f * (roll + 1), 1.5f * (roll + 1)); + float addX = Mth.clamp(Math.min((float) Math.max(getDeltaMovement().dot(getViewVector(1)) - 0.17, 0.01), 0.7f) * diffX, -3.5f, 3.5f); float addZ = this.entityData.get(DELTA_ROT) - (this.onGround() ? 0 : 0.01f) * diffY * (float) getDeltaMovement().dot(getViewVector(1)); float i = getXRot() / 90; @@ -600,16 +599,24 @@ public class A10Entity extends ContainerMobileVehicleEntity implements GeoEntity setDeltaMovement(getDeltaMovement().add(0, -destroyRot * 0.005, 0)); } - this.entityData.set(POWER, this.entityData.get(POWER) * 0.995f); + this.entityData.set(POWER, this.entityData.get(POWER) * 0.99f); this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * 0.95f); if (getEnergy() > 0 && !this.level().isClientSide) { this.consumeEnergy((int) (Mth.abs(this.entityData.get(POWER)) * VehicleConfig.A_10_MAX_ENERGY_COST.get())); } - this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale(Math.max((90 + this.getXRot()) / 90, 0.8) * 0.43 * this.entityData.get(POWER)))); + Matrix4f transform = getVehicleTransform(1); double flapAngle = (getFlap1LRot() + getFlap1RRot()) / 2; - setDeltaMovement(getDeltaMovement().add(0.0f, Mth.clamp(Math.sin((onGround() ? 20 + flapAngle : -(getXRot() - 20) + flapAngle) * Mth.DEG_TO_RAD) * Math.sin((90 - this.getXRot()) * Mth.DEG_TO_RAD) * getDeltaMovement().dot(getViewVector(1)) * 0.055, -0.04, 0.065), 0.0f)); + + Vector4f force0 = transformPosition(transform, 0, 0, 0); + Vector4f force1 = transformPosition(transform, 0, 1, 0); + + Vec3 force = new Vec3(force0.x, force0.y, force0.z).vectorTo(new Vec3(force1.x, force1.y, force1.z)); + + setDeltaMovement(getDeltaMovement().add(force.scale(getDeltaMovement().dot(getViewVector(1)) * 0.022 * (1 + Math.sin((onGround() ? 25 : flapAngle + 25) * Mth.DEG_TO_RAD))))); + + this.setDeltaMovement(this.getDeltaMovement().add(getViewVector(1).scale(0.05 * this.entityData.get(POWER)))); } @Override diff --git a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java index 331e98047..b25d02616 100644 --- a/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java +++ b/src/main/java/com/atsuishio/superbwarfare/entity/vehicle/Ah6Entity.java @@ -44,7 +44,6 @@ import net.neoforged.neoforge.event.EventHooks; import org.jetbrains.annotations.NotNull; import org.joml.Math; import org.joml.Matrix4f; -import org.joml.Vector3f; import org.joml.Vector4f; import software.bernie.geckolib.animatable.GeoEntity; import software.bernie.geckolib.animatable.instance.AnimatableInstanceCache; @@ -202,7 +201,7 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity this.setDeltaMovement(this.getDeltaMovement().multiply(0.8, 1, 0.8)); } else { setZRot(getRoll() * (backInputDown ? 0.9f : 0.99f)); - float f = (float) Mth.clamp(0.9f - 0.015 * getDeltaMovement().length() + 0.02f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90, 0.01, 0.99); + float f = (float) Mth.clamp(0.95f - 0.015 * getDeltaMovement().length() + 0.02f * Mth.abs(90 - (float) calculateAngle(this.getDeltaMovement(), this.getViewVector(1))) / 90, 0.01, 0.99); this.setDeltaMovement(this.getDeltaMovement().add(this.getViewVector(1).scale((this.getXRot() < 0 ? -0.035 : (this.getXRot() > 0 ? 0.035 : 0)) * this.getDeltaMovement().length()))); this.setDeltaMovement(this.getDeltaMovement().multiply(f, 0.95, f)); } @@ -357,13 +356,14 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity this.consumeEnergy((int) (VehicleConfig.AH_6_MIN_ENERGY_COST.get() + this.entityData.get(POWER) * ((VehicleConfig.AH_6_MAX_ENERGY_COST.get() - VehicleConfig.AH_6_MIN_ENERGY_COST.get()) / 0.12))); } - setDeltaMovement(getDeltaMovement().add(0.0f, Math.min(Math.sin((90 - this.getXRot()) * Mth.DEG_TO_RAD), Math.sin((90 + this.getRoll()) * Mth.DEG_TO_RAD)) * this.entityData.get(POWER), 0.0f)); + Matrix4f transform = getVehicleTransform(1); - Vector3f direction = getRightDirection().mul(-Math.sin(this.getRoll() * Mth.DEG_TO_RAD) * this.entityData.get(PROPELLER_ROT)); - setDeltaMovement(getDeltaMovement().add(new Vec3(direction.x, direction.y, direction.z).scale(3))); + Vector4f force0 = transformPosition(transform, 0, 0, 0); + Vector4f force1 = transformPosition(transform, 0, 1, 0); - Vector3f directionZ = getForwardDirection().mul(-Math.cos((this.getXRot() + 90) * Mth.DEG_TO_RAD) * this.entityData.get(PROPELLER_ROT)); - setDeltaMovement(getDeltaMovement().add(new Vec3(directionZ.x, directionZ.y, directionZ.z).scale(3))); + Vec3 force = new Vec3(force0.x, force0.y, force0.z).vectorTo(new Vec3(force1.x, force1.y, force1.z)); + + setDeltaMovement(getDeltaMovement().add(force.scale(this.entityData.get(POWER)))); if (this.entityData.get(POWER) > 0.04f) { engineStartOver = true;