尝试在minecraft中播放声音会导致[client thread/warn]:无法播放未知的soundevent

wfypjpf4  于 2021-06-29  发布在  Java
关注(0)|答案(1)|浏览(244)

我有一个程序来播放声音时,正则表达式是一个无格式的消息匹配

@SubscribeEvent
    public void ChatRecieved(ClientChatReceivedEvent event) {
        String message = event.message.getUnformattedText();
        Matcher m = regex.matcher(message);
        if (m.matches()) {
            Minecraft.getMinecraft().thePlayer.playSound("BazaarAlert:sound", 1, 1);
        }
    }

但是,声音不会播放并且

[Client thread/WARN]: Unable to play unknown soundEvent: bazaaralert:sound

发送到控制台。以下是my sounds.json:

{
    "sound": {
        "category": "ambient",
        "sounds": [
            {
                "name": "sound",
                "stream": false
            }
        ]
    }
}

以下是我的项目在eclipse中的格式:

o8x7eapl

o8x7eapl1#

尝试使用资源位置: Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("your/resource/here.ogg")));

相关问题