提高标枪导弹的机动性

This commit is contained in:
Atsuihsio 2025-02-01 20:22:16 +08:00
parent 15621dbd09
commit 479312da26

View file

@ -211,7 +211,7 @@ public class JavelinMissileEntity extends ThrowableItemProjectile implements Geo
boolean dir = Math.sqrt(Math.pow(px - ex, 2) + Math.pow(pz - ez, 2)) < 30; boolean dir = Math.sqrt(Math.pow(px - ex, 2) + Math.pow(pz - ez, 2)) < 30;
Vec3 targetPos = new Vec3(this.entityData.get(TARGET_X), this.entityData.get(TARGET_Y) + (entity instanceof EnderDragon ? -3 : 0), this.entityData.get(TARGET_Z)); Vec3 targetPos = new Vec3(this.entityData.get(TARGET_X), this.entityData.get(TARGET_Y) + (entity instanceof EnderDragon ? -3 : 0), this.entityData.get(TARGET_Z));
if (entity != null) { if (entity != null) {
Vec3 toVec = getEyePosition().vectorTo(targetPos).normalize(); Vec3 toVec = getEyePosition().vectorTo(targetPos.add(entity.getDeltaMovement().scale(0.5))).normalize();
if (this.tickCount > 3) { if (this.tickCount > 3) {
if (entityData.get(TOP)) { if (entityData.get(TOP)) {
if (!dir) { if (!dir) {
@ -221,13 +221,13 @@ public class JavelinMissileEntity extends ThrowableItemProjectile implements Geo
} else { } else {
boolean lostTarget = this.getY() < entity.getY(); boolean lostTarget = this.getY() < entity.getY();
if (!lostTarget) { if (!lostTarget) {
setDeltaMovement(getDeltaMovement().add(toVec.scale(0.8)).scale(0.95)); setDeltaMovement(getDeltaMovement().add(toVec.scale(1)).scale(0.87));
} }
} }
} else { } else {
boolean lostTarget = (VectorTool.calculateAngle(getDeltaMovement(), toVec) > 80); boolean lostTarget = (VectorTool.calculateAngle(getDeltaMovement(), toVec) > 80);
if (!lostTarget) { if (!lostTarget) {
setDeltaMovement(getDeltaMovement().add(toVec.scale(0.8)).scale(0.9)); setDeltaMovement(getDeltaMovement().add(toVec.scale(1)).scale(0.87));
} }
} }
} }
@ -257,11 +257,11 @@ public class JavelinMissileEntity extends ThrowableItemProjectile implements Geo
} }
// 控制速度 // 控制速度
if (this.getDeltaMovement().length() < 3) { if (this.getDeltaMovement().length() < 2.6) {
this.setDeltaMovement(this.getDeltaMovement().multiply(1.06, 1.06, 1.06)); this.setDeltaMovement(this.getDeltaMovement().multiply(1.06, 1.06, 1.06));
} }
if (this.getDeltaMovement().length() > 3.3) { if (this.getDeltaMovement().length() > 2.9) {
this.setDeltaMovement(this.getDeltaMovement().multiply(0.9, 0.9, 0.9)); this.setDeltaMovement(this.getDeltaMovement().multiply(0.9, 0.9, 0.9));
} }