Class Util

java.lang.Object
net.minecraft.util.Util

public class Util
extends Object
  • Field Details

    • NEXT_WORKER_ID

      private static final AtomicInteger NEXT_WORKER_ID
    • BOOTSTRAP_EXECUTOR

      private static final ExecutorService BOOTSTRAP_EXECUTOR
    • MAIN_WORKER_EXECUTOR

      private static final ExecutorService MAIN_WORKER_EXECUTOR
    • IO_WORKER_EXECUTOR

      private static final ExecutorService IO_WORKER_EXECUTOR
    • nanoTimeSupplier

      public static LongSupplier nanoTimeSupplier
    • NIL_UUID

      public static final UUID NIL_UUID
    • LOGGER

      private static final Logger LOGGER
  • Constructor Details

    • Util

      public Util()
  • Method Details

    • toMap

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

      public static <T extends Comparable<T>> String getValueAsString​(Property<T> property, Object object)
    • createTranslationKey

      public static String createTranslationKey​(String type, @Nullable Identifier id)
    • getMeasuringTimeMs

      public static long getMeasuringTimeMs()
    • getMeasuringTimeNano

      public static long getMeasuringTimeNano()
    • getEpochTimeMs

      public static long getEpochTimeMs()
    • createWorker

      private static ExecutorService createWorker​(String name)
    • getBootstrapExecutor

      public static Executor getBootstrapExecutor()
    • getMainWorkerExecutor

      public static Executor getMainWorkerExecutor()
    • getIoWorkerExecutor

      public static Executor getIoWorkerExecutor()
    • shutdownExecutors

      public static void shutdownExecutors()
    • attemptShutdown

      private static void attemptShutdown​(ExecutorService service)
    • createIoWorker

      private static ExecutorService createIoWorker()
    • completeExceptionally

      @Environment(CLIENT) public static <T> CompletableFuture<T> completeExceptionally​(Throwable throwable)
    • throwUnchecked

      @Environment(CLIENT) public static void throwUnchecked​(Throwable throwable)
    • method_18347

      private static void method_18347​(Thread thread, Throwable throwable)
    • getChoiceType

      @Nullable public static com.mojang.datafixers.types.Type<?> getChoiceType​(com.mojang.datafixers.DSL.TypeReference typeReference, String id)
    • getChoiceTypeInternal

      @Nullable private static com.mojang.datafixers.types.Type<?> getChoiceTypeInternal​(com.mojang.datafixers.DSL.TypeReference typeReference, String id)
    • getOperatingSystem

      public static Util.OperatingSystem getOperatingSystem()
    • getJVMFlags

      public static Stream<String> getJVMFlags()
    • getLast

      public static <T> T getLast​(List<T> list)
    • next

      public static <T> T next​(Iterable<T> iterable, @Nullable T t)
    • previous

      public static <T> T previous​(Iterable<T> iterable, @Nullable T t)
    • make

      public static <T> T make​(Supplier<T> factory)
    • make

      public static <T> T make​(T object, Consumer<T> initializer)
    • identityHashStrategy

      public static <K> Hash.Strategy<K> identityHashStrategy()
    • combine

      public static <V> CompletableFuture<List<V>> combine​(List<? extends CompletableFuture<? extends V>> futures)
    • stream

      public static <T> Stream<T> stream​(Optional<? extends T> optional)
    • ifPresentOrElse

      public static <T> Optional<T> ifPresentOrElse​(Optional<T> optional, Consumer<T> consumer, Runnable runnable)
    • debugRunnable

      public static Runnable debugRunnable​(Runnable runnable, Supplier<String> messageSupplier)
    • throwOrPause

      public static <T extends Throwable> T throwOrPause​(T t)
    • getInnermostMessage

      public static String getInnermostMessage​(Throwable t)
    • getRandom

      public static <T> T getRandom​(T[] array, Random random)
    • getRandom

      public static int getRandom​(int[] array, Random random)
    • renameTask

      private static BooleanSupplier renameTask​(Path src, Path dest)
    • deleteTask

      private static BooleanSupplier deleteTask​(Path path)
    • deletionVerifyTask

      private static BooleanSupplier deletionVerifyTask​(Path path)
    • existenceCheckTask

      private static BooleanSupplier existenceCheckTask​(Path path)
    • attemptTasks

      private static boolean attemptTasks​(BooleanSupplier[] booleanSupplier)
    • attemptTasks

      private static boolean attemptTasks​(int retries, String taskName, BooleanSupplier[] tasks)
    • backupAndReplace

      public static void backupAndReplace​(File current, File newFile, File backup)
    • backupAndReplace

      public static void backupAndReplace​(Path current, Path newPath, Path backup)
      Copies current to backup and then replaces current with newPath
    • moveCursor

      @Environment(CLIENT) public static int moveCursor​(String string, int cursor, int delta)
      Moves the cursor in the string by a delta amount. Skips surrogate characters.
    • method_29188

      public static Consumer<String> method_29188​(String string, Consumer<String> consumer)
    • toIntArray

      public static com.mojang.serialization.DataResult<int[]> toIntArray​(IntStream intStream, int length)
    • startTimerHack

      public static void startTimerHack()
    • relativeCopy

      @Environment(CLIENT) public static void relativeCopy​(Path src, Path dest, Path toCopy) throws IOException
      Copies a file contained in the folder src to the folder dest. This will replicate any path structure that may exist between src and toCopy.
      Throws:
      IOException
    • replaceInvalidChars

      @Environment(CLIENT) public static String replaceInvalidChars​(String string, CharPredicate predicate)