Package net.minecraft

Class Util

java.lang.Object
net.minecraft.Util

public class Util extends Object
  • Field Details

    • LOGGER

      static final org.slf4j.Logger LOGGER
    • DEFAULT_MAX_THREADS

      private static final int DEFAULT_MAX_THREADS
      See Also:
    • DEFAULT_SAFE_FILE_OPERATION_RETRIES

      private static final int DEFAULT_SAFE_FILE_OPERATION_RETRIES
      See Also:
    • MAX_THREADS_SYSTEM_PROPERTY

      private static final String MAX_THREADS_SYSTEM_PROPERTY
      See Also:
    • BACKGROUND_EXECUTOR

      private static final ExecutorService BACKGROUND_EXECUTOR
    • IO_POOL

      private static final ExecutorService IO_POOL
    • DOWNLOAD_POOL

      private static final ExecutorService DOWNLOAD_POOL
    • FILENAME_DATE_TIME_FORMATTER

      private static final DateTimeFormatter FILENAME_DATE_TIME_FORMATTER
    • LINEAR_LOOKUP_THRESHOLD

      public static final int LINEAR_LOOKUP_THRESHOLD
      See Also:
    • NANOS_PER_MILLI

      public static final long NANOS_PER_MILLI
      See Also:
    • timeSource

      public static TimeSource.NanoTimeSource timeSource
    • TICKER

      public static final com.google.common.base.Ticker TICKER
    • NIL_UUID

      public static final UUID NIL_UUID
    • ZIP_FILE_SYSTEM_PROVIDER

      public static final FileSystemProvider ZIP_FILE_SYSTEM_PROVIDER
    • thePauser

      private static Consumer<String> thePauser
  • Constructor Details

    • Util

      public Util()
  • Method Details

    • toMap

      public static <K, V> Collector<Map.Entry<? extends K,? extends V>,?,Map<K,V>> toMap()
    • toMutableList

      public static <T> Collector<T,?,List<T>> toMutableList()
    • getPropertyName

      public static <T extends Comparable<T>> String getPropertyName(Property<T> p_137454_, Object p_137455_)
    • makeDescriptionId

      public static String makeDescriptionId(String p_137493_, @Nullable ResourceLocation p_137494_)
    • getMillis

      public static long getMillis()
    • getNanos

      public static long getNanos()
    • getEpochMillis

      public static long getEpochMillis()
    • getFilenameFormattedDateTime

      public static String getFilenameFormattedDateTime()
    • makeExecutor

      private static ExecutorService makeExecutor(String p_137478_)
    • getMaxThreads

      private static int getMaxThreads()
    • backgroundExecutor

      public static ExecutorService backgroundExecutor()
    • ioPool

      public static ExecutorService ioPool()
    • nonCriticalIoPool

      public static ExecutorService nonCriticalIoPool()
    • shutdownExecutors

      public static void shutdownExecutors()
    • shutdownExecutor

      private static void shutdownExecutor(ExecutorService p_137532_)
    • makeIoExecutor

      private static ExecutorService makeIoExecutor(String p_314465_, boolean p_314461_)
    • throwAsRuntime

      public static void throwAsRuntime(Throwable p_137560_)
    • onThreadException

      private static void onThreadException(Thread p_137496_, Throwable p_137497_)
    • 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

      public static Runnable wrapThreadWithTaskName(String p_143788_, Runnable p_143789_)
    • wrapThreadWithTaskName

      public static <V> Supplier<V> wrapThreadWithTaskName(String p_183947_, Supplier<V> p_183948_)
    • getRegisteredName

      public static <T> String getRegisteredName(Registry<T> p_331026_, T p_331334_)
    • allOf

      public static <T> Predicate<T> allOf(List<? extends Predicate<T>> p_323679_)
    • anyOf

      public static <T> Predicate<T> anyOf(List<? extends Predicate<T>> p_323722_)
    • getPlatform

      public static Util.OS getPlatform()
    • getVmArguments

      public static Stream<String> getVmArguments()
    • lastOf

      public static <T> T lastOf(List<T> p_137510_)
    • findNextInIterable

      public static <T> T findNextInIterable(Iterable<T> p_137467_, @Nullable T p_137468_)
    • findPreviousInIterable

      public static <T> T findPreviousInIterable(Iterable<T> p_137555_, @Nullable T p_137556_)
    • make

      public static <T> T make(Supplier<T> p_137538_)
    • make

      public static <T> T make(T p_137470_, Consumer<? super T> p_137471_)
    • 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

      public static <T> Optional<T> ifElse(Optional<T> p_137522_, Consumer<T> p_137523_, Runnable p_137524_)
    • name

      public static <T> Supplier<T> name(Supplier<T> p_214656_, Supplier<String> p_214657_)
    • name

      public static Runnable name(Runnable p_137475_, Supplier<String> p_137476_)
    • logAndPauseIfInIde

      public static void logAndPauseIfInIde(String p_143786_)
    • logAndPauseIfInIde

      public static void logAndPauseIfInIde(String p_200891_, Throwable p_200892_)
    • pauseInIde

      public static <T extends Throwable> T pauseInIde(T p_137571_)
    • setPause

      public static void setPause(Consumer<String> p_183970_)
    • doPause

      private static void doPause(String p_183985_)
    • describeError

      public static String describeError(Throwable p_137576_)
    • getRandom

      public static <T> T getRandom(T[] p_214671_, RandomSource p_214672_)
    • getRandom

      public static int getRandom(int[] p_214668_, RandomSource p_214669_)
    • getRandom

      public static <T> T getRandom(List<T> p_214622_, RandomSource p_214623_)
    • getRandomSafe

      public static <T> Optional<T> getRandomSafe(List<T> p_214677_, RandomSource p_214678_)
    • createRenamer

      private static BooleanSupplier createRenamer(Path p_137503_, Path p_137504_)
    • createDeleter

      private static BooleanSupplier createDeleter(Path p_137501_)
    • createFileDeletedCheck

      private static BooleanSupplier createFileDeletedCheck(Path p_137562_)
    • createFileCreatedCheck

      private static BooleanSupplier createFileCreatedCheck(Path p_137573_)
    • executeInSequence

      private static boolean executeInSequence(BooleanSupplier... p_137549_)
    • runWithRetries

      private static boolean runWithRetries(int p_137450_, String p_137451_, BooleanSupplier... p_137452_)
    • safeReplaceFile

      public static void safeReplaceFile(Path p_137506_, Path p_137507_, Path p_137508_)
    • safeReplaceOrMoveFile

      public static boolean safeReplaceOrMoveFile(Path p_307599_, Path p_307197_, Path p_307407_, boolean p_212228_)
    • offsetByCodepoints

      public static int offsetByCodepoints(String p_137480_, int p_137481_, int p_137482_)
    • prefix

      public static Consumer<String> prefix(String p_137490_, Consumer<String> p_137491_)
    • fixedSize

      public static com.mojang.serialization.DataResult<int[]> fixedSize(IntStream p_137540_, int p_137541_)
    • fixedSize

      public static com.mojang.serialization.DataResult<long[]> fixedSize(LongStream p_287579_, int p_287631_)
    • fixedSize

      public static <T> com.mojang.serialization.DataResult<List<T>> fixedSize(List<T> p_143796_, int p_143797_)
    • startTimerHackThread

      public static void startTimerHackThread()
    • copyBetweenDirs

      public static void copyBetweenDirs(Path p_137564_, Path p_137565_, Path p_137566_) throws IOException
      Throws:
      IOException
    • sanitizeName

      public static String sanitizeName(String p_137484_, CharPredicate p_137485_)
    • singleKeyCache

      public static <K, V> SingleKeyCache<K,V> singleKeyCache(Function<K,V> p_270326_)
    • memoize

      public static <T, R> Function<T,R> memoize(Function<T,R> p_143828_)
    • memoize

      public static <T, U, R> BiFunction<T,U,R> memoize(BiFunction<T,U,R> p_143822_)
    • toShuffledList

      public static <T> List<T> toShuffledList(Stream<T> p_214662_, RandomSource p_214663_)
    • toShuffledList

      public static it.unimi.dsi.fastutil.ints.IntArrayList toShuffledList(IntStream p_214659_, RandomSource p_214660_)
    • shuffledCopy

      public static <T> List<T> shuffledCopy(T[] p_214682_, RandomSource p_214683_)
    • 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(List<T> p_309187_, RandomSource p_214675_)
    • blockUntilDone

      public static <T> CompletableFuture<T> blockUntilDone(Function<Executor,CompletableFuture<T>> p_214680_)
    • blockUntilDone

      public static <T> T blockUntilDone(Function<Executor,T> p_214653_, Predicate<T> p_214654_)
    • createIndexLookup

      public static <T> ToIntFunction<T> createIndexLookup(List<T> p_214687_)
    • createIndexIdentityLookup

      public static <T> ToIntFunction<T> createIndexIdentityLookup(List<T> p_304758_)
    • writeAndReadTypedOrThrow

      public static <A, B> com.mojang.datafixers.Typed<B> writeAndReadTypedOrThrow(com.mojang.datafixers.Typed<A> p_311873_, com.mojang.datafixers.types.Type<B> p_312554_, UnaryOperator<com.mojang.serialization.Dynamic<?>> p_311990_)
    • readTypedOrThrow

      public static <T> com.mojang.datafixers.Typed<T> readTypedOrThrow(com.mojang.datafixers.types.Type<T> p_312508_, com.mojang.serialization.Dynamic<?> p_312911_)
    • readTypedOrThrow

      public static <T> com.mojang.datafixers.Typed<T> readTypedOrThrow(com.mojang.datafixers.types.Type<T> p_313853_, com.mojang.serialization.Dynamic<?> p_313851_, boolean p_313933_)
    • copyAndAdd

      public static <T> List<T> copyAndAdd(List<T> p_331978_, T p_331554_)
    • copyAndAdd

      public static <T> List<T> copyAndAdd(T p_335459_, List<T> p_335538_)
    • copyAndPut

      public static <K, V> Map<K,V> copyAndPut(Map<K,V> p_330429_, K p_330814_, V p_330949_)