又一点点小更新

This commit is contained in:
BRanulf 2025-04-25 22:17:30 +08:00
parent dfa80c8e47
commit f3586dce44
3 changed files with 38 additions and 3 deletions

View File

@ -41,6 +41,8 @@ public class Main implements ClientModInitializer {
public static KeyBinding nextSongKeyBind;
// public static KeyBinding prevSongKeyBind;
static KeyBinding playStopKeyBind;
public static KeyBinding reloadKeyBind;
private static long lastNextSongPress = 0;
public MinecraftClient client;
@ -74,6 +76,22 @@ public class Main implements ClientModInitializer {
// "key.category."+MOD_ID
// ));
// 停止
playStopKeyBind = KeyBindingHelper.registerKeyBinding(new KeyBinding(
MOD_ID+".key_bind.play_stop",
InputUtil.Type.KEYSYM,
InputUtil.UNKNOWN_KEY.getCode(), // Default unbound
"key.category."+MOD_ID
));
// 重载
reloadKeyBind = KeyBindingHelper.registerKeyBinding(new KeyBinding(
MOD_ID+".key_bind.reload",
InputUtil.Type.KEYSYM,
InputUtil.UNKNOWN_KEY.getCode(), // Default unbound
"key.category."+MOD_ID
));
ClientTickEvents.START_CLIENT_TICK.register(new ClientTickEvents.StartTick() {
private ClientWorld prevWorld;
@ -94,11 +112,24 @@ public class Main implements ClientModInitializer {
}
}
if (nextSongKeyBind.wasPressed()) {
SONG_PLAYER.playNextSong();
if (SONG_PLAYER.running) {
SONG_PLAYER.playNextSong();
}
}
// if (prevSongKeyBind.wasPressed()) {
// SONG_PLAYER.playPreviousSong();
// }
if (playStopKeyBind.wasPressed()) {
if (SONG_PLAYER.running) {
SONG_PLAYER.stop();
}
}
if (reloadKeyBind.wasPressed()) {
SongLoader.loadSongs();
if (client.currentScreen instanceof DiscJockeyScreen) {
client.setScreen(new DiscJockeyScreen());
}
}
}
});

View File

@ -69,5 +69,7 @@
"text.autoconfig.disc_jockey_revive.option.errorHandlingMode": "Error Handling",
"text.autoconfig.disc_jockey_revive.option.errorHandlingMode.@Tooltip": "What to do when errors occur",
"disc_jockey_revive.config.error_handling.stop": "Stop Playback",
"disc_jockey_revive.config.error_handling.next": "Play Next Song"
"disc_jockey_revive.config.error_handling.next": "Play Next Song",
"disc_jockey_revive.key_bind.play_stop": "Play/Stop",
"disc_jockey_revive.key_bind.reload": "Reload"
}

View File

@ -68,5 +68,7 @@
"text.autoconfig.disc_jockey_revive.option.errorHandlingMode": "错误处理",
"text.autoconfig.disc_jockey_revive.option.errorHandlingMode.@Tooltip": "播放错误时的处理方式",
"disc_jockey_revive.config.error_handling.stop": "停止播放",
"disc_jockey_revive.config.error_handling.next": "播放下一首"
"disc_jockey_revive.config.error_handling.next": "播放下一首",
"disc_jockey_revive.key_bind.play_stop": "播放/停止",
"disc_jockey_revive.key_bind.reload": "重新加载"
}