加大迫击炮重力和初速
This commit is contained in:
parent
e6093a6dee
commit
6303a8ec75
3 changed files with 5 additions and 6 deletions
|
@ -12,9 +12,9 @@ public class RangeHelper {
|
|||
* @param thetaDegrees 发射角度(以度为单位),需要根据实际情况修改
|
||||
*/
|
||||
public static double getRange(double thetaDegrees) {
|
||||
double initialVelocity = 8; // 初始速度 8 m/s
|
||||
double initialVelocity = 11.4; // 初始速度 11.4 m/s
|
||||
double thetaRadians = Math.toRadians(thetaDegrees); // 将角度转换为弧度
|
||||
double gravity = 0.05; // 重力加速度
|
||||
double gravity = 0.146; // 重力加速度
|
||||
double velocityDecay = 0.99; // 速度衰减系数
|
||||
|
||||
// 计算射程
|
||||
|
|
|
@ -164,7 +164,7 @@ public class MortarEntity extends Entity implements GeoEntity, AnimatedEntity {
|
|||
if (level instanceof ServerLevel server) {
|
||||
MortarShellEntity entityToSpawn = new MortarShellEntity(player, level);
|
||||
entityToSpawn.setPos(this.getX(), this.getEyeY(), this.getZ());
|
||||
entityToSpawn.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 8f, (float) 0.3);
|
||||
entityToSpawn.shoot(this.getLookAngle().x, this.getLookAngle().y, this.getLookAngle().z, 11.4f, (float) 0.1);
|
||||
level.addFreshEntity(entityToSpawn);
|
||||
server.sendParticles(ParticleTypes.CAMPFIRE_COSY_SMOKE, (this.getX() + 3 * this.getLookAngle().x), (this.getY() + 0.1 + 3 * this.getLookAngle().y), (this.getZ() + 3 * this.getLookAngle().z), 8, 0.4, 0.4, 0.4,
|
||||
0.007);
|
||||
|
@ -212,7 +212,7 @@ public class MortarEntity extends Entity implements GeoEntity, AnimatedEntity {
|
|||
this.look(EntityAnchorArgument.Anchor.EYES, new Vec3(targetX, targetY, targetZ));
|
||||
|
||||
double[] angles = new double[2];
|
||||
boolean flag = RangeHelper.canReachTarget(8, 0.05, 0.99,
|
||||
boolean flag = RangeHelper.canReachTarget(11, 0.146, 0.99,
|
||||
new BlockPos((int) this.getX(), (int) this.getEyeY(), (int) this.getZ()),
|
||||
new BlockPos(targetX, targetY, targetZ),
|
||||
angles);
|
||||
|
|
|
@ -19,7 +19,6 @@ import net.minecraft.world.entity.EntityType;
|
|||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.projectile.ThrowableItemProjectile;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.BellBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
@ -179,7 +178,7 @@ public class MortarShellEntity extends ThrowableItemProjectile implements GeoEnt
|
|||
|
||||
@Override
|
||||
protected float getGravity() {
|
||||
return 0.05F;
|
||||
return 0.146F;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue