修复汤姆起飞

This commit is contained in:
Atsuihsio 2025-03-06 01:07:55 +08:00
parent dbd85ae238
commit 79e047898d
4 changed files with 18 additions and 17 deletions

View file

@ -425,7 +425,7 @@ public class ClickHandler {
} }
private static void handleVehicleMove(int key, int state, Player player) { private static void handleVehicleMove(int key, int state, Player player) {
if (player.getVehicle() != null && player.getVehicle() instanceof MobileVehicleEntity && player.getVehicle().getFirstPassenger() == player) { if (player.getVehicle() instanceof MobileVehicleEntity mobileVehicle && mobileVehicle.getNthEntity(0) == player) {
var options = Minecraft.getInstance().options; var options = Minecraft.getInstance().options;
if (key == options.keyLeft.getKey().getValue()) { if (key == options.keyLeft.getKey().getValue()) {

View file

@ -190,13 +190,13 @@ public class VehicleConfig {
AH_6_MAX_ENERGY = builder.defineInRange("ah_6_max_energy", 4000000, 0, 2147483647); AH_6_MAX_ENERGY = builder.defineInRange("ah_6_max_energy", 4000000, 0, 2147483647);
builder.comment("The cannon damage of AH-6"); builder.comment("The cannon damage of AH-6");
AH_6_CANNON_DAMAGE = builder.defineInRange("ah_6_cannon_damage", 25, 1, 10000000); AH_6_CANNON_DAMAGE = builder.defineInRange("ah_6_cannon_damage", 20, 1, 10000000);
builder.comment("The rocket damage of AH-6"); builder.comment("The rocket damage of AH-6");
AH_6_ROCKET_DAMAGE = builder.defineInRange("ah_6_rocket_damage", 120, 1, 10000000); AH_6_ROCKET_DAMAGE = builder.defineInRange("ah_6_rocket_damage", 80, 1, 10000000);
builder.comment("The rocket explosion damage of AH-6"); builder.comment("The rocket explosion damage of AH-6");
AH_6_ROCKET_EXPLOSION_DAMAGE = builder.defineInRange("ah_6_rocket_explosion_damage", 60, 1, 10000000); AH_6_ROCKET_EXPLOSION_DAMAGE = builder.defineInRange("ah_6_rocket_explosion_damage", 40, 1, 10000000);
builder.comment("The rocket explosion radius of AH-6"); builder.comment("The rocket explosion radius of AH-6");
AH_6_ROCKET_EXPLOSION_RADIUS = builder.defineInRange("ah_6_rocket_explosion_radius", 5, 1, 10000000); AH_6_ROCKET_EXPLOSION_RADIUS = builder.defineInRange("ah_6_rocket_explosion_radius", 5, 1, 10000000);

View file

@ -524,8 +524,8 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
.damage(VehicleConfig.AH_6_CANNON_DAMAGE.get()) .damage(VehicleConfig.AH_6_CANNON_DAMAGE.get())
.headShot(2f) .headShot(2f)
.zoom(false) .zoom(false)
.heBullet(2) .heBullet(1)
.bypassArmorRate(0.2f); .bypassArmorRate(0.1f);
projectileRight.setPos(worldPositionRight.x, worldPositionRight.y, worldPositionRight.z); projectileRight.setPos(worldPositionRight.x, worldPositionRight.y, worldPositionRight.z);
projectileRight.shoot(player, this.getLookAngle().x, this.getLookAngle().y + 0.018, this.getLookAngle().z, 20, projectileRight.shoot(player, this.getLookAngle().x, this.getLookAngle().y + 0.018, this.getLookAngle().z, 20,
@ -543,8 +543,8 @@ public class Ah6Entity extends ContainerMobileVehicleEntity implements GeoEntity
.damage(VehicleConfig.AH_6_CANNON_DAMAGE.get()) .damage(VehicleConfig.AH_6_CANNON_DAMAGE.get())
.headShot(2f) .headShot(2f)
.zoom(false) .zoom(false)
.heBullet(2) .heBullet(1)
.bypassArmorRate(0.2f); .bypassArmorRate(0.1f);
projectileLeft.setPos(worldPositionLeft.x, worldPositionLeft.y, worldPositionLeft.z); projectileLeft.setPos(worldPositionLeft.x, worldPositionLeft.y, worldPositionLeft.z);
projectileLeft.shoot(player, this.getLookAngle().x, this.getLookAngle().y + 0.018, this.getLookAngle().z, 20, projectileLeft.shoot(player, this.getLookAngle().x, this.getLookAngle().y + 0.018, this.getLookAngle().z, 20,

View file

@ -127,8 +127,8 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
this.setDeltaMovement(this.getDeltaMovement().multiply(f, f, f)); this.setDeltaMovement(this.getDeltaMovement().multiply(f, f, f));
if (onGround()) { if (onGround()) {
setXRot(getXRot() * 0.7f); setXRot(getXRot() * 0.8f);
setZRot(getRoll() * 0.7f); setZRot(getRoll() * 0.8f);
} }
if (this.isInWater() && this.tickCount % 4 == 0) { if (this.isInWater() && this.tickCount % 4 == 0) {
@ -138,6 +138,7 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
} }
} }
this.setDeltaMovement(this.getDeltaMovement().add(0.0, 0.01, 0.0));
this.refreshDimensions(); this.refreshDimensions();
} }
@ -168,7 +169,7 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
if (forwardInputDown && getEnergy() > 0) { if (forwardInputDown && getEnergy() > 0) {
this.consumeEnergy(VehicleConfig.TOM_6_ENERGY_COST.get()); this.consumeEnergy(VehicleConfig.TOM_6_ENERGY_COST.get());
this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + (entityData.get(MELON) ? 0.003f : 0.0022f), entityData.get(MELON) ? 0.12f : 0.15f)); this.entityData.set(POWER, Math.min(this.entityData.get(POWER) + 0.03f, 0.15f));
} }
if (backInputDown || downInputDown) { if (backInputDown || downInputDown) {
@ -188,11 +189,11 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
float roll = Mth.abs(Mth.clamp(getRoll() / 60, -1.5f, 1.5f)); float roll = Mth.abs(Mth.clamp(getRoll() / 60, -1.5f, 1.5f));
float addY = Mth.clamp(Math.min((this.onGround() ? 1.5f : 0.9f) * (float) Math.max(getDeltaMovement().length() - 0.06, 0.1), 0.9f) * diffY - 0.5f * this.entityData.get(DELTA_ROT), (entityData.get(MELON) ? -2f : -3f) * (roll + 1), (entityData.get(MELON) ? 2f : 3f) * (roll + 1)); float addY = Mth.clamp(Math.min((this.onGround() ? 1.5f : 0.9f) * (float) Math.max(getDeltaMovement().length() - 0.06, 0.1), 0.9f) * diffY - 0.5f * this.entityData.get(DELTA_ROT), -3 * (roll + 1), 3 * (roll + 1));
float addX = Mth.clamp(Math.min((float) Math.max(getDeltaMovement().length() - 0.1, 0.01), 0.9f) * diffX, (entityData.get(MELON) ? -3f : -4f), (entityData.get(MELON) ? 3f : 4f)); float addX = Mth.clamp(Math.min((float) Math.max(getDeltaMovement().length() - 0.1, 0.01), 0.9f) * diffX, -4, 4);
this.setYRot(this.getYRot() + addY); this.setYRot(this.getYRot() + addY);
this.setXRot(Mth.clamp(this.getXRot() + addX, onGround() ? -10 : -120, onGround() ? 2 : 120)); this.setXRot(Mth.clamp(this.getXRot() + addX, onGround() ? -12 : -120, onGround() ? 3 : 120));
this.setZRot(this.getRoll() - this.entityData.get(DELTA_ROT) + (this.onGround() ? 0 : 0.01f) * diffY * (float) getDeltaMovement().length()); this.setZRot(this.getRoll() - this.entityData.get(DELTA_ROT) + (this.onGround() ? 0 : 0.01f) * diffY * (float) getDeltaMovement().length());
// 空格投掷西瓜炸弹 // 空格投掷西瓜炸弹
@ -217,9 +218,9 @@ public class Tom6Entity extends MobileVehicleEntity implements GeoEntity {
this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * 0.95f); this.entityData.set(DELTA_ROT, this.entityData.get(DELTA_ROT) * 0.95f);
this.setDeltaMovement(this.getDeltaMovement().add( this.setDeltaMovement(this.getDeltaMovement().add(
Mth.sin(-this.getYRot() * 0.017453292F) * (entityData.get(MELON) ? 0.16f : 0.19f) * this.entityData.get(POWER), Mth.sin(-this.getYRot() * 0.017453292F) * 0.19 * this.entityData.get(POWER),
Mth.clamp(Math.sin((onGround() ? 45 : -(getXRot() - 30)) * Mth.DEG_TO_RAD) * getDeltaMovement().horizontalDistance() * (entityData.get(MELON) ? 0.047f : 0.067f), -0.04, 0.09), Mth.clamp(Math.sin((onGround() ? 45 : -(getXRot() - 30)) * Mth.DEG_TO_RAD) * getDeltaMovement().horizontalDistance() * 0.067, -0.04, 0.09),
Mth.cos(this.getYRot() * 0.017453292F) * (entityData.get(MELON) ? 0.16f : 0.19f) * this.entityData.get(POWER) Mth.cos(this.getYRot() * 0.017453292F) * 0.19 * this.entityData.get(POWER)
)); ));
} }