调整重力写法
This commit is contained in:
parent
f7f0992946
commit
c4a77c088c
5 changed files with 11 additions and 9 deletions
|
@ -123,7 +123,7 @@ public class Type63InfoOverlay implements LayeredDraw.Layer {
|
|||
boolean isDepressed = parameters.isDepressed();
|
||||
|
||||
Vec3 targetPos = new Vec3(targetX, targetY, targetZ);
|
||||
Vec3 launchVector = calculateLaunchVector(type63Entity.getShootPos(partialTick), targetPos, 10, -0.05, isDepressed);
|
||||
Vec3 launchVector = calculateLaunchVector(type63Entity.getShootPos(partialTick), targetPos, 10, 0.05, isDepressed);
|
||||
|
||||
Vec3 vec3 = EntityAnchorArgument.Anchor.EYES.apply(lookingEntity);
|
||||
double d0 = (targetPos.x - vec3.x) * 0.2;
|
||||
|
|
|
@ -95,7 +95,7 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
|||
.explosionDamage(VehicleConfig.MK42_AP_EXPLOSION_DAMAGE.get())
|
||||
.explosionRadius(VehicleConfig.MK42_AP_EXPLOSION_RADIUS.get().floatValue())
|
||||
.durability(60)
|
||||
.gravity(-projectileGravity())
|
||||
.gravity(projectileGravity())
|
||||
.sound(ModSounds.CANNON_RELOAD.get())
|
||||
.icon(Mod.loc("textures/screens/vehicle_weapon/ap_shell.png")),
|
||||
new CannonShellWeapon()
|
||||
|
@ -105,7 +105,7 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
|||
.durability(1)
|
||||
.fireProbability(0.18F)
|
||||
.fireTime(2)
|
||||
.gravity(-projectileGravity())
|
||||
.gravity(projectileGravity())
|
||||
.sound(ModSounds.CANNON_RELOAD.get())
|
||||
.icon(Mod.loc("textures/screens/vehicle_weapon/he_shell.png")),
|
||||
}
|
||||
|
@ -267,7 +267,7 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
|||
|
||||
@Override
|
||||
public float projectileGravity() {
|
||||
return -0.1f;
|
||||
return 0.1f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -86,7 +86,7 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
|||
.explosionDamage(VehicleConfig.MLE1934_AP_EXPLOSION_DAMAGE.get())
|
||||
.explosionRadius(VehicleConfig.MLE1934_AP_EXPLOSION_RADIUS.get().floatValue())
|
||||
.durability(70)
|
||||
.gravity(-projectileGravity())
|
||||
.gravity(projectileGravity())
|
||||
.sound(ModSounds.CANNON_RELOAD.get())
|
||||
.icon(Mod.loc("textures/screens/vehicle_weapon/ap_shell.png")),
|
||||
new CannonShellWeapon()
|
||||
|
@ -96,7 +96,7 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
|||
.durability(1)
|
||||
.fireProbability(0.24F)
|
||||
.fireTime(5)
|
||||
.gravity(-projectileGravity())
|
||||
.gravity(projectileGravity())
|
||||
.sound(ModSounds.CANNON_RELOAD.get())
|
||||
.icon(Mod.loc("textures/screens/vehicle_weapon/he_shell.png")),
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
|||
|
||||
@Override
|
||||
public float projectileGravity() {
|
||||
return -0.1f;
|
||||
return 0.1f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -179,7 +179,7 @@ public class MortarEntity extends VehicleEntity implements GeoEntity, RemoteCont
|
|||
|
||||
@Override
|
||||
public float projectileGravity() {
|
||||
return -0.13f;
|
||||
return 0.13f;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -24,12 +24,14 @@ public class RangeTool {
|
|||
|
||||
// 谢谢DeepSeek
|
||||
@Nullable
|
||||
public static Vec3 calculateLaunchVector(Vec3 pos, Vec3 pos2, double velocity, double g, boolean isDepressed) {
|
||||
public static Vec3 calculateLaunchVector(Vec3 pos, Vec3 pos2, double velocity, double gravity, boolean isDepressed) {
|
||||
double dx = pos2.x - pos.x;
|
||||
double dy = pos2.y - pos.y;
|
||||
double dz = pos2.z - pos.z;
|
||||
double horizontalDistSq = dx * dx + dz * dz;
|
||||
|
||||
double g = -gravity;
|
||||
|
||||
double a = 0.25 * g * g;
|
||||
double b = -velocity * velocity - g * dy;
|
||||
double c = horizontalDistSq + dy * dy;
|
||||
|
|
Loading…
Add table
Reference in a new issue