Support latest version of SimpleVoiceChat

This commit is contained in:
Moulberry committed 2024-12-18 17:54:35 -05:00
1 parent 1e1393f2c6
commit 809c4df917
2 files changed
+8 -4

No files matched your search

@@ -1,18 +1,17 @@
package com.moulberry.flashback.compat.simple_voice_chat;
import com.moulberry.flashback.action.ActionLevelChunkCached;
import com.moulberry.flashback.action.ActionRegistry;
import de.maxhenkel.voicechat.api.VoicechatApi;
import de.maxhenkel.voicechat.api.VoicechatClientApi;
import de.maxhenkel.voicechat.api.VoicechatPlugin;
import de.maxhenkel.voicechat.api.events.ClientReceiveSoundEvent;
import de.maxhenkel.voicechat.api.events.ClientSoundEvent;
import de.maxhenkel.voicechat.api.events.ClientVoicechatInitializationEvent;
import de.maxhenkel.voicechat.api.events.EventRegistration;
import de.maxhenkel.voicechat.plugins.impl.VoicechatClientApiImpl;
public class SimpleVoiceChatPlugin implements VoicechatPlugin {
public static VoicechatClientApi CLIENT_API = VoicechatClientApiImpl.instance();
public static VoicechatClientApi CLIENT_API;
@Override
public String getPluginId() {
@@ -26,9 +25,14 @@ public class SimpleVoiceChatPlugin implements VoicechatPlugin {
@Override
public void registerEvents(EventRegistration registration) {
registration.registerEvent(ClientVoicechatInitializationEvent.class, this::onClientInitialized);
registration.registerEvent(ClientReceiveSoundEvent.EntitySound.class, SimpleVoiceChatRecorder::onReceiveEntitySound);
registration.registerEvent(ClientReceiveSoundEvent.LocationalSound.class, SimpleVoiceChatRecorder::onReceiveLocationalSound);
registration.registerEvent(ClientReceiveSoundEvent.StaticSound.class, SimpleVoiceChatRecorder::onReceiveStaticSound);
registration.registerEvent(ClientSoundEvent.class, SimpleVoiceChatRecorder::onSendSound);
}
private void onClientInitialized(ClientVoicechatInitializationEvent event) {
CLIENT_API = event.getVoicechat();
}
}