Package net.minecraft
Class Util
java.lang.Object
net.minecraft.Util
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static enumstatic enum -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ExecutorServiceprivate static final ExecutorServiceprivate static final intprivate static final DateTimeFormatterprivate static LongSupplierprivate static LongSupplierprivate static final ExecutorService(package private) static final org.slf4j.Loggerprivate static final Stringstatic final UUIDstatic final com.google.common.base.Tickerstatic TimeSource.NanoTimeSourceprivate static final AtomicIntegerstatic final FileSystemProvider -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ExecutorServicestatic <T> CompletableFuture<T>blockUntilDone(Function<Executor, CompletableFuture<T>> p_214680_) static <T> TblockUntilDone(Function<Executor, T> p_214653_, Predicate<T> p_214654_) static ExecutorServicestatic voidcopyBetweenDirs(Path p_137564_, Path p_137565_, Path p_137566_) private static BooleanSuppliercreateDeleter(Path p_137501_) private static BooleanSuppliercreateFileCreatedCheck(Path p_137573_) private static BooleanSuppliercreateFileDeletedCheck(Path p_137562_) static <T> ToIntFunction<T>createIndexLookup(List<T> p_214687_) static <T> ToIntFunction<T>createIndexLookup(List<T> p_214635_, IntFunction<it.unimi.dsi.fastutil.objects.Object2IntMap<T>> p_214636_) private static BooleanSuppliercreateRenamer(Path p_137503_, Path p_137504_) static StringdescribeError(Throwable p_137576_) private static com.mojang.datafixers.types.Type<?>doFetchChoiceType(com.mojang.datafixers.DSL.TypeReference p_137552_, String p_137553_) private static voidprivate static booleanexecuteInSequence(BooleanSupplier... p_137549_) private static <V> CompletableFuture<List<V>>fallibleSequence(List<? extends CompletableFuture<? extends V>> p_214632_, Consumer<Throwable> p_214633_) static com.mojang.datafixers.types.Type<?>fetchChoiceType(com.mojang.datafixers.DSL.TypeReference p_137457_, String p_137458_) static <T> TfindNextInIterable(Iterable<T> p_137467_, T p_137468_) static <T> TfindPreviousInIterable(Iterable<T> p_137555_, T p_137556_) static <T> com.mojang.serialization.DataResult<List<T>>static com.mojang.serialization.DataResult<int[]>static longstatic Stringprivate static intstatic longstatic longgetNanos()static <T,E extends Exception>
TgetOrThrow(com.mojang.serialization.DataResult<T> p_261812_, Function<String, E> p_261468_) static Util.OSstatic <T extends Comparable<T>>
StringgetPropertyName(Property<T> p_137454_, Object p_137455_) static intgetRandom(int[] p_214668_, RandomSource p_214669_) static <T> TgetRandom(List<T> p_214622_, RandomSource p_214623_) static <T> TgetRandom(T[] p_214671_, RandomSource p_214672_) static <T> Optional<T>getRandomSafe(List<T> p_214677_, RandomSource p_214678_) static <K> it.unimi.dsi.fastutil.Hash.Strategy<K>static <T> Optional<T>static ExecutorServiceioPool()static <T> Tstatic voidlogAndPauseIfInIde(String p_143786_) static voidlogAndPauseIfInIde(String p_200891_, Throwable p_200892_) static <T> Tstatic <T> Tstatic StringmakeDescriptionId(String p_137493_, ResourceLocation p_137494_) private static ExecutorServicemakeExecutor(String p_137478_) private static ExecutorServicestatic <T,R> R mapNullable(T p_214615_, Function<T, R> p_214616_) static <T,R> R mapNullable(T p_214618_, Function<T, R> p_214619_, R p_214620_) static <T,U, R> BiFunction<T, U, R> memoize(BiFunction<T, U, R> p_143822_) static <T,R> Function<T, R> static Runnablestatic <T> Supplier<T>static intoffsetByCodepoints(String p_137480_, int p_137481_, int p_137482_) private static voidonThreadException(Thread p_137496_, Throwable p_137497_) static <T extends Throwable>
TpauseInIde(T p_137571_) private static booleanrunWithRetries(int p_137450_, String p_137451_, BooleanSupplier... p_137452_) static voidsafeReplaceFile(File p_137463_, File p_137464_, File p_137465_) static voidsafeReplaceFile(Path p_137506_, Path p_137507_, Path p_137508_) static voidsafeReplaceOrMoveFile(File p_212225_, File p_212226_, File p_212227_, boolean p_212228_) static voidsafeReplaceOrMoveFile(Path p_212230_, Path p_212231_, Path p_212232_, boolean p_212233_) static StringsanitizeName(String p_137484_, CharPredicate p_137485_) static <V> CompletableFuture<List<V>>sequence(List<? extends CompletableFuture<V>> p_137568_) static <V> CompletableFuture<List<V>>sequenceFailFast(List<? extends CompletableFuture<? extends V>> p_143841_) static <V> CompletableFuture<List<V>>sequenceFailFastAndCancel(List<? extends CompletableFuture<? extends V>> p_214685_) static voidstatic <T> voidshuffle(it.unimi.dsi.fastutil.objects.ObjectArrayList<T> p_214674_, RandomSource p_214675_) static <T> List<T>shuffledCopy(it.unimi.dsi.fastutil.objects.ObjectArrayList<T> p_214612_, RandomSource p_214613_) static <T> List<T>shuffledCopy(T[] p_214682_, RandomSource p_214683_) private static voidshutdownExecutor(ExecutorService p_137532_) static voidstatic voidstatic voidthrowAsRuntime(Throwable p_137560_) toMap()static it.unimi.dsi.fastutil.ints.IntArrayListtoShuffledList(IntStream p_214659_, RandomSource p_214660_) static <T> List<T>toShuffledList(Stream<T> p_214662_, RandomSource p_214663_) static RunnablewrapThreadWithTaskName(String p_143788_, Runnable p_143789_) static <V> Supplier<V>wrapThreadWithTaskName(String p_183947_, Supplier<V> p_183948_)
-
Field Details
-
LOGGER
static final org.slf4j.Logger LOGGER -
DEFAULT_MAX_THREADS
private static final int DEFAULT_MAX_THREADS- See Also:
-
MAX_THREADS_SYSTEM_PROPERTY
- See Also:
-
WORKER_COUNT
-
BOOTSTRAP_EXECUTOR
-
BACKGROUND_EXECUTOR
-
IO_POOL
-
FILENAME_DATE_TIME_FORMATTER
-
timeSource
-
TICKER
public static final com.google.common.base.Ticker TICKER -
NIL_UUID
-
ZIP_FILE_SYSTEM_PROVIDER
-
thePauser
-
INNER_CLASS_SHIFT1
-
INNER_CLASS_SHIFT2
-
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
toMap
-
getPropertyName
public static <T extends Comparable<T>> String getPropertyName(Property<T> p_137454_, Object p_137455_) -
makeDescriptionId
-
getMillis
public static long getMillis() -
getNanos
public static long getNanos() -
getEpochMillis
public static long getEpochMillis() -
getFilenameFormattedDateTime
-
makeExecutor
-
getMaxThreads
private static int getMaxThreads() -
bootstrapExecutor
-
backgroundExecutor
-
ioPool
-
shutdownExecutors
public static void shutdownExecutors() -
shutdownExecutor
-
makeIoExecutor
-
throwAsRuntime
-
onThreadException
-
fetchChoiceType
@Nullable public static com.mojang.datafixers.types.Type<?> fetchChoiceType(com.mojang.datafixers.DSL.TypeReference p_137457_, String p_137458_) -
doFetchChoiceType
@Nullable private static com.mojang.datafixers.types.Type<?> doFetchChoiceType(com.mojang.datafixers.DSL.TypeReference p_137552_, String p_137553_) -
wrapThreadWithTaskName
-
wrapThreadWithTaskName
-
getPlatform
-
getVmArguments
-
lastOf
-
findNextInIterable
-
findPreviousInIterable
-
make
-
make
-
mapNullable
-
mapNullable
-
identityStrategy
public static <K> it.unimi.dsi.fastutil.Hash.Strategy<K> identityStrategy() -
sequence
public static <V> CompletableFuture<List<V>> sequence(List<? extends CompletableFuture<V>> p_137568_) -
sequenceFailFast
public static <V> CompletableFuture<List<V>> sequenceFailFast(List<? extends CompletableFuture<? extends V>> p_143841_) -
sequenceFailFastAndCancel
public static <V> CompletableFuture<List<V>> sequenceFailFastAndCancel(List<? extends CompletableFuture<? extends V>> p_214685_) -
fallibleSequence
private static <V> CompletableFuture<List<V>> fallibleSequence(List<? extends CompletableFuture<? extends V>> p_214632_, Consumer<Throwable> p_214633_) -
ifElse
-
name
-
name
-
logAndPauseIfInIde
-
logAndPauseIfInIde
-
pauseInIde
-
setPause
-
doPause
-
describeError
-
getRandom
-
getRandom
-
getRandom
-
getRandomSafe
-
createRenamer
-
createDeleter
-
createFileDeletedCheck
-
createFileCreatedCheck
-
executeInSequence
-
runWithRetries
private static boolean runWithRetries(int p_137450_, String p_137451_, BooleanSupplier... p_137452_) -
safeReplaceFile
-
safeReplaceFile
-
safeReplaceOrMoveFile
-
safeReplaceOrMoveFile
-
offsetByCodepoints
-
prefix
-
fixedSize
public static com.mojang.serialization.DataResult<int[]> fixedSize(IntStream p_137540_, int p_137541_) -
fixedSize
-
startTimerHackThread
public static void startTimerHackThread() -
copyBetweenDirs
public static void copyBetweenDirs(Path p_137564_, Path p_137565_, Path p_137566_) throws IOException - Throws:
IOException
-
sanitizeName
-
memoize
-
memoize
-
toShuffledList
-
toShuffledList
public static it.unimi.dsi.fastutil.ints.IntArrayList toShuffledList(IntStream p_214659_, RandomSource p_214660_) -
shuffledCopy
-
shuffledCopy
public static <T> List<T> shuffledCopy(it.unimi.dsi.fastutil.objects.ObjectArrayList<T> p_214612_, RandomSource p_214613_) -
shuffle
public static <T> void shuffle(it.unimi.dsi.fastutil.objects.ObjectArrayList<T> p_214674_, RandomSource p_214675_) -
blockUntilDone
public static <T> CompletableFuture<T> blockUntilDone(Function<Executor, CompletableFuture<T>> p_214680_) -
blockUntilDone
-
createIndexLookup
-
createIndexLookup
public static <T> ToIntFunction<T> createIndexLookup(List<T> p_214635_, IntFunction<it.unimi.dsi.fastutil.objects.Object2IntMap<T>> p_214636_) -
getOrThrow
public static <T,E extends Exception> T getOrThrow(com.mojang.serialization.DataResult<T> p_261812_, Function<String, E> p_261468_) throws E- Throws:
E extends Exception
-