too many things, kinda forgor to push/commit
Some checks failed
Build / build (push) Successful in 3m43s
Format / formatting (push) Failing after 19s

This commit is contained in:
unurled 2024-10-11 12:29:44 +02:00
parent 897edf1d37
commit bb514f8a63
Signed by: unurled
GPG key ID: EFC5F5E709B47DDD
69 changed files with 1691 additions and 1256 deletions

View file

@ -1,12 +1,10 @@
package me.unurled.sacredrealms.sr.utils;
import static me.unurled.sacredrealms.sr.utils.Component.textComp;
import static me.unurled.srcore.utils.Component.textComp;
import java.time.Duration;
import java.util.ArrayList;
import java.util.List;
import me.unurled.sacredrealms.sr.components.cutscene.Frame;
import me.unurled.sacredrealms.sr.components.cutscene.Marker;
import net.kyori.adventure.key.Key;
import net.kyori.adventure.title.Title;
import net.kyori.adventure.title.Title.Times;
@ -32,36 +30,4 @@ public class CutsceneUtil {
Duration.ofSeconds(fadeOut)));
p.showTitle(title);
}
public static @NotNull List<Frame> interpolateFrames(
@NotNull Marker startMarker, @NotNull Marker endMarker, long stepMillis) {
long duration = startMarker.getOverAllTime();
int numFrames = (int) (duration / stepMillis);
double xDiff = (endMarker.getStart().getX() - startMarker.getStart().getX()) / numFrames;
double yDiff = (endMarker.getStart().getY() - startMarker.getStart().getY()) / numFrames;
double zDiff = (endMarker.getStart().getZ() - startMarker.getStart().getZ()) / numFrames;
double yawDiff = (endMarker.getStart().getYaw() - startMarker.getStart().getYaw()) / numFrames;
double pitchDiff =
(endMarker.getStart().getPitch() - startMarker.getStart().getPitch()) / numFrames;
ArrayList<Frame> frames = new ArrayList<>();
for (int i = 0; i < numFrames; i++) {
double x = startMarker.getStart().getX() + xDiff * i;
double y = startMarker.getStart().getY() + yDiff * i;
double z = startMarker.getStart().getZ() + zDiff * i;
double yaw = startMarker.getStart().getYaw() + yawDiff * i;
double pitch = startMarker.getStart().getPitch() + pitchDiff * i;
Frame frame =
new Frame(
new Location(startMarker.getStart().getWorld(), x, y, z, (float) yaw, (float) pitch));
frames.add(frame);
}
return frames;
}
}