Package net.minecraft.util
Class Util
java.lang.Object
net.minecraft.util.Util
public class Util extends Object
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classUtil.IdentityHashStrategystatic classUtil.OperatingSystem -
Field Summary
Fields Modifier and Type Field Description private static ExecutorServiceBOOTSTRAP_EXECUTORprivate static ExecutorServiceIO_WORKER_EXECUTORprivate static LoggerLOGGERprivate static ExecutorServiceMAIN_WORKER_EXECUTORstatic LongSuppliernanoTimeSupplierprivate static AtomicIntegerNEXT_WORKER_IDstatic UUIDNIL_UUID -
Constructor Summary
Constructors Constructor Description Util() -
Method Summary
Modifier and Type Method Description static Consumer<String>addPrefix(String prefix, Consumer<String> consumer)private static voidattemptShutdown(ExecutorService service)private static booleanattemptTasks(int retries, String taskName, BooleanSupplier[] tasks)private static booleanattemptTasks(BooleanSupplier[] booleanSupplier)static voidbackupAndReplace(File current, File newFile, File backup)static voidbackupAndReplace(Path current, Path newPath, Path backup)Copiescurrenttobackupand then replacescurrentwithnewPathstatic <V> CompletableFuture<List<V>>combine(List<? extends CompletableFuture<? extends V>> futures)static <T> CompletableFuture<T>completeExceptionally(Throwable throwable)private static ExecutorServicecreateIoWorker()static StringcreateTranslationKey(String type, Identifier id)private static ExecutorServicecreateWorker(String name)static RunnabledebugRunnable(Runnable runnable, Supplier<String> messageSupplier)private static BooleanSupplierdeleteTask(Path path)private static BooleanSupplierdeletionVerifyTask(Path path)private static BooleanSupplierexistenceCheckTask(Path path)static ExecutorgetBootstrapExecutor()static com.mojang.datafixers.types.Type<?>getChoiceType(com.mojang.datafixers.DSL.TypeReference typeReference, String id)private static com.mojang.datafixers.types.Type<?>getChoiceTypeInternal(com.mojang.datafixers.DSL.TypeReference typeReference, String id)static longgetEpochTimeMs()static StringgetInnermostMessage(Throwable t)static ExecutorgetIoWorkerExecutor()static Stream<String>getJVMFlags()static <T> TgetLast(List<T> list)static ExecutorgetMainWorkerExecutor()static longgetMeasuringTimeMs()static longgetMeasuringTimeNano()static Util.OperatingSystemgetOperatingSystem()static intgetRandom(int[] array, Random random)static <T> TgetRandom(T[] array, Random random)static <T extends Comparable<T>>
StringgetValueAsString(Property<T> property, Object object)static <K> Hash.Strategy<K>identityHashStrategy()static <T> Optional<T>ifPresentOrElse(Optional<T> optional, Consumer<T> consumer, Runnable runnable)static <T> Tmake(Supplier<T> factory)static <T> Tmake(T object, Consumer<T> initializer)private static voidmethod_18347(Thread thread, Throwable throwable)static <T> Tmethod_32309(List<T> list, Random random)static com.mojang.serialization.DataResult<double[]>method_33141(DoubleStream doubleStream, int int2)static intmoveCursor(String string, int cursor, int delta)Moves thecursorin thestringby adeltaamount.static <T> Tnext(Iterable<T> iterable, T t)static <T> Tprevious(Iterable<T> iterable, T t)static voidrelativeCopy(Path src, Path dest, Path toCopy)Copies a file contained in the foldersrcto the folderdest.private static BooleanSupplierrenameTask(Path src, Path dest)static StringreplaceInvalidChars(String string, CharPredicate predicate)static voidshutdownExecutors()static voidstartTimerHack()static <T> Stream<T>stream(Optional<? extends T> optional)static <T extends Throwable>
TthrowOrPause(T t)static voidthrowUnchecked(Throwable throwable)static com.mojang.serialization.DataResult<int[]>toIntArray(IntStream intStream, int length)static <K, V> Collector<Map.Entry<? extends K,? extends V>,?,Map<K,V>>toMap()
-
Field Details
-
NEXT_WORKER_ID
-
BOOTSTRAP_EXECUTOR
-
MAIN_WORKER_EXECUTOR
-
IO_WORKER_EXECUTOR
-
nanoTimeSupplier
-
NIL_UUID
-
LOGGER
-
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
toMap
-
getValueAsString
public static <T extends Comparable<T>> String getValueAsString(Property<T> property, Object object) -
createTranslationKey
-
getMeasuringTimeMs
public static long getMeasuringTimeMs() -
getMeasuringTimeNano
public static long getMeasuringTimeNano() -
getEpochTimeMs
public static long getEpochTimeMs() -
createWorker
-
getBootstrapExecutor
-
getMainWorkerExecutor
-
getIoWorkerExecutor
-
shutdownExecutors
public static void shutdownExecutors() -
attemptShutdown
-
createIoWorker
-
completeExceptionally
@Environment(CLIENT) public static <T> CompletableFuture<T> completeExceptionally(Throwable throwable) -
throwUnchecked
-
method_18347
-
getChoiceType
-
getChoiceTypeInternal
-
getOperatingSystem
-
getJVMFlags
-
getLast
-
next
-
previous
-
make
-
make
-
identityHashStrategy
-
combine
public static <V> CompletableFuture<List<V>> combine(List<? extends CompletableFuture<? extends V>> futures) -
stream
-
ifPresentOrElse
-
debugRunnable
-
throwOrPause
-
getInnermostMessage
-
getRandom
-
getRandom
-
method_32309
-
renameTask
-
deleteTask
-
deletionVerifyTask
-
existenceCheckTask
-
attemptTasks
-
attemptTasks
-
backupAndReplace
-
backupAndReplace
Copiescurrenttobackupand then replacescurrentwithnewPath -
moveCursor
Moves thecursorin thestringby adeltaamount. Skips surrogate characters. -
addPrefix
-
toIntArray
public static com.mojang.serialization.DataResult<int[]> toIntArray(IntStream intStream, int length) -
method_33141
public static com.mojang.serialization.DataResult<double[]> method_33141(DoubleStream doubleStream, int int2) -
startTimerHack
public static void startTimerHack() -
relativeCopy
@Environment(CLIENT) public static void relativeCopy(Path src, Path dest, Path toCopy) throws IOExceptionCopies a file contained in the foldersrcto the folderdest. This will replicate any path structure that may exist betweensrcandtoCopy.- Throws:
IOException
-
replaceInvalidChars
@Environment(CLIENT) public static String replaceInvalidChars(String string, CharPredicate predicate)
-