添加A10引擎音效

This commit is contained in:
Atsuishio 2025-05-05 20:05:06 +08:00 committed by Light_Quanta
parent 9659628541
commit d6f4ff1507
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
9 changed files with 7247 additions and 30777 deletions

View file

@ -69,6 +69,9 @@ public class A10Renderer extends GeoEntityRenderer<A10Entity> {
if (name.equals("gear") || name.equals("gear2") || name.equals("gear3")) {
bone.setRotX(Mth.lerp(partialTick, animatable.gearRotO, animatable.getEntityData().get(GEAR_ROT)) * Mth.DEG_TO_RAD);
}
if (name.equals("qianzhou") || name.equals("qianzhou2")) {
bone.setRotZ(Mth.lerp(partialTick, animatable.propellerRotO, animatable.getPropellerRot()));
}
super.renderRecursively(poseStack, animatable, bone, renderType, bufferSource, buffer, isReRender, partialTick, packedLight, packedOverlay, color);
}
}

View file

@ -152,9 +152,6 @@ public class A10Entity extends MobileVehicleEntity implements GeoEntity {
@Override
public void travel() {
Entity passenger = this.getFirstPassenger();
// if (this.getEnergy() <= 0) return;
float diffX;
float diffY;
@ -170,9 +167,6 @@ public class A10Entity extends MobileVehicleEntity implements GeoEntity {
this.setXRot(Mth.clamp(this.getXRot() + 0.1f, -89, 89));
}
} else if (passenger instanceof Player player) {
if (level().isClientSide && this.getEnergy() > 0) {
level().playLocalSound(this.getX(), this.getY() + this.getBbHeight() * 0.5, this.getZ(), this.getEngineSound(), this.getSoundSource(), Math.min((this.forwardInputDown ? 7.5f : 5f) * 2 * Mth.abs(this.entityData.get(POWER)), 0.25f), (random.nextFloat() * 0.1f + 1.2f), false);
}
if (forwardInputDown && getEnergy() > 0) {
this.consumeEnergy(VehicleConfig.TOM_6_ENERGY_COST.get());
@ -221,6 +215,8 @@ public class A10Entity extends MobileVehicleEntity implements GeoEntity {
setFlap3Rot(diffY * 0.7f);
this.setPropellerRot(this.getPropellerRot() + 30 * this.entityData.get(POWER));
if (!onGround() && getDeltaMovement().dot(getViewVector(1)) * 72 > 150) {
flyTime = Math.min(flyTime + 1, 20);
}
@ -311,7 +307,7 @@ public class A10Entity extends MobileVehicleEntity implements GeoEntity {
@Override
public SoundEvent getEngineSound() {
return ModSounds.WHEEL_CHAIR_ENGINE.get();
return ModSounds.A_10_ENGINE.get();
}
protected void clampRotation(Entity entity) {

View file

@ -97,6 +97,14 @@ public class ClientSoundHandler {
player.level().playLocalSound(BlockPos.containing(engineSoundPos), engineSound, mobileVehicle.getSoundSource(), e.onGround() ? 0 : distanceReduce * distanceReduce, (float) ((2 * Math.random() - 1) * 0.002f + 1.05), false);
}
}
if (e instanceof A10Entity a10Entity) {
distanceReduce = (float) Math.max((1 - distance / 128), 0);
if (player.getVehicle() == a10Entity) {
player.playSound(ModSounds.A_10_ENGINE_1P.get(), 2 * (mobileVehicle.getEntityData().get(POWER) - 0.012f), (float) ((2 * Math.random() - 1) * 0.1f + 1.0f));
} else {
player.level().playLocalSound(BlockPos.containing(engineSoundPos), engineSound, mobileVehicle.getSoundSource(), 5 * (mobileVehicle.getEntityData().get(POWER) - 0.012f) * distanceReduce * distanceReduce, (float) ((2 * Math.random() - 1) * 0.1f + 1), false);
}
}
}
}

View file

@ -440,5 +440,9 @@ public class ModSounds {
public static final DeferredHolder<SoundEvent, SoundEvent> INSIDIOUS_RELOAD_EMPTY = REGISTRY.register("insidious_reload_empty", () -> SoundEvent.createVariableRangeEvent(Mod.loc("insidious_reload_empty")));
public static final DeferredHolder<SoundEvent, SoundEvent> SMOKE_FIRE = REGISTRY.register("smoke_fire", () -> SoundEvent.createVariableRangeEvent(Mod.loc("smoke_fire")));
public static final DeferredHolder<SoundEvent, SoundEvent> HPJ_11_FIRE_3P = REGISTRY.register("hpj_11_fire_3p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("hpj_11_fire_3p")));
public static final DeferredHolder<SoundEvent, SoundEvent> HPJ_11_FAR = REGISTRY.register("hpj_11_far", () -> SoundEvent.createVariableRangeEvent(Mod.loc("hpj_11_far")));
public static final DeferredHolder<SoundEvent, SoundEvent> HPJ_11_VERYFAR = REGISTRY.register("hpj_11_veryfar", () -> SoundEvent.createVariableRangeEvent(Mod.loc("hpj_11_veryfar")));
public static final DeferredHolder<SoundEvent, SoundEvent> A_10_ENGINE = REGISTRY.register("a10_engine", () -> SoundEvent.createVariableRangeEvent(Mod.loc("a10_engine")));
public static final DeferredHolder<SoundEvent, SoundEvent> A_10_ENGINE_1P = REGISTRY.register("a10_engine_1p", () -> SoundEvent.createVariableRangeEvent(Mod.loc("a10_engine_1p")));
}

File diff suppressed because it is too large Load diff

View file

@ -3051,5 +3051,35 @@
"stream": false
}
]
},
"hpj_11_far": {
"sounds": [
{
"name": "superbwarfare:hpj11/hpj_11_far",
"stream": false
}
]
},
"hpj_11_veryfar": {
"sounds": [
{
"name": "superbwarfare:hpj11/hpj_11_veryfar",
"stream": false
}
]
},
"a10_engine": {
"sounds": [
{
"name": "superbwarfare:a10/a10_engine"
}
]
},
"a10_engine_1p": {
"sounds": [
{
"name": "superbwarfare:a10/a10_engine_1p"
}
]
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 94 KiB

After

Width:  |  Height:  |  Size: 93 KiB