mirror of
https://code.chipmunk.land/ChomeNS/chipmunkmod.git
synced 2025-11-13 22:16:14 +00:00
fix: more fixes to song stuff
This commit is contained in:
parent
1034518f5f
commit
b3f5e4f633
2 changed files with 8 additions and 6 deletions
|
|
@ -12,5 +12,6 @@ public class SoundSystemMixin {
|
||||||
@Inject(method = "getAdjustedPitch", at = @At("HEAD"), cancellable = true)
|
@Inject(method = "getAdjustedPitch", at = @At("HEAD"), cancellable = true)
|
||||||
private void getAdjustedPitch (SoundInstance sound, CallbackInfoReturnable<Float> cir) {
|
private void getAdjustedPitch (SoundInstance sound, CallbackInfoReturnable<Float> cir) {
|
||||||
cir.setReturnValue(sound.getPitch());
|
cir.setReturnValue(sound.getPitch());
|
||||||
|
cir.cancel();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,11 +64,12 @@ public class SongPlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
loaderThread = new SongLoaderThread(location);
|
final SongLoaderThread _loaderThread = new SongLoaderThread(location);
|
||||||
player.sendMessage(Component.translatable("Loading %s", Component.text(location.getFileName().toString(), NamedTextColor.DARK_GREEN)).color(NamedTextColor.GREEN));
|
player.sendMessage(Component.translatable("Loading %s", Component.text(location.toString(), NamedTextColor.DARK_GREEN)).color(NamedTextColor.GREEN));
|
||||||
loaderThread.start();
|
_loaderThread.start();
|
||||||
|
loaderThread = _loaderThread;
|
||||||
} catch (SongLoaderException e) {
|
} catch (SongLoaderException e) {
|
||||||
player.sendMessage(Component.translatable("Failed to load song: %s", e.message.getString()).color(NamedTextColor.RED));
|
player.sendMessage(Component.translatable("Failed to load song: %s", Component.text(e.message.getString())).color(NamedTextColor.RED));
|
||||||
loaderThread = null;
|
loaderThread = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -89,7 +90,7 @@ public class SongPlayer {
|
||||||
_loaderThread.start();
|
_loaderThread.start();
|
||||||
loaderThread = _loaderThread;
|
loaderThread = _loaderThread;
|
||||||
} catch (SongLoaderException e) {
|
} catch (SongLoaderException e) {
|
||||||
player.sendMessage(Component.translatable("Failed to load song: %s", e.message.getString()).color(NamedTextColor.RED));
|
player.sendMessage(Component.translatable("Failed to load song: %s", Component.text(e.message.getString())).color(NamedTextColor.RED));
|
||||||
loaderThread = null;
|
loaderThread = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -109,7 +110,7 @@ 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", loaderThread.exception.message.getString()).color(NamedTextColor.RED));
|
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.player.sendMessage(Component.translatable("Added %s to the song queue", Component.empty().append(loaderThread.song.name).color(NamedTextColor.DARK_GREEN)).color(NamedTextColor.GREEN));
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue