Skip to content

Commit

Permalink
Hide numbers on sidebar, fix statistic text
Browse files Browse the repository at this point in the history
  • Loading branch information
Patbox committed Feb 12, 2024
1 parent 910aaf9 commit 6c293e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ public static Text convertForDisplay(Identifier key, Number number) {
var seconds = number.doubleValue() / 20;
var text = Text.empty();
if (seconds > 60) {
text.append(Text.translatable("gui.minutes", MathHelper.floor(seconds / 60)));
text.append(Text.stringifiedTranslatable("gui.minutes", MathHelper.floor(seconds / 60)));
}

if (seconds % 60 > 0.01 || text.getSiblings().isEmpty()) {
if (!text.getSiblings().isEmpty()) {
text.append(" ");
}
text.append(Text.translatable("text.nucleoid_extras.seconds", Text.literal((seconds - (int) seconds >= 0.005) ? String.format("%.2f", seconds % 60) : ("" + ((int)seconds) % 60))));
text.append(Text.stringifiedTranslatable("text.nucleoid_extras.seconds", Text.literal((seconds - (int) seconds >= 0.005) ? String.format("%.2f", seconds % 60) : ("" + ((int)seconds) % 60))));
}
return text;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import eu.pb4.sidebars.api.Sidebar;
import eu.pb4.sidebars.api.lines.LineBuilder;
import net.minecraft.registry.RegistryKey;
import net.minecraft.scoreboard.number.BlankNumberFormat;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.network.ServerPlayerEntity;
import net.minecraft.text.Style;
Expand Down Expand Up @@ -67,6 +68,7 @@ private static Text[] createAnimatedTitle(String string, Text append, Style left

private NucleoidSidebar() {
this.widget = new Sidebar(TITLE_MAIN, Sidebar.Priority.LOW);
this.widget.setDefaultNumberFormat(BlankNumberFormat.INSTANCE);
this.widget.show();
}

Expand Down

0 comments on commit 6c293e4

Please sign in to comment.