尝试添加载具涉水音效

This commit is contained in:
17146 2025-05-24 17:04:39 +08:00 committed by Light_Quanta
parent 6326c7fe99
commit e4bd8e5b00
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
3 changed files with 7 additions and 5 deletions

View file

@ -128,6 +128,7 @@ public class Mod {
MobileVehicleEntity.trackSound = vehicle -> Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.TrackSound(vehicle));
MobileVehicleEntity.engineSound = vehicle -> Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.EngineSound(vehicle));
MobileVehicleEntity.swimSound = vehicle -> Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.SwimSound(vehicle));
}
}

View file

@ -25,8 +25,6 @@ public class ClientSoundHandler {
// if (mobileVehicle instanceof Hpj11Entity) {
// Minecraft.getInstance().getSoundManager().play(new VehicleFireSoundInstance.HPJ11CloseFireSound(mobileVehicle));
// }
// Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.EngineSound(mobileVehicle, mobileVehicle.getEngineSound()));
// Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.SwimSound(mobileVehicle));
// }
// });
}

View file

@ -55,6 +55,8 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
};
public static Consumer<MobileVehicleEntity> engineSound = vehicle -> {
};
public static Consumer<MobileVehicleEntity> swimSound = vehicle -> {
};
public static final EntityDataAccessor<Integer> CANNON_RECOIL_TIME = SynchedEntityData.defineId(MobileVehicleEntity.class, EntityDataSerializers.INT);
@ -176,6 +178,7 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
public void baseTick() {
if (!this.wasEngineRunning && this.engineRunning() && this.level().isClientSide()) {
engineSound.accept(this);
swimSound.accept(this);
if (this.hasTracks()) {
trackSound.accept(this);
}
@ -365,9 +368,9 @@ public abstract class MobileVehicleEntity extends EnergyVehicleEntity implements
Vec3 p3 = new Vec3(positionLB.x, positionLB.y, positionLB.z);
Vec3 p4 = new Vec3(positionRB.x, positionRB.y, positionRB.z);
if (mainSupportingBlockPos.isPresent()) {
BlockPos blockpos = this.mainSupportingBlockPos.get();
}
// if (mainSupportingBlockPos.isPresent()) {
// BlockPos blockpos = this.mainSupportingBlockPos.get();
// }
// 确定点位是否在墙里来调整点位高度
float p1y = (float) this.traceBlockY(p1, 3);