添加发射音效

This commit is contained in:
Atsuishio 2025-07-13 19:04:28 +08:00 committed by Light_Quanta
parent 4bc0dcc469
commit 889d0d67e7
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
9 changed files with 24 additions and 3 deletions

View file

@ -180,7 +180,7 @@ public class Type63Entity extends ContainerMobileVehicleEntity implements GeoEnt
public void interactEvent(Vec3 vec3) { public void interactEvent(Vec3 vec3) {
if (level() instanceof ServerLevel serverLevel) { if (level() instanceof ServerLevel serverLevel) {
interactionTick++; interactionTick++;
if (tickCount % 5 == 0) { if (tickCount % 2 == 0) {
serverLevel.playSound(null, vec3.x, vec3.y, vec3.z, ModSounds.HAND_WHEEL_ROT.get(), SoundSource.PLAYERS, 1f, random.nextFloat() * 0.1f + 0.9f); serverLevel.playSound(null, vec3.x, vec3.y, vec3.z, ModSounds.HAND_WHEEL_ROT.get(), SoundSource.PLAYERS, 1f, random.nextFloat() * 0.1f + 0.9f);
} }
} }

View file

@ -497,6 +497,7 @@ public class ModSounds {
public static final DeferredHolder<SoundEvent, SoundEvent> SM0KE_GRENADE_RELEASE = REGISTRY.register("smoke_grenade_release", () -> SoundEvent.createVariableRangeEvent(Mod.loc("smoke_grenade_release"))); public static final DeferredHolder<SoundEvent, SoundEvent> SM0KE_GRENADE_RELEASE = REGISTRY.register("smoke_grenade_release", () -> SoundEvent.createVariableRangeEvent(Mod.loc("smoke_grenade_release")));
public static final DeferredHolder<SoundEvent, SoundEvent> HAND_WHEEL_ROT = REGISTRY.register("hand_wheel_rot", () -> SoundEvent.createVariableRangeEvent(Mod.loc("hand_wheel_rot"))); public static final DeferredHolder<SoundEvent, SoundEvent> HAND_WHEEL_ROT = REGISTRY.register("hand_wheel_rot", () -> SoundEvent.createVariableRangeEvent(Mod.loc("hand_wheel_rot")));
public static final DeferredHolder<SoundEvent, SoundEvent> MEDIUM_ROCKET_FIRE = REGISTRY.register("medium_rocket_fire", () -> SoundEvent.createVariableRangeEvent(Mod.loc("medium_rocket_fire")));
} }

View file

@ -46,7 +46,7 @@ public class MediumRocketItem extends Item implements ProjectileItem {
@Override @Override
protected void playSound(BlockSource blockSource) { protected void playSound(BlockSource blockSource) {
blockSource.level().playSound(null, blockSource.pos(), ModSounds.SMALL_ROCKET_FIRE_3P.get(), SoundSource.BLOCKS, 2.0F, 1.0F); blockSource.level().playSound(null, blockSource.pos(), ModSounds.MEDIUM_ROCKET_FIRE.get(), SoundSource.BLOCKS, 2.0F, 1.0F);
} }
} }

View file

@ -49,7 +49,7 @@ public class ProjectileUtilMixin {
acc.sbw$setCurrentHitPart(obb.part()); acc.sbw$setCurrentHitPart(obb.part());
cir.setReturnValue(hitResult); cir.setReturnValue(hitResult);
if (pLevel instanceof ServerLevel serverLevel && pProjectile.getDeltaMovement().lengthSqr() > 0.01) { if (pLevel instanceof ServerLevel serverLevel && pProjectile.getDeltaMovement().lengthSqr() > 0.01 && pProjectile instanceof Projectile) {
Vec3 hitPos = hitResult.getLocation(); Vec3 hitPos = hitResult.getLocation();
pLevel.playSound(null, BlockPos.containing(hitPos), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1); pLevel.playSound(null, BlockPos.containing(hitPos), ModSounds.HIT.get(), SoundSource.PLAYERS, 1, 1);
sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), hitPos.x, hitPos.y, hitPos.z, 2, 0, 0, 0, 0.2, false); sendParticle(serverLevel, ModParticleTypes.FIRE_STAR.get(), hitPos.x, hitPos.y, hitPos.z, 2, 0, 0, 0, 0.2, false);

View file

@ -3406,5 +3406,25 @@
"stream": true "stream": true
} }
] ]
},
"medium_rocket_fire": {
"sounds": [
{
"name": "superbwarfare:type63/fire_1",
"stream": false
},
{
"name": "superbwarfare:type63/fire_2",
"stream": false
},
{
"name": "superbwarfare:type63/fire_3",
"stream": false
},
{
"name": "superbwarfare:type63/fire_4",
"stream": false
}
]
} }
} }