mirror of
https://code.chipmunk.land/ChomeNS/chipmunkmod.git
synced 2025-11-13 21:06:16 +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 != null && !loaderThread.isAlive() && client.player != null) {
|
||||||
if (loaderThread.exception != 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 {
|
} else {
|
||||||
songQueue.add(loaderThread.song);
|
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;
|
loaderThread = null;
|
||||||
}
|
}
|
||||||
|
|
@ -120,7 +120,8 @@ public class SongPlayer {
|
||||||
if (songQueue.isEmpty()) return;
|
if (songQueue.isEmpty()) return;
|
||||||
|
|
||||||
currentSong = songQueue.poll();
|
currentSong = songQueue.poll();
|
||||||
if (client.player != null) client.player.sendMessage(
|
if (client.player != null) {
|
||||||
|
client.execute(() -> client.player.sendMessage(
|
||||||
Component
|
Component
|
||||||
.translatable(
|
.translatable(
|
||||||
"Now playing %s",
|
"Now playing %s",
|
||||||
|
|
@ -129,7 +130,8 @@ public class SongPlayer {
|
||||||
.color(NamedTextColor.DARK_GREEN)
|
.color(NamedTextColor.DARK_GREEN)
|
||||||
)
|
)
|
||||||
.color(NamedTextColor.GREEN)
|
.color(NamedTextColor.GREEN)
|
||||||
);
|
));
|
||||||
|
}
|
||||||
currentSong.play();
|
currentSong.play();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue