Package net.minecraft.util
Class Util
- java.lang.Object
-
- net.minecraft.util.Util
-
public class Util extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
Util.IdentityStrategy
static class
Util.OS
-
Field Summary
Fields Modifier and Type Field Description private static java.util.concurrent.ExecutorService
BACKGROUND_EXECUTOR
private static java.util.concurrent.ExecutorService
BOOTSTRAP_EXECUTOR
private static java.util.concurrent.ExecutorService
IO_POOL
private static org.apache.logging.log4j.Logger
LOGGER
static java.util.UUID
NIL_UUID
static java.util.function.LongSupplier
timeSource
private static java.util.concurrent.atomic.AtomicInteger
WORKER_COUNT
-
Constructor Summary
Constructors Constructor Description Util()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.concurrent.Executor
backgroundExecutor()
static java.util.concurrent.Executor
bootstrapExecutor()
static void
copyBetweenDirs(java.nio.file.Path p_240984_0_, java.nio.file.Path p_240984_1_, java.nio.file.Path p_240984_2_)
private static java.util.function.BooleanSupplier
createDeleter(java.nio.file.Path p_244362_0_)
private static java.util.function.BooleanSupplier
createFileCreatedCheck(java.nio.file.Path p_244367_0_)
private static java.util.function.BooleanSupplier
createFileDeletedCheck(java.nio.file.Path p_244366_0_)
private static java.util.function.BooleanSupplier
createRenamer(java.nio.file.Path p_244363_0_, java.nio.file.Path p_244363_1_)
static java.lang.String
describeError(java.lang.Throwable p_229758_0_)
private static com.mojang.datafixers.types.Type<?>
doFetchChoiceType(com.mojang.datafixers.DSL.TypeReference p_240990_0_, java.lang.String p_240990_1_)
private static boolean
executeInSequence(java.util.function.BooleanSupplier... p_244365_0_)
static <T> java.util.concurrent.CompletableFuture<T>
failedFuture(java.lang.Throwable p_215087_0_)
static com.mojang.datafixers.types.Type<?>
fetchChoiceType(com.mojang.datafixers.DSL.TypeReference p_240976_0_, java.lang.String p_240976_1_)
static <T> T
findNextInIterable(java.lang.Iterable<T> p_195647_0_, T p_195647_1_)
static <T> T
findPreviousInIterable(java.lang.Iterable<T> p_195648_0_, T p_195648_1_)
static com.mojang.serialization.DataResult<int[]>
fixedSize(java.util.stream.IntStream p_240987_0_, int p_240987_1_)
static long
getEpochMillis()
static long
getMillis()
static long
getNanos()
static Util.OS
getPlatform()
static <T extends java.lang.Comparable<T>>
java.lang.StringgetPropertyName(Property<T> p_200269_0_, java.lang.Object p_200269_1_)
static int
getRandom(int[] p_240988_0_, java.util.Random p_240988_1_)
static <T> T
getRandom(T[] p_240989_0_, java.util.Random p_240989_1_)
static java.util.stream.Stream<java.lang.String>
getVmArguments()
static <K> it.unimi.dsi.fastutil.Hash.Strategy<K>
identityStrategy()
static <T> java.util.Optional<T>
ifElse(java.util.Optional<T> p_215077_0_, java.util.function.Consumer<T> p_215077_1_, java.lang.Runnable p_215077_2_)
static java.util.concurrent.Executor
ioPool()
static <T> T
lastOf(java.util.List<T> p_223378_0_)
static <T> T
make(java.util.function.Supplier<T> p_199748_0_)
static <T> T
make(T p_200696_0_, java.util.function.Consumer<T> p_200696_1_)
static java.lang.String
makeDescriptionId(java.lang.String p_200697_0_, ResourceLocation p_200697_1_)
private static java.util.concurrent.ExecutorService
makeExecutor(java.lang.String p_240979_0_)
private static java.util.concurrent.ExecutorService
makeIoExecutor()
static java.lang.Runnable
name(java.lang.Runnable p_215075_0_, java.util.function.Supplier<java.lang.String> p_215075_1_)
static int
offsetByCodepoints(java.lang.String p_240980_0_, int p_240980_1_, int p_240980_2_)
private static void
onThreadException(java.lang.Thread p_240983_0_, java.lang.Throwable p_240983_1_)
static <T extends java.lang.Throwable>
TpauseInIde(T p_229757_0_)
static java.util.function.Consumer<java.lang.String>
prefix(java.lang.String p_240982_0_, java.util.function.Consumer<java.lang.String> p_240982_1_)
private static boolean
runWithRetries(int p_244359_0_, java.lang.String p_244359_1_, java.util.function.BooleanSupplier... p_244359_2_)
static void
safeReplaceFile(java.io.File p_240977_0_, java.io.File p_240977_1_, java.io.File p_240977_2_)
static void
safeReplaceFile(java.nio.file.Path p_244364_0_, java.nio.file.Path p_244364_1_, java.nio.file.Path p_244364_2_)
static java.lang.String
sanitizeName(java.lang.String p_244361_0_, ICharacterPredicate p_244361_1_)
static <V> java.util.concurrent.CompletableFuture<java.util.List<V>>
sequence(java.util.List<? extends java.util.concurrent.CompletableFuture<? extends V>> p_215079_0_)
private static void
shutdownExecutor(java.util.concurrent.ExecutorService p_240985_0_)
static void
shutdownExecutors()
static void
startTimerHackThread()
static void
throwAsRuntime(java.lang.Throwable p_229756_0_)
static <K,V>
java.util.stream.Collector<java.util.Map.Entry<? extends K,? extends V>,?,java.util.Map<K,V>>toMap()
static <T> java.util.stream.Stream<T>
toStream(java.util.Optional<? extends T> p_215081_0_)
-
-
-
Field Detail
-
WORKER_COUNT
private static final java.util.concurrent.atomic.AtomicInteger WORKER_COUNT
-
BOOTSTRAP_EXECUTOR
private static final java.util.concurrent.ExecutorService BOOTSTRAP_EXECUTOR
-
BACKGROUND_EXECUTOR
private static final java.util.concurrent.ExecutorService BACKGROUND_EXECUTOR
-
IO_POOL
private static final java.util.concurrent.ExecutorService IO_POOL
-
timeSource
public static java.util.function.LongSupplier timeSource
-
NIL_UUID
public static final java.util.UUID NIL_UUID
-
LOGGER
private static final org.apache.logging.log4j.Logger LOGGER
-
-
Method Detail
-
toMap
public static <K,V> java.util.stream.Collector<java.util.Map.Entry<? extends K,? extends V>,?,java.util.Map<K,V>> toMap()
-
getPropertyName
public static <T extends java.lang.Comparable<T>> java.lang.String getPropertyName(Property<T> p_200269_0_, java.lang.Object p_200269_1_)
-
makeDescriptionId
public static java.lang.String makeDescriptionId(java.lang.String p_200697_0_, @Nullable ResourceLocation p_200697_1_)
-
getMillis
public static long getMillis()
-
getNanos
public static long getNanos()
-
getEpochMillis
public static long getEpochMillis()
-
makeExecutor
private static java.util.concurrent.ExecutorService makeExecutor(java.lang.String p_240979_0_)
-
bootstrapExecutor
public static java.util.concurrent.Executor bootstrapExecutor()
-
backgroundExecutor
public static java.util.concurrent.Executor backgroundExecutor()
-
ioPool
public static java.util.concurrent.Executor ioPool()
-
shutdownExecutors
public static void shutdownExecutors()
-
shutdownExecutor
private static void shutdownExecutor(java.util.concurrent.ExecutorService p_240985_0_)
-
makeIoExecutor
private static java.util.concurrent.ExecutorService makeIoExecutor()
-
failedFuture
public static <T> java.util.concurrent.CompletableFuture<T> failedFuture(java.lang.Throwable p_215087_0_)
-
throwAsRuntime
public static void throwAsRuntime(java.lang.Throwable p_229756_0_)
-
onThreadException
private static void onThreadException(java.lang.Thread p_240983_0_, java.lang.Throwable p_240983_1_)
-
fetchChoiceType
@Nullable public static com.mojang.datafixers.types.Type<?> fetchChoiceType(com.mojang.datafixers.DSL.TypeReference p_240976_0_, java.lang.String p_240976_1_)
-
doFetchChoiceType
@Nullable private static com.mojang.datafixers.types.Type<?> doFetchChoiceType(com.mojang.datafixers.DSL.TypeReference p_240990_0_, java.lang.String p_240990_1_)
-
getPlatform
public static Util.OS getPlatform()
-
getVmArguments
public static java.util.stream.Stream<java.lang.String> getVmArguments()
-
lastOf
public static <T> T lastOf(java.util.List<T> p_223378_0_)
-
findNextInIterable
public static <T> T findNextInIterable(java.lang.Iterable<T> p_195647_0_, @Nullable T p_195647_1_)
-
findPreviousInIterable
public static <T> T findPreviousInIterable(java.lang.Iterable<T> p_195648_0_, @Nullable T p_195648_1_)
-
make
public static <T> T make(java.util.function.Supplier<T> p_199748_0_)
-
make
public static <T> T make(T p_200696_0_, java.util.function.Consumer<T> p_200696_1_)
-
identityStrategy
public static <K> it.unimi.dsi.fastutil.Hash.Strategy<K> identityStrategy()
-
sequence
public static <V> java.util.concurrent.CompletableFuture<java.util.List<V>> sequence(java.util.List<? extends java.util.concurrent.CompletableFuture<? extends V>> p_215079_0_)
-
toStream
public static <T> java.util.stream.Stream<T> toStream(java.util.Optional<? extends T> p_215081_0_)
-
ifElse
public static <T> java.util.Optional<T> ifElse(java.util.Optional<T> p_215077_0_, java.util.function.Consumer<T> p_215077_1_, java.lang.Runnable p_215077_2_)
-
name
public static java.lang.Runnable name(java.lang.Runnable p_215075_0_, java.util.function.Supplier<java.lang.String> p_215075_1_)
-
pauseInIde
public static <T extends java.lang.Throwable> T pauseInIde(T p_229757_0_)
-
describeError
public static java.lang.String describeError(java.lang.Throwable p_229758_0_)
-
getRandom
public static <T> T getRandom(T[] p_240989_0_, java.util.Random p_240989_1_)
-
getRandom
public static int getRandom(int[] p_240988_0_, java.util.Random p_240988_1_)
-
createRenamer
private static java.util.function.BooleanSupplier createRenamer(java.nio.file.Path p_244363_0_, java.nio.file.Path p_244363_1_)
-
createDeleter
private static java.util.function.BooleanSupplier createDeleter(java.nio.file.Path p_244362_0_)
-
createFileDeletedCheck
private static java.util.function.BooleanSupplier createFileDeletedCheck(java.nio.file.Path p_244366_0_)
-
createFileCreatedCheck
private static java.util.function.BooleanSupplier createFileCreatedCheck(java.nio.file.Path p_244367_0_)
-
executeInSequence
private static boolean executeInSequence(java.util.function.BooleanSupplier... p_244365_0_)
-
runWithRetries
private static boolean runWithRetries(int p_244359_0_, java.lang.String p_244359_1_, java.util.function.BooleanSupplier... p_244359_2_)
-
safeReplaceFile
public static void safeReplaceFile(java.io.File p_240977_0_, java.io.File p_240977_1_, java.io.File p_240977_2_)
-
safeReplaceFile
public static void safeReplaceFile(java.nio.file.Path p_244364_0_, java.nio.file.Path p_244364_1_, java.nio.file.Path p_244364_2_)
-
offsetByCodepoints
public static int offsetByCodepoints(java.lang.String p_240980_0_, int p_240980_1_, int p_240980_2_)
-
prefix
public static java.util.function.Consumer<java.lang.String> prefix(java.lang.String p_240982_0_, java.util.function.Consumer<java.lang.String> p_240982_1_)
-
fixedSize
public static com.mojang.serialization.DataResult<int[]> fixedSize(java.util.stream.IntStream p_240987_0_, int p_240987_1_)
-
startTimerHackThread
public static void startTimerHackThread()
-
copyBetweenDirs
public static void copyBetweenDirs(java.nio.file.Path p_240984_0_, java.nio.file.Path p_240984_1_, java.nio.file.Path p_240984_2_) throws java.io.IOException
- Throws:
java.io.IOException
-
sanitizeName
public static java.lang.String sanitizeName(java.lang.String p_244361_0_, ICharacterPredicate p_244361_1_)
-
-