TimeSource .java

net.minecraft.util.TimeSource (interface, 21 lines): members: NanoTimeSource, LongSupplier, constant, get. ann: @FunctionalInterface.

net.minecraft.utilinterface21 linescommon475 B

API Surface (0)

No public/protected methods detected (fields or constants only).

Fields & Constants (1)

LongSupplier

Full Source

TimeSource.java21 lines · Minecraft 26.3 · verbatim
1
package net.minecraft.util;
2
3
import java.util.concurrent.TimeUnit;
4
import java.util.function.LongSupplier;
5
6
@FunctionalInterface
7
public interface TimeSource {
8
	long get(TimeUnit timeUnit);
9
10
	static TimeSource.NanoTimeSource constant(final long value) {
11
		return () -> value;
12
	}
13
14
	interface NanoTimeSource extends LongSupplier, TimeSource {
15
		@Override
16
		default long get(final TimeUnit timeUnit) {
17
			return timeUnit.convert(this.getAsLong(), TimeUnit.NANOSECONDS);
18
		}
19
	}
20
}
21

Decompiled Minecraft 26.3 source of TimeSource (net/minecraft/util/TimeSource.java) with Mojang official mappings, stored verbatim on the site.