Skip to content

Commit

Permalink
hack
Browse files Browse the repository at this point in the history
  • Loading branch information
KrLite committed Feb 23, 2024
1 parent feb81d2 commit 1982aaa
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package net.krlite.knowledges.core.animation;

import net.krlite.equator.math.algebra.Theory;
import net.krlite.equator.visual.animation.interpolated.InterpolatedDouble;
import net.minecraft.client.MinecraftClient;
import net.minecraft.text.MutableText;
Expand Down Expand Up @@ -149,6 +150,19 @@ public InterpolatedText(Alignment alignment) {
private Style style = Style.EMPTY;

public MutableText text() {
if (Math.abs(width.target() - width.value()) < 1) {
// Directly return current texts
return current.stream()
.map(array -> array.stream()
.map(StyledChar::mutableText)
.reduce(MutableText::append)
.orElse(Text.empty())
)
.map(line -> line.setStyle(style))
.reduce((p, n) -> p.append("\n").append(n))
.orElse(Text.empty());
}

ArrayList<ArrayList<StyledChar>> styledLines = new ArrayList<>();

for (int line = 0; line < Math.max(last.size(), current.size()); line++) {
Expand Down

0 comments on commit 1982aaa

Please sign in to comment.