Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import net.kyori.adventure.text.format.ShadowColor;
import net.kyori.adventure.text.format.TextColor;
import net.kyori.adventure.text.format.TextDecoration;
import net.kyori.adventure.util.HSVLike;
import net.minestom.server.MinecraftServer;
import net.minestom.server.component.DataComponents;
import net.minestom.server.coordinate.Point;
Expand Down Expand Up @@ -61,6 +62,8 @@ public final class MarathonGame {
private static final int NEXT_BLOCKS_COUNT = 7;
public static final Pos RESET_POINT = new Pos(0.5, 150, 0.5);
private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("mm:ss");
private static final float BASE_SCORE_HUE = 0.8915F;
private static final int SCORE_HUE_CYCLE = 350;
public static final @NotNull Tag<Boolean> MARATHON_ENTITY_TAG = Tag.Boolean("marathonEntity");

private final @NotNull Instance instance;
Expand Down Expand Up @@ -261,7 +264,7 @@ private void refreshDisplays() {
String scorePerSecond = this.score < 5 ? "-.-" : String.valueOf(MathUtils.clamp(Math.floor(this.score / secondsTaken * 10.0) / 10.0, 0.0, 9.9));

Component message = Component.text()
.append(Component.text(this.score, TextColor.fromHexString("#ff00a6"), TextDecoration.BOLD))
.append(Component.text(this.score, this.getScoreColor(), TextDecoration.BOLD))
.append(Component.text(" | ", NamedTextColor.DARK_GRAY).shadowColor(ShadowColor.none()))
.append(Component.text(formattedTime, NamedTextColor.GRAY))
.append(Component.text(" | ", NamedTextColor.DARK_GRAY).shadowColor(ShadowColor.none()))
Expand All @@ -277,6 +280,11 @@ private void refreshDisplays() {
// ));
}

private @NotNull TextColor getScoreColor() {
float hue = (BASE_SCORE_HUE + (float) this.score / SCORE_HUE_CYCLE) % 1.0F;
return TextColor.color(HSVLike.hsvLike(hue, 1.0F, 1.0F));
}

private void generateNextBlock(boolean shouldAnimate) {
if (this.blocks.size() > NEXT_BLOCKS_COUNT) {
Point firstBlockPos = this.blocks.getFirst();
Expand Down