舰炮正确读取内容弹种,优化瞄准校准
This commit is contained in:
parent
84857daf3a
commit
8b8bbc7f0d
3 changed files with 9 additions and 15 deletions
|
@ -243,7 +243,7 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
|||
Vec3 shootPos = new Vec3(worldPosition.x, worldPosition.y, worldPosition.z);
|
||||
|
||||
try {
|
||||
double adjust = 0.004 * new Vec3(targetX, targetY, targetZ).distanceTo(shootPos);
|
||||
double adjust = -1 + 0.004 * new Vec3(targetX, targetY, targetZ).distanceTo(shootPos);
|
||||
Vec3 launchVector = calculateLaunchVector(shootPos, new Vec3(targetX, targetY - adjust, targetZ), 15, -shellGravity, isDepressed);
|
||||
this.look(new Vec3(targetX, targetY, targetZ));
|
||||
float angle = (float) -getXRotFromVector(launchVector);
|
||||
|
@ -273,7 +273,7 @@ public class Mk42Entity extends VehicleEntity implements GeoEntity, CannonEntity
|
|||
Vec3 shootPos = new Vec3(worldPosition.x, worldPosition.y, worldPosition.z);
|
||||
|
||||
try {
|
||||
double adjust = 0.004 * new Vec3(targetX, targetY, targetZ).distanceTo(shootPos);
|
||||
double adjust = -1 + 0.004 * new Vec3(targetX, targetY, targetZ).distanceTo(shootPos);
|
||||
Vec3 launchVector = calculateLaunchVector(shootPos, new Vec3(targetX, targetY - adjust, targetZ), 15, -shellGravity, isDepressed);
|
||||
this.look(new Vec3(targetX, targetY, targetZ));
|
||||
float angle = (float) -getXRotFromVector(launchVector);
|
||||
|
|
|
@ -249,7 +249,7 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
|||
Vec3 shootPos = new Vec3(worldPosition.x, worldPosition.y, worldPosition.z);
|
||||
|
||||
try {
|
||||
double adjust = 0.004 * new Vec3(targetX, targetY, targetZ).distanceTo(shootPos);
|
||||
double adjust = -1 + 0.004 * new Vec3(targetX, targetY, targetZ).distanceTo(shootPos);
|
||||
Vec3 launchVector = calculateLaunchVector(shootPos, new Vec3(targetX, targetY - adjust, targetZ), 15, -shellGravity, isDepressed);
|
||||
this.look(new Vec3(targetX, targetY, targetZ));
|
||||
float angle = (float) -getXRotFromVector(launchVector);
|
||||
|
@ -279,7 +279,7 @@ public class Mle1934Entity extends VehicleEntity implements GeoEntity, CannonEnt
|
|||
Vec3 shootPos = new Vec3(worldPosition.x, worldPosition.y, worldPosition.z);
|
||||
|
||||
try {
|
||||
double adjust = 0.004 * new Vec3(targetX, targetY, targetZ).distanceTo(shootPos);
|
||||
double adjust = -1 + 0.004 * new Vec3(targetX, targetY, targetZ).distanceTo(shootPos);
|
||||
Vec3 launchVector = calculateLaunchVector(shootPos, new Vec3(targetX, targetY - adjust, targetZ), 15, -shellGravity, isDepressed);
|
||||
this.look(new Vec3(targetX, targetY, targetZ));
|
||||
float angle = (float) -getXRotFromVector(launchVector);
|
||||
|
|
|
@ -42,29 +42,23 @@ public enum ArtilleryIndicatorFireMessage implements CustomPacketPayload {
|
|||
if (entity instanceof MortarEntity mortarEntity) {
|
||||
if (mortarEntity.stack.getItem() instanceof MortarShell && mortarEntity.getEntityData().get(FIRE_TIME) == 0) {
|
||||
int randomNumber = (int) (Math.random() * 5) + 1;
|
||||
Mod.queueServerWork(randomNumber, () -> {
|
||||
mortarEntity.fire(player);
|
||||
});
|
||||
Mod.queueServerWork(randomNumber, () -> mortarEntity.fire(player));
|
||||
}
|
||||
}
|
||||
if (entity instanceof Mk42Entity mk42Entity) {
|
||||
if (mk42Entity.stack.getItem() instanceof CannonShellItem && mk42Entity.getEntityData().get(COOL_DOWN) == 0) {
|
||||
int randomNumber = (int) (Math.random() * 5) + 1;
|
||||
var weaponType = stack.is(ModItems.AP_5_INCHES.get()) ? 0 : 1;
|
||||
var weaponType = mk42Entity.stack.is(ModItems.AP_5_INCHES.get()) ? 0 : 1;
|
||||
mk42Entity.setWeaponIndex(0, weaponType);
|
||||
Mod.queueServerWork(randomNumber, () -> {
|
||||
mk42Entity.vehicleShoot(player, 0);
|
||||
});
|
||||
Mod.queueServerWork(randomNumber, () -> mk42Entity.vehicleShoot(player, 0));
|
||||
}
|
||||
}
|
||||
if (entity instanceof Mle1934Entity mle1934Entity) {
|
||||
if (mle1934Entity.stack.getItem() instanceof CannonShellItem && mle1934Entity.getEntityData().get(COOL_DOWN) == 0) {
|
||||
int randomNumber = (int) (Math.random() * 5) + 1;
|
||||
var weaponType = stack.is(ModItems.AP_5_INCHES.get()) ? 0 : 1;
|
||||
var weaponType = mle1934Entity.stack.is(ModItems.AP_5_INCHES.get()) ? 0 : 1;
|
||||
mle1934Entity.setWeaponIndex(0, weaponType);
|
||||
Mod.queueServerWork(randomNumber, () -> {
|
||||
mle1934Entity.vehicleShoot(player, 0);
|
||||
});
|
||||
Mod.queueServerWork(randomNumber, () -> mle1934Entity.vehicleShoot(player, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue