mirror of
https://code.chipmunk.land/ChomeNS/chipmunkmod.git
synced 2025-11-13 18:46:15 +00:00
fix: java.lang.IllegalStateException: Rendersystem called from wrong thread SongPlayer
This commit is contained in:
parent
5e1e7591e7
commit
7675aae619
1 changed files with 14 additions and 12 deletions
|
|
@ -108,10 +108,10 @@ public class SongPlayer {
|
|||
|
||||
if (loaderThread != null && !loaderThread.isAlive() && client.player != null) {
|
||||
if (loaderThread.exception != null) {
|
||||
client.player.sendMessage(Component.translatable("Failed to load song: %s", Component.text(loaderThread.exception.message.getString())).color(NamedTextColor.RED));
|
||||
client.execute(() -> client.player.sendMessage(Component.translatable("Failed to load song: %s", Component.text(loaderThread.exception.message.getString())).color(NamedTextColor.RED)));
|
||||
} else {
|
||||
songQueue.add(loaderThread.song);
|
||||
client.player.sendMessage(Component.translatable("Added %s to the song queue", Component.empty().append(loaderThread.song.name).color(NamedTextColor.DARK_GREEN)).color(NamedTextColor.GREEN));
|
||||
client.execute(() -> client.player.sendMessage(Component.translatable("Added %s to the song queue", Component.empty().append(loaderThread.song.name).color(NamedTextColor.DARK_GREEN)).color(NamedTextColor.GREEN)));
|
||||
}
|
||||
loaderThread = null;
|
||||
}
|
||||
|
|
@ -120,16 +120,18 @@ public class SongPlayer {
|
|||
if (songQueue.isEmpty()) return;
|
||||
|
||||
currentSong = songQueue.poll();
|
||||
if (client.player != null) client.player.sendMessage(
|
||||
Component
|
||||
.translatable(
|
||||
"Now playing %s",
|
||||
Component.empty()
|
||||
.append(currentSong.name)
|
||||
.color(NamedTextColor.DARK_GREEN)
|
||||
)
|
||||
.color(NamedTextColor.GREEN)
|
||||
);
|
||||
if (client.player != null) {
|
||||
client.execute(() -> client.player.sendMessage(
|
||||
Component
|
||||
.translatable(
|
||||
"Now playing %s",
|
||||
Component.empty()
|
||||
.append(currentSong.name)
|
||||
.color(NamedTextColor.DARK_GREEN)
|
||||
)
|
||||
.color(NamedTextColor.GREEN)
|
||||
));
|
||||
}
|
||||
currentSong.play();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue