From 753c096308a3bc7ebb9eb33df8dab87e043f0381 Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Tue, 6 Jun 2023 20:29:16 +0700 Subject: [PATCH] fix text + component = fard in goto --- .../land/chipmunk/chipmunkmod/modules/SongPlayer.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/main/java/land/chipmunk/chipmunkmod/modules/SongPlayer.java b/src/main/java/land/chipmunk/chipmunkmod/modules/SongPlayer.java index 7961201..be7cade 100644 --- a/src/main/java/land/chipmunk/chipmunkmod/modules/SongPlayer.java +++ b/src/main/java/land/chipmunk/chipmunkmod/modules/SongPlayer.java @@ -15,6 +15,7 @@ import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.ClientPlayerEntity; import net.minecraft.sound.SoundCategory; import net.minecraft.sound.SoundEvent; +import net.minecraft.text.Text; import net.minecraft.util.Identifier; import java.io.File; @@ -153,7 +154,7 @@ public class SongPlayer { .append(Component.translatable(" | ", NamedTextColor.DARK_GRAY)) .append(Component.translatable("Now playing %s", Component.empty().append(currentSong.name).color(NamedTextColor.DARK_GREEN)).color(NamedTextColor.GREEN)) .append(Component.translatable(" | ", NamedTextColor.DARK_GRAY)) - .append(Component.translatable("%s / %s", formatTime(currentSong.time).color(NamedTextColor.GREEN), formatTime(currentSong.length).color(NamedTextColor.GREEN)).color(NamedTextColor.GRAY)) + .append(Component.translatable("%s / %s", formatTime(currentSong.time).asComponent().color(NamedTextColor.GREEN), formatTime(currentSong.length).asComponent().color(NamedTextColor.GREEN)).color(NamedTextColor.GRAY)) .append(Component.translatable(" | ", NamedTextColor.DARK_GRAY)) .append(Component.translatable("%s / %s", Component.text(currentSong.position, NamedTextColor.GREEN), Component.text(currentSong.size(), NamedTextColor.GREEN)).color(NamedTextColor.GRAY)); @@ -178,16 +179,16 @@ public class SongPlayer { return component; } - public Component formatTime (long millis) { + public Text formatTime (long millis) { final int seconds = (int) millis / 1000; final String minutePart = String.valueOf(seconds / 60); final String unpaddedSecondPart = String.valueOf(seconds % 60); - return Component.translatable( + return Text.translatable( "%s:%s", - Component.text(minutePart), - Component.text(unpaddedSecondPart.length() < 2 ? "0" + unpaddedSecondPart : unpaddedSecondPart) + Text.literal(minutePart), + Text.literal(unpaddedSecondPart.length() < 2 ? "0" + unpaddedSecondPart : unpaddedSecondPart) ); }