回调音效延时

This commit is contained in:
17146 2025-05-14 15:34:26 +08:00 committed by Light_Quanta
parent 999c58e451
commit 4f301884f2
No known key found for this signature in database
GPG key ID: 11A39A1B8C890959
2 changed files with 39 additions and 38 deletions

View file

@ -0,0 +1,39 @@
package com.atsuishio.superbwarfare.client;
import com.atsuishio.superbwarfare.Mod;
import com.atsuishio.superbwarfare.entity.LoudlyEntity;
import com.atsuishio.superbwarfare.entity.vehicle.A10Entity;
import com.atsuishio.superbwarfare.entity.vehicle.Hpj11Entity;
import com.atsuishio.superbwarfare.entity.vehicle.base.MobileVehicleEntity;
import com.atsuishio.superbwarfare.entity.vehicle.base.TrackEntity;
import net.minecraft.client.Minecraft;
import net.minecraft.world.entity.Entity;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.api.distmarker.OnlyIn;
@OnlyIn(Dist.CLIENT)
public class ClientSoundHandler {
public static void playClientSoundInstance(Entity entity) {
if (entity instanceof LoudlyEntity) {
Minecraft.getInstance().getSoundManager().play(new LoudlyEntitySoundInstance.EntitySound(entity));
Minecraft.getInstance().getSoundManager().play(new LoudlyEntitySoundInstance.EntitySoundClose(entity));
} else {
Mod.queueClientWork(60, () -> {
if (entity instanceof MobileVehicleEntity mobileVehicle) {
if (mobileVehicle instanceof TrackEntity) {
Minecraft.getInstance().getSoundManager().play(new VehicleSoundInstance.TrackSound(mobileVehicle));
}
if (mobileVehicle instanceof A10Entity) {
Minecraft.getInstance().getSoundManager().play(new VehicleFireSoundInstance.A10FireSound(mobileVehicle));
}
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

@ -1,38 +0,0 @@
{
"type": "minecraft:crafting_shaped",
"category": "misc",
"pattern": [
"dbf",
"eee",
"hgh"
],
"key": {
"b": {
"item": "superbwarfare:light_armament_module"
},
"d": {
"item": "superbwarfare:large_battery_pack"
},
"e": {
"item": "superbwarfare:cemented_carbide_block"
},
"f": {
"item": "superbwarfare:heavy_armament_module"
},
"g": {
"item": "superbwarfare:large_motor"
},
"h": {
"item": "superbwarfare:track"
}
},
"result": {
"id": "superbwarfare:container",
"components": {
"minecraft:block_entity_data": {
"id": "superbwarfare:container",
"EntityType": "superbwarfare:yx_100"
}
}
}
}