parent
fc57613eae
commit
1ee9f114c9
@ -35,6 +35,9 @@ public class Config implements ConfigData {
|
||||
@ConfigEntry.Gui.Tooltip(count = 4)
|
||||
public ExpectedServerVersion expectedServerVersion = ExpectedServerVersion.All;
|
||||
|
||||
@ConfigEntry.Gui.Tooltip(count = 1)
|
||||
public float delayPlaybackStartBySecs = 0.0f;
|
||||
|
||||
@ConfigEntry.Gui.Excluded
|
||||
public ArrayList<String> favorites = new ArrayList<>();
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ public class SongPlayer implements ClientTickEvents.StartWorldTick {
|
||||
private HashMap<BlockPos, Pair<Integer, Long>> notePredictions = new HashMap<>();
|
||||
public boolean didSongReachEnd = false;
|
||||
public boolean loopSong = false;
|
||||
private long pausePlaybackUntil = -1L; // Set after tuning, if configured
|
||||
|
||||
public SongPlayer() {
|
||||
Main.TICK_LISTENERS.add(this);
|
||||
@ -153,6 +154,7 @@ public class SongPlayer implements ClientTickEvents.StartWorldTick {
|
||||
last100MsSpanEstimatedPackets = 0;
|
||||
}
|
||||
if(noteBlocks != null && tuned) {
|
||||
if(pausePlaybackUntil != -1L && System.currentTimeMillis() <= pausePlaybackUntil) return;
|
||||
while (running) {
|
||||
MinecraftClient client = MinecraftClient.getInstance();
|
||||
GameMode gameMode = client.interactionManager == null ? null : client.interactionManager.getCurrentGameMode();
|
||||
@ -417,7 +419,9 @@ public class SongPlayer implements ClientTickEvents.StartWorldTick {
|
||||
// Wait roundrip + 100ms before considering tuned after changing notes (in case the server rejects an interact)
|
||||
if(lastInteractAt == -1 || System.currentTimeMillis() - lastInteractAt >= ping * 2 + 100) {
|
||||
tuned = true;
|
||||
pausePlaybackUntil = System.currentTimeMillis() + (long) (Math.abs(Main.config.delayPlaybackStartBySecs) * 1000);
|
||||
tuneInitialUntunedBlocks = -1;
|
||||
// Tuning finished
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -49,5 +49,7 @@
|
||||
"text.autoconfig.disc_jockey.option.expectedServerVersion.@Tooltip[0]": "Select the server version, you expect this mod to be used on.",
|
||||
"text.autoconfig.disc_jockey.option.expectedServerVersion.@Tooltip[1]": "This affects how reachable NoteBlocks are determined.",
|
||||
"text.autoconfig.disc_jockey.option.expectedServerVersion.@Tooltip[2]": "Selecting the wrong version could cause you not to be able to play some distant note blocks which could break/worsen playback",
|
||||
"text.autoconfig.disc_jockey.option.expectedServerVersion.@Tooltip[3]": "If you're unsure, or play on many different server versions and don't mind not reaching every possible note block, select \"All\""
|
||||
"text.autoconfig.disc_jockey.option.expectedServerVersion.@Tooltip[3]": "If you're unsure, or play on many different server versions and don't mind not reaching every possible note block, select \"All\"",
|
||||
"text.autoconfig.disc_jockey.option.delayPlaybackStartBySecs": "Delay playback by (seconds)",
|
||||
"text.autoconfig.disc_jockey.option.delayPlaybackStartBySecs.@Tooltip": "Delays playback for specified seconds, after tuning finished, if any (e.g. 0.5 for half a second delay)."
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user