VoskLib
A library mod that ports VOSK to Minecraft
# 🎙️ VoskLib
VoskLib is a high-performance, offline voice recognition library for Minecraft Forge 1.20.1
To use VoskLib in your project, add it to your `build.gradle` and start listening for events.
VoskLib fires events on the Forge Event Bus. These events are already executed on the Main Thread, so you can safely interact with the player or world.
@SubscribeEvent
public void onVoiceResult(VoskVoiceEvent.Result event) {
String text = event.getResult().toLowerCase();
if (text.contains("fireball")) {
// Your logic: Summon a fireball in front of the player
}
}
@SubscribeEvent
public void onPartialSpeech(VoskVoiceEvent.Partial event) {
// Useful for real-time UI subtitles
String partial = event.getResult();
}
You can request VoskLib to start or stop listening by using:
String[] spells = {"ignite", "freeze", "thunder", "heal"};
VoskManager.createRecognition(spells); // Create Recognition for Grammar Mode (High Accuracy for specific words)
VoskManager.createRecognition(); // Create Recognition for Literal Mode (General Dictation)
VoskManager.startListening(); // Start Listening
VoskManager.stopListening(); // Stop Listening