Files
OpenOnyx/src/openonyx/music/TrackInfo.java
T

15 lines
512 B
Java

package openonyx.music;
import net.minecraft.util.ResourceLocation;
public record TrackInfo(String title, String artist, ResourceLocation art, boolean playing, int progressMs, int durationMs, long capturedAtNanos) {
public float L() {
if (this.durationMs <= 0) {
return 0.0F;
}
long l = this.playing ? (System.nanoTime() - this.capturedAtNanos) / 1000000L : 0L;
return Math.clamp((float)Math.min(this.durationMs, this.progressMs + l) / this.durationMs, 0.0F, 1.0F);
}
}