Add option to disable async playback.
This commit is contained in:
parent
a219ab46b9
commit
3529607761
@ -9,6 +9,7 @@ import java.util.ArrayList;
|
||||
@me.shedaniel.autoconfig.annotation.Config.Gui.Background("textures/block/note_block.png")
|
||||
public class Config implements ConfigData {
|
||||
public boolean hideWarning;
|
||||
@ConfigEntry.Gui.Tooltip(count = 2) public boolean disableAsyncPlayback;
|
||||
@ConfigEntry.Gui.Excluded @ConfigEntry.Gui.Tooltip(count = 2) public boolean monoNoteBlocks;
|
||||
|
||||
@ConfigEntry.Gui.Excluded
|
||||
|
@ -67,6 +67,11 @@ public class SongPlayer implements ClientTickEvents.StartWorldTick {
|
||||
|
||||
public @NotNull HashMap<Instrument, Instrument> instrumentMap = new HashMap<>(); // Toy
|
||||
public synchronized void startPlaybackThread() {
|
||||
if(Main.config.disableAsyncPlayback) {
|
||||
playbackThread = null;
|
||||
return;
|
||||
}
|
||||
|
||||
this.playbackThread = new Thread(() -> {
|
||||
Thread ownThread = this.playbackThread;
|
||||
while(ownThread == this.playbackThread) {
|
||||
@ -417,6 +422,14 @@ public class SongPlayer implements ClientTickEvents.StartWorldTick {
|
||||
//client.getNetworkHandler().sendPacket(new PlayerMoveC2SPacket.LookAndOnGround(((float) (System.currentTimeMillis() % 2000)) * (360f/2000f), (1 - roughTuneProgress) * 180 - 90, true));
|
||||
client.player.swingHand(Hand.MAIN_HAND);
|
||||
}
|
||||
}else if((playbackThread == null || !playbackThread.isAlive()) && running && Main.config.disableAsyncPlayback) {
|
||||
// Sync playback (off by default). Replacement for playback thread
|
||||
try {
|
||||
tickPlayback();
|
||||
}catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,9 @@
|
||||
"disc_jockey.key_bind.open_screen": "Open song selection screen",
|
||||
"text.autoconfig.disc_jockey.title": "Disc Jockey",
|
||||
"text.autoconfig.disc_jockey.option.hideWarning": "Hide Warning",
|
||||
"text.autoconfig.disc_jockey.option.disableAsyncPlayback": "Disable Async Playback",
|
||||
"text.autoconfig.disc_jockey.option.disableAsyncPlayback.@Tooltip[0]": "Will force notes to play synchronously with client ticks instead of in a separate thread.",
|
||||
"text.autoconfig.disc_jockey.option.disableAsyncPlayback.@Tooltip[1]": "This can lead to performance loss, especially when you client has low or inconsistent fps but can fix issues when playback does not happen at all.",
|
||||
"text.autoconfig.disc_jockey.option.monoNoteBlocks": "Non-Directional Note Block Sounds",
|
||||
"text.autoconfig.disc_jockey.option.monoNoteBlocks.@Tooltip[0]": "Makes all note block sounds when playing a song non-directional, creating a more pleasurable listening experience (clientside)",
|
||||
"text.autoconfig.disc_jockey.option.monoNoteBlocks.@Tooltip[1]": "If you don't know what that means, I recommend you just try it and hear the difference"
|
||||
|
Loading…
x
Reference in New Issue
Block a user