调整1130开火逻辑

This commit is contained in:
Atsuishio 2025-04-30 21:54:20 +08:00 committed by Light_Quanta
parent 294cc6ab00
commit a7f5d8f36a
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
4 changed files with 15 additions and 5 deletions

View file

@ -175,7 +175,7 @@ public class SmallCannonShellEntity extends FastThrowableProjectile implements G
.getEntities(this, .getEntities(this,
this.getBoundingBox() this.getBoundingBox()
.expandTowards(this.getDeltaMovement()) .expandTowards(this.getDeltaMovement())
.inflate(0.5) .inflate(0.75)
); );
for (Entity entity : entities) { for (Entity entity : entities) {

View file

@ -229,6 +229,12 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
this.setDeltaMovement(this.getDeltaMovement().add(0.0, -0.04, 0.0)); this.setDeltaMovement(this.getDeltaMovement().add(0.0, -0.04, 0.0));
} }
if (this.getFirstPassenger() instanceof Player player && fireInputDown) {
if ((this.entityData.get(AMMO) > 0 || InventoryTool.hasCreativeAmmoBox(player)) && !cannotFire) {
vehicleShoot(player, 0);
}
}
this.entityData.set(GUN_ROTATE, this.entityData.get(GUN_ROTATE) * 0.8f); this.entityData.set(GUN_ROTATE, this.entityData.get(GUN_ROTATE) * 0.8f);
setGunRot(getGunRot() + entityData.get(GUN_ROTATE)); setGunRot(getGunRot() + entityData.get(GUN_ROTATE));
@ -307,9 +313,7 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
if (target.distanceTo(this) <= 144 && VectorTool.calculateAngle(getViewVector(1), targetVec) < 10) { if (target.distanceTo(this) <= 144 && VectorTool.calculateAngle(getViewVector(1), targetVec) < 10) {
if (checkNoClip(target, barrelRootPos) && entityData.get(AMMO) > 0) { if (checkNoClip(target, barrelRootPos) && entityData.get(AMMO) > 0) {
vehicleShoot(player, 0); vehicleShoot(player, 0);
findEntityOnPath(barrelRootPos, targetVec); findEntityOnPath(barrelRootPos, targetVec);
} else { } else {
changeTargetTimer++; changeTargetTimer++;
} }
@ -550,12 +554,12 @@ public class Hpj11Entity extends ContainerMobileVehicleEntity implements GeoEnti
@Override @Override
public int mainGunRpm(Player player) { public int mainGunRpm(Player player) {
return 1200; return 0;
} }
@Override @Override
public boolean canShoot(Player player) { public boolean canShoot(Player player) {
return (this.entityData.get(AMMO) > 0 || InventoryTool.hasCreativeAmmoBox(player)) && !cannotFire; return false;
} }
@Override @Override

View file

@ -71,6 +71,7 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
public boolean upInputDown; public boolean upInputDown;
public boolean downInputDown; public boolean downInputDown;
public boolean decoyInputDown; public boolean decoyInputDown;
public boolean fireInputDown;
public double lastTickSpeed; public double lastTickSpeed;
public double lastTickVerticalSpeed; public double lastTickVerticalSpeed;
public int collisionCoolDown; public int collisionCoolDown;
@ -135,6 +136,8 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
= (keys & 0b0100000) > 0; = (keys & 0b0100000) > 0;
decoyInputDown decoyInputDown
= (keys & 0b1000000) > 0; = (keys & 0b1000000) > 0;
fireInputDown
= (keys & 0b1000001) > 0;
} }
@Override @Override

View file

@ -270,6 +270,9 @@ public class ClientEventHandler {
if (ModKeyMappings.RELEASE_DECOY.isDown()) { if (ModKeyMappings.RELEASE_DECOY.isDown()) {
keys |= 0b1000000; keys |= 0b1000000;
} }
if (holdFireVehicle) {
keys |= 0b1000001;
}
} }
if (keys != keysCache) { if (keys != keysCache) {