Class Util
- Mappings:
Namespace Name named net/minecraft/util/Utilintermediary net/minecraft/class_156official ag
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic enumAn enum representing the operating system of the current platform. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final DateTimeFormatterA locale-independent datetime formatter that usesyyyy-MM-dd_HH.mm.ssas the format string.private static final NameableExecutorstatic final longstatic final intprivate static final NameableExecutorstatic final FileSystemProviderThe file system provider for handling jar and zip files.(package private) static final Loggerprivate static final NameableExecutorprivate static final Stringprivate static final intstatic TimeSupplier.Nanosecondsstatic final UUIDThe "nil UUID" that represents lack of a UUID.static final Ticker -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns a consumer that first prependsprefixto its input string and passes the result toconsumer.static <T> Predicate<T> static <T> Predicate<T> and()static <T> Predicate<T> static <T> Predicate<T> static <T> Predicate<T> static <T> Predicate<T> static <T> Predicate<T> static <T> Predicate<T> and(Predicate<? super T> a, Predicate<? super T> b, Predicate<? super T> c, Predicate<? super T> d, Predicate<? super T> e) static <T> Predicate<T> static <A,B> com.mojang.datafixers.Typed <B> apply(com.mojang.datafixers.Typed<A> typed, com.mojang.datafixers.types.Type<B> type, UnaryOperator<com.mojang.serialization.Dynamic<?>> modifier) private static booleanattemptTasks(int retries, String taskName, BooleanSupplier[] tasks) private static booleanattemptTasks(BooleanSupplier[] tasks) static voidbackupAndReplace(Path current, Path newPath, Path backup) Copiescurrenttobackupand then replacescurrentwithnewPath.static booleanbackupAndReplace(Path current, Path newPath, Path backup, boolean noRestoreOnFail) Copiescurrenttobackupand then replacescurrentwithnewPath.static <K,V> CachedMapper <K, V> cachedMapper(Function<K, V> mapper) static <V> CompletableFuture<List<V>> combine(List<? extends CompletableFuture<? extends V>> futures) Combines a list offuturesinto one future that holds a list of their results.private static <V> CompletableFuture<List<V>> combine(List<? extends CompletableFuture<? extends V>> futures, Consumer<Throwable> exceptionHandler) static <V> CompletableFuture<List<V>> combineCancellable(List<? extends CompletableFuture<? extends V>> futures) Combines a list offuturesinto one future that holds a list of their results.static <V> CompletableFuture<List<V>> combineSafe(List<? extends CompletableFuture<V>> futures) Combines a list offuturesinto one future that holds a list of their results.static <T> List<T> copyShuffled(ObjectArrayList<T> list, Random random) Returns the contents ofstreamcopied to a list and then shuffled.static <T> List<T> copyShuffled(Stream<T> stream, Random random) Returns the contents ofstreamcopied to a list and then shuffled.static <T> List<T> copyShuffled(T[] array, Random random) Returns the contents ofarraycopied to a list and then shuffled.private static NameableExecutorcreateIoWorker(String namePrefix, boolean daemon) static StringcreateTranslationKey(String type, @Nullable Identifier id) Returns the translation key constructed fromtypeandid.private static NameableExecutorcreateWorker(String name) static RunnabledebugRunnable(Runnable runnable, Supplier<String> messageSupplier) static <T> Supplier<T> debugSupplier(Supplier<T> supplier, Supplier<String> messageSupplier) static com.mojang.serialization.DataResult<int[]> decodeFixedLengthArray(IntStream stream, int length) static com.mojang.serialization.DataResult<long[]> decodeFixedLengthArray(LongStream stream, int length) static <T> com.mojang.serialization.DataResult<List<T>> decodeFixedLengthList(List<T> list, int length) private static BooleanSupplierdeleteTask(Path path) private static BooleanSupplierdeletionVerifyTask(Path path) private static BooleanSupplierexistenceCheckTask(Path path) static intstatic @Nullable com.mojang.datafixers.types.Type<?> getChoiceType(com.mojang.datafixers.DSL.TypeReference typeReference, String id) private static @Nullable com.mojang.datafixers.types.Type<?> getChoiceTypeInternal(com.mojang.datafixers.DSL.TypeReference typeReference, String id) static NameableExecutorReturns the executor for download tasks.static longReturns the milliseconds passed since the Unix epoch.static <T extends Throwable>
TgetFatalOrPause(T t) Returns the provided fatal throwable, or pauses the game ifSharedConstants.isDevelopmentistrue.static StringReturns the current time formatted usingDATE_TIME_FORMATTER.static Stringstatic NameableExecutorReturns the executor for disk or network IO tasks.Returns a stream of JVM flags passed when launching.static <T> TReturns the last item oflist.static NameableExecutorReturns the main worker executor for miscellaneous asynchronous tasks.private static intstatic longReturns the current time in milliseconds, to be used for measuring a duration.static longReturns the current time in nanoseconds, to be used for measuring a duration.static Util.OperatingSystemReturns the operating system instance for the current platform.static intReturns a random integer fromarray.static <T> TReturns a random item fromlist.static <T> TReturns a random item fromarray.static <T> Optional<T> getRandomOrEmpty(List<T> list, Random random) Returns anOptionalof a random item fromlist, or an empty optional if the list is empty.static <T extends Comparable<T>>
StringgetValueAsString(Property<T> property, Object value) static <T> Optional<T> ifPresentOrElse(Optional<T> optional, Consumer<T> presentAction, Runnable elseAction) Ifoptionalhas value, callspresentActionwith the value, otherwise callselseAction.static <T> booleanisSymmetrical(int width, int height, List<T> list) static <T> ToIntFunction<T> lastIdentityIndexGetter(List<T> values) Returns a function that, when given a value invalues, returns the last index of the value in the list using identity comparison.static <T> ToIntFunction<T> lastIndexGetter(List<T> values) Returns a function that, when given a value invalues, returns the last index of the value in the list.static voidlogErrorOrPause(String message) Logs an error-level message and pauses the game ifSharedConstants.isDevelopmentistrue.static voidlogErrorOrPause(String message, Throwable throwable) Logs an error-level message and pauses the game ifSharedConstants.isDevelopmentistrue.static <T> TReturns the value supplied fromfactory.static <T> TReturnsobjectinitialized withinitializer.static <K,V> Map <K, V> static <T,U, R> BiFunction <T, U, R> memoize(BiFunction<T, U, R> biFunction) static <T,R> Function <T, R> static intmoveCursor(String string, int cursor, int delta) Moves thecursorin thestringby adeltaamount.static <T> TReturns the item succeedingobjectiniterable.static intnextCapacity(int current, int min) Returns the optimal capacity of a collection given the current capacity.static <T> Predicate<T> or()static <T> Predicate<T> static <T> Predicate<T> static <T> Predicate<T> static <T> Predicate<T> static <T> Predicate<T> static <T> Predicate<T> or(Predicate<? super T> a, Predicate<? super T> b, Predicate<? super T> c, Predicate<? super T> d, Predicate<? super T> e) private static voidstatic <T> TReturns the item precedingobjectiniterable.static <T> com.mojang.datafixers.Typed<T> readTyped(com.mojang.datafixers.types.Type<T> type, com.mojang.serialization.Dynamic<?> value) static <T> com.mojang.datafixers.Typed<T> readTyped(com.mojang.datafixers.types.Type<T> type, com.mojang.serialization.Dynamic<?> value, boolean allowPartial) static <T> StringregistryValueToString(Registry<T> registry, T value) 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 voidrunInNamedZone(Runnable runnable, String name) static voidsetMissingBreakpointHandler(Consumer<String> missingBreakpointHandler) static <T> voidShuffleslist, modifying the passed list in place.static IntArrayListReturns the contents ofstreamcopied to a list and then shuffled.static voidstatic voidstatic voidThrowstif it's aRuntimeException(or any of its subclass), otherwisetwrapped in a RuntimeException.toMap()static <K,V1, V2>
Map<K, V2> transformMapValues(Map<K, V1> map, Function<? super V1, V2> transformer) static <K,V1, V2>
Map<K, V2> transformMapValuesLazy(Map<K, V1> map, Function<V1, V2> transformer) private static voiduncaughtExceptionHandler(Thread thread, Throwable t) static URIvalidateUri(String uri) static <T> CompletableFuture<T> waitAndApply(Function<Executor, CompletableFuture<T>> resultFactory) Runs tasks using the prepare-apply model, such as creation of aSaveLoader.static <T> TwaitAndApply(Function<Executor, T> resultFactory, Predicate<T> donePredicate) Runs tasks using the prepare-apply model.static <T> List<T> withAppended(List<T> list, T valueToAppend) static <T> List<T> withPrepended(T valueToPrepend, List<T> list)
-
Field Details
-
LOGGER
- Mappings:
Namespace Name Mixin selector named LOGGERLnet/minecraft/util/Util;LOGGER:Lorg/slf4j/Logger;intermediary field_1129Lnet/minecraft/class_156;field_1129:Lorg/slf4j/Logger;official gLag;g:Lorg/slf4j/Logger;
-
MAX_PARALLELISM
private static final int MAX_PARALLELISM- See Also:
- Mappings:
Namespace Name Mixin selector named MAX_PARALLELISMLnet/minecraft/util/Util;MAX_PARALLELISM:Iintermediary field_34891Lnet/minecraft/class_156;field_34891:Iofficial hLag;h:I
-
BACKUP_ATTEMPTS
private static final int BACKUP_ATTEMPTS- See Also:
- Mappings:
Namespace Name Mixin selector named BACKUP_ATTEMPTSLnet/minecraft/util/Util;BACKUP_ATTEMPTS:Iintermediary field_46764Lnet/minecraft/class_156;field_46764:Iofficial iLag;i:I
-
MAX_BG_THREADS_PROPERTY
- See Also:
- Mappings:
Namespace Name Mixin selector named MAX_BG_THREADS_PROPERTYLnet/minecraft/util/Util;MAX_BG_THREADS_PROPERTY:Ljava/lang/String;intermediary field_34892Lnet/minecraft/class_156;field_34892:Ljava/lang/String;official jLag;j:Ljava/lang/String;
-
MAIN_WORKER_EXECUTOR
- Mappings:
Namespace Name Mixin selector named MAIN_WORKER_EXECUTORLnet/minecraft/util/Util;MAIN_WORKER_EXECUTOR:Lnet/minecraft/util/thread/NameableExecutor;intermediary field_18035Lnet/minecraft/class_156;field_18035:Lnet/minecraft/class_10207;official kLag;k:Laf;
-
IO_WORKER_EXECUTOR
- Mappings:
Namespace Name Mixin selector named IO_WORKER_EXECUTORLnet/minecraft/util/Util;IO_WORKER_EXECUTOR:Lnet/minecraft/util/thread/NameableExecutor;intermediary field_24477Lnet/minecraft/class_156;field_24477:Lnet/minecraft/class_10207;official lLag;l:Laf;
-
DOWNLOAD_WORKER_EXECUTOR
- Mappings:
Namespace Name Mixin selector named DOWNLOAD_WORKER_EXECUTORLnet/minecraft/util/Util;DOWNLOAD_WORKER_EXECUTOR:Lnet/minecraft/util/thread/NameableExecutor;intermediary field_47571Lnet/minecraft/class_156;field_47571:Lnet/minecraft/class_10207;official mLag;m:Laf;
-
DATE_TIME_FORMATTER
A locale-independent datetime formatter that usesyyyy-MM-dd_HH.mm.ssas the format string. Example:2022-01-01_00.00.00- Mappings:
Namespace Name Mixin selector named DATE_TIME_FORMATTERLnet/minecraft/util/Util;DATE_TIME_FORMATTER:Ljava/time/format/DateTimeFormatter;intermediary field_39824Lnet/minecraft/class_156;field_39824:Ljava/time/format/DateTimeFormatter;official nLag;n:Ljava/time/format/DateTimeFormatter;
-
field_46220
public static final int field_46220- See Also:
- Mappings:
Namespace Name Mixin selector named field_46220Lnet/minecraft/util/Util;field_46220:Iintermediary field_46220Lnet/minecraft/class_156;field_46220:Iofficial aLag;a:I
-
SUPPORTED_URI_PROTOCOLS
- Mappings:
Namespace Name Mixin selector named SUPPORTED_URI_PROTOCOLSLnet/minecraft/util/Util;SUPPORTED_URI_PROTOCOLS:Ljava/util/Set;intermediary field_52196Lnet/minecraft/class_156;field_52196:Ljava/util/Set;official oLag;o:Ljava/util/Set;
-
field_45714
public static final long field_45714- See Also:
- Mappings:
Namespace Name Mixin selector named field_45714Lnet/minecraft/util/Util;field_45714:Jintermediary field_45714Lnet/minecraft/class_156;field_45714:Jofficial bLag;b:J
-
nanoTimeSupplier
- Mappings:
Namespace Name Mixin selector named nanoTimeSupplierLnet/minecraft/util/Util;nanoTimeSupplier:Lnet/minecraft/util/TimeSupplier$Nanoseconds;intermediary field_1128Lnet/minecraft/class_156;field_1128:Lnet/minecraft/class_7576$class_7577;official cLag;c:Lbbc$a;
-
TICKER
- Mappings:
Namespace Name Mixin selector named TICKERLnet/minecraft/util/Util;TICKER:Lcom/google/common/base/Ticker;intermediary field_37250Lnet/minecraft/class_156;field_37250:Lcom/google/common/base/Ticker;official dLag;d:Lcom/google/common/base/Ticker;
-
NIL_UUID
The "nil UUID" that represents lack of a UUID.- Mappings:
Namespace Name Mixin selector named NIL_UUIDLnet/minecraft/util/Util;NIL_UUID:Ljava/util/UUID;intermediary field_25140Lnet/minecraft/class_156;field_25140:Ljava/util/UUID;official eLag;e:Ljava/util/UUID;
-
JAR_FILE_SYSTEM_PROVIDER
The file system provider for handling jar and zip files.- Mappings:
Namespace Name Mixin selector named JAR_FILE_SYSTEM_PROVIDERLnet/minecraft/util/Util;JAR_FILE_SYSTEM_PROVIDER:Ljava/nio/file/spi/FileSystemProvider;intermediary field_33859Lnet/minecraft/class_156;field_33859:Ljava/nio/file/spi/FileSystemProvider;official fLag;f:Ljava/nio/file/spi/FileSystemProvider;
-
missingBreakpointHandler
- Mappings:
Namespace Name Mixin selector named missingBreakpointHandlerLnet/minecraft/util/Util;missingBreakpointHandler:Ljava/util/function/Consumer;intermediary field_34893Lnet/minecraft/class_156;field_34893:Ljava/util/function/Consumer;official pLag;p:Ljava/util/function/Consumer;
-
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
toMap
- Mappings:
Namespace Name Mixin selector named toMapLnet/minecraft/util/Util;toMap()Ljava/util/stream/Collector;intermediary method_664Lnet/minecraft/class_156;method_664()Ljava/util/stream/Collector;official aLag;a()Ljava/util/stream/Collector;
-
toArrayList
- Mappings:
Namespace Name Mixin selector named toArrayListLnet/minecraft/util/Util;toArrayList()Ljava/util/stream/Collector;intermediary method_58579Lnet/minecraft/class_156;method_58579()Ljava/util/stream/Collector;official bLag;b()Ljava/util/stream/Collector;
-
getValueAsString
- Mappings:
Namespace Name Mixin selector named getValueAsStringLnet/minecraft/util/Util;getValueAsString(Lnet/minecraft/state/property/Property;Ljava/lang/Object;)Ljava/lang/String;intermediary method_650Lnet/minecraft/class_156;method_650(Lnet/minecraft/class_2769;Ljava/lang/Object;)Ljava/lang/String;official aLag;a(Lect;Ljava/lang/Object;)Ljava/lang/String;
-
createTranslationKey
Returns the translation key constructed fromtypeandid.If
idisnull,unregistered_sadfaceis used as the ID.- Returns:
- the translation key constructed from
typeandid - See Also:
- Mappings:
Namespace Name Mixin selector named createTranslationKeyLnet/minecraft/util/Util;createTranslationKey(Ljava/lang/String;Lnet/minecraft/util/Identifier;)Ljava/lang/String;intermediary method_646Lnet/minecraft/class_156;method_646(Ljava/lang/String;Lnet/minecraft/class_2960;)Ljava/lang/String;official aLag;a(Ljava/lang/String;Lalr;)Ljava/lang/String;
-
getMeasuringTimeMs
public static long getMeasuringTimeMs()Returns the current time in milliseconds, to be used for measuring a duration.This is not the Unix epoch time, and can only be used to determine the duration between two calls of this method.
- Returns:
- the current time in milliseconds, to be used for measuring a duration
- See Also:
- Mappings:
Namespace Name Mixin selector named getMeasuringTimeMsLnet/minecraft/util/Util;getMeasuringTimeMs()Jintermediary method_658Lnet/minecraft/class_156;method_658()Jofficial cLag;c()J
-
getMeasuringTimeNano
public static long getMeasuringTimeNano()Returns the current time in nanoseconds, to be used for measuring a duration.This is not the Unix epoch time, and can only be used to determine the duration between two calls of this method.
- Returns:
- the current time in nanoseconds, to be used for measuring a duration
- See Also:
- Mappings:
Namespace Name Mixin selector named getMeasuringTimeNanoLnet/minecraft/util/Util;getMeasuringTimeNano()Jintermediary method_648Lnet/minecraft/class_156;method_648()Jofficial dLag;d()J
-
getEpochTimeMs
public static long getEpochTimeMs()Returns the milliseconds passed since the Unix epoch.This should be used to display or store the current time.
getMeasuringTimeMs()should be used for determining the duration between two calls.- Returns:
- the milliseconds passed since the Unix epoch
- See Also:
- Mappings:
Namespace Name Mixin selector named getEpochTimeMsLnet/minecraft/util/Util;getEpochTimeMs()Jintermediary method_659Lnet/minecraft/class_156;method_659()Jofficial eLag;e()J
-
getFormattedCurrentTime
Returns the current time formatted usingDATE_TIME_FORMATTER.- Returns:
- the current time formatted using
DATE_TIME_FORMATTER - Mappings:
Namespace Name Mixin selector named getFormattedCurrentTimeLnet/minecraft/util/Util;getFormattedCurrentTime()Ljava/lang/String;intermediary method_44893Lnet/minecraft/class_156;method_44893()Ljava/lang/String;official fLag;f()Ljava/lang/String;
-
createWorker
- Mappings:
Namespace Name Mixin selector named createWorkerLnet/minecraft/util/Util;createWorker(Ljava/lang/String;)Lnet/minecraft/util/thread/NameableExecutor;intermediary method_28122Lnet/minecraft/class_156;method_28122(Ljava/lang/String;)Lnet/minecraft/class_10207;official cLag;c(Ljava/lang/String;)Laf;
-
getAvailableBackgroundThreads
public static int getAvailableBackgroundThreads()- Mappings:
Namespace Name Mixin selector named getAvailableBackgroundThreadsLnet/minecraft/util/Util;getAvailableBackgroundThreads()Iintermediary method_65951Lnet/minecraft/class_156;method_65951()Iofficial gLag;g()I
-
getMaxBackgroundThreads
private static int getMaxBackgroundThreads()- Mappings:
Namespace Name Mixin selector named getMaxBackgroundThreadsLnet/minecraft/util/Util;getMaxBackgroundThreads()Iintermediary method_38648Lnet/minecraft/class_156;method_38648()Iofficial qLag;q()I
-
getMainWorkerExecutor
Returns the main worker executor for miscellaneous asynchronous tasks.- Returns:
- the main worker executor for miscellaneous asynchronous tasks
- Mappings:
Namespace Name Mixin selector named getMainWorkerExecutorLnet/minecraft/util/Util;getMainWorkerExecutor()Lnet/minecraft/util/thread/NameableExecutor;intermediary method_18349Lnet/minecraft/class_156;method_18349()Lnet/minecraft/class_10207;official hLag;h()Laf;
-
getIoWorkerExecutor
Returns the executor for disk or network IO tasks.- Returns:
- the executor for disk or network IO tasks
- Mappings:
Namespace Name Mixin selector named getIoWorkerExecutorLnet/minecraft/util/Util;getIoWorkerExecutor()Lnet/minecraft/util/thread/NameableExecutor;intermediary method_27958Lnet/minecraft/class_156;method_27958()Lnet/minecraft/class_10207;official iLag;i()Laf;
-
getDownloadWorkerExecutor
Returns the executor for download tasks.- Returns:
- the executor for download tasks
- Mappings:
Namespace Name Mixin selector named getDownloadWorkerExecutorLnet/minecraft/util/Util;getDownloadWorkerExecutor()Lnet/minecraft/util/thread/NameableExecutor;intermediary method_55473Lnet/minecraft/class_156;method_55473()Lnet/minecraft/class_10207;official jLag;j()Laf;
-
shutdownExecutors
public static void shutdownExecutors()- Mappings:
Namespace Name Mixin selector named shutdownExecutorsLnet/minecraft/util/Util;shutdownExecutors()Vintermediary method_18350Lnet/minecraft/class_156;method_18350()Vofficial kLag;k()V
-
createIoWorker
- Mappings:
Namespace Name Mixin selector named createIoWorkerLnet/minecraft/util/Util;createIoWorker(Ljava/lang/String;Z)Lnet/minecraft/util/thread/NameableExecutor;intermediary method_27959Lnet/minecraft/class_156;method_27959(Ljava/lang/String;Z)Lnet/minecraft/class_10207;official aLag;a(Ljava/lang/String;Z)Laf;
-
throwUnchecked
Throwstif it's aRuntimeException(or any of its subclass), otherwisetwrapped in a RuntimeException.Erroris wrapped as well, despite being unchecked.- Mappings:
Namespace Name Mixin selector named throwUncheckedLnet/minecraft/util/Util;throwUnchecked(Ljava/lang/Throwable;)Vintermediary method_24155Lnet/minecraft/class_156;method_24155(Ljava/lang/Throwable;)Vofficial aLag;a(Ljava/lang/Throwable;)V
-
uncaughtExceptionHandler
- Mappings:
Namespace Name Mixin selector named uncaughtExceptionHandlerLnet/minecraft/util/Util;uncaughtExceptionHandler(Ljava/lang/Thread;Ljava/lang/Throwable;)Vintermediary method_18347Lnet/minecraft/class_156;method_18347(Ljava/lang/Thread;Ljava/lang/Throwable;)Vofficial aLag;a(Ljava/lang/Thread;Ljava/lang/Throwable;)V
-
getChoiceType
@Nullable public static @Nullable com.mojang.datafixers.types.Type<?> getChoiceType(com.mojang.datafixers.DSL.TypeReference typeReference, String id) - Mappings:
Namespace Name Mixin selector named getChoiceTypeLnet/minecraft/util/Util;getChoiceType(Lcom/mojang/datafixers/DSL$TypeReference;Ljava/lang/String;)Lcom/mojang/datafixers/types/Type;intermediary method_29187Lnet/minecraft/class_156;method_29187(Lcom/mojang/datafixers/DSL$TypeReference;Ljava/lang/String;)Lcom/mojang/datafixers/types/Type;official aLag;a(Lcom/mojang/datafixers/DSL$TypeReference;Ljava/lang/String;)Lcom/mojang/datafixers/types/Type;
-
getChoiceTypeInternal
@Nullable private static @Nullable com.mojang.datafixers.types.Type<?> getChoiceTypeInternal(com.mojang.datafixers.DSL.TypeReference typeReference, String id) - Mappings:
Namespace Name Mixin selector named getChoiceTypeInternalLnet/minecraft/util/Util;getChoiceTypeInternal(Lcom/mojang/datafixers/DSL$TypeReference;Ljava/lang/String;)Lcom/mojang/datafixers/types/Type;intermediary method_29191Lnet/minecraft/class_156;method_29191(Lcom/mojang/datafixers/DSL$TypeReference;Ljava/lang/String;)Lcom/mojang/datafixers/types/Type;official bLag;b(Lcom/mojang/datafixers/DSL$TypeReference;Ljava/lang/String;)Lcom/mojang/datafixers/types/Type;
-
runInNamedZone
- Mappings:
Namespace Name Mixin selector named runInNamedZoneLnet/minecraft/util/Util;runInNamedZone(Ljava/lang/Runnable;Ljava/lang/String;)Vintermediary method_64122Lnet/minecraft/class_156;method_64122(Ljava/lang/Runnable;Ljava/lang/String;)Vofficial aLag;a(Ljava/lang/Runnable;Ljava/lang/String;)V
-
registryValueToString
- Mappings:
Namespace Name Mixin selector named registryValueToStringLnet/minecraft/util/Util;registryValueToString(Lnet/minecraft/registry/Registry;Ljava/lang/Object;)Ljava/lang/String;intermediary method_57107Lnet/minecraft/class_156;method_57107(Lnet/minecraft/class_2378;Ljava/lang/Object;)Ljava/lang/String;official aLag;a(Ljt;Ljava/lang/Object;)Ljava/lang/String;
-
and
- Mappings:
Namespace Name Mixin selector named andLnet/minecraft/util/Util;and()Ljava/util/function/Predicate;intermediary method_61210Lnet/minecraft/class_156;method_61210()Ljava/util/function/Predicate;official lLag;l()Ljava/util/function/Predicate;
-
and
- Mappings:
Namespace Name Mixin selector named andLnet/minecraft/util/Util;and(Ljava/util/function/Predicate;)Ljava/util/function/Predicate;intermediary method_61189Lnet/minecraft/class_156;method_61189(Ljava/util/function/Predicate;)Ljava/util/function/Predicate;official aLag;a(Ljava/util/function/Predicate;)Ljava/util/function/Predicate;
-
and
- Mappings:
Namespace Name Mixin selector named andLnet/minecraft/util/Util;and(Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;intermediary method_61190Lnet/minecraft/class_156;method_61190(Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;official aLag;a(Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;
-
and
public static <T> Predicate<T> and(Predicate<? super T> a, Predicate<? super T> b, Predicate<? super T> c) - Mappings:
Namespace Name Mixin selector named andLnet/minecraft/util/Util;and(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;intermediary method_61192Lnet/minecraft/class_156;method_61192(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;official aLag;a(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;
-
and
public static <T> Predicate<T> and(Predicate<? super T> a, Predicate<? super T> b, Predicate<? super T> c, Predicate<? super T> d) - Mappings:
Namespace Name Mixin selector named andLnet/minecraft/util/Util;and(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;intermediary method_61194Lnet/minecraft/class_156;method_61194(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;official aLag;a(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;
-
and
public static <T> Predicate<T> and(Predicate<? super T> a, Predicate<? super T> b, Predicate<? super T> c, Predicate<? super T> d, Predicate<? super T> e) - Mappings:
Namespace Name Mixin selector named andLnet/minecraft/util/Util;and(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;intermediary method_61196Lnet/minecraft/class_156;method_61196(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;official aLag;a(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;
-
and
- Mappings:
Namespace Name Mixin selector named andLnet/minecraft/util/Util;and([Ljava/util/function/Predicate;)Ljava/util/function/Predicate;intermediary method_61198Lnet/minecraft/class_156;method_61198([Ljava/util/function/Predicate;)Ljava/util/function/Predicate;official aLag;a([Ljava/util/function/Predicate;)Ljava/util/function/Predicate;
-
allOf
- Mappings:
Namespace Name Mixin selector named allOfLnet/minecraft/util/Util;allOf(Ljava/util/List;)Ljava/util/function/Predicate;intermediary method_56613Lnet/minecraft/class_156;method_56613(Ljava/util/List;)Ljava/util/function/Predicate;official aLag;a(Ljava/util/List;)Ljava/util/function/Predicate;
-
or
- Mappings:
Namespace Name Mixin selector named orLnet/minecraft/util/Util;or()Ljava/util/function/Predicate;intermediary method_61211Lnet/minecraft/class_156;method_61211()Ljava/util/function/Predicate;official mLag;m()Ljava/util/function/Predicate;
-
or
- Mappings:
Namespace Name Mixin selector named orLnet/minecraft/util/Util;or(Ljava/util/function/Predicate;)Ljava/util/function/Predicate;intermediary method_61199Lnet/minecraft/class_156;method_61199(Ljava/util/function/Predicate;)Ljava/util/function/Predicate;official bLag;b(Ljava/util/function/Predicate;)Ljava/util/function/Predicate;
-
or
- Mappings:
Namespace Name Mixin selector named orLnet/minecraft/util/Util;or(Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;intermediary method_61200Lnet/minecraft/class_156;method_61200(Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;official bLag;b(Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;
-
or
public static <T> Predicate<T> or(Predicate<? super T> a, Predicate<? super T> b, Predicate<? super T> c) - Mappings:
Namespace Name Mixin selector named orLnet/minecraft/util/Util;or(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;intermediary method_61202Lnet/minecraft/class_156;method_61202(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;official bLag;b(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;
-
or
public static <T> Predicate<T> or(Predicate<? super T> a, Predicate<? super T> b, Predicate<? super T> c, Predicate<? super T> d) - Mappings:
Namespace Name Mixin selector named orLnet/minecraft/util/Util;or(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;intermediary method_61204Lnet/minecraft/class_156;method_61204(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;official bLag;b(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;
-
or
public static <T> Predicate<T> or(Predicate<? super T> a, Predicate<? super T> b, Predicate<? super T> c, Predicate<? super T> d, Predicate<? super T> e) - Mappings:
Namespace Name Mixin selector named orLnet/minecraft/util/Util;or(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;intermediary method_61206Lnet/minecraft/class_156;method_61206(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;official bLag;b(Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;Ljava/util/function/Predicate;)Ljava/util/function/Predicate;
-
or
- Mappings:
Namespace Name Mixin selector named orLnet/minecraft/util/Util;or([Ljava/util/function/Predicate;)Ljava/util/function/Predicate;intermediary method_61208Lnet/minecraft/class_156;method_61208([Ljava/util/function/Predicate;)Ljava/util/function/Predicate;official bLag;b([Ljava/util/function/Predicate;)Ljava/util/function/Predicate;
-
anyOf
- Mappings:
Namespace Name Mixin selector named anyOfLnet/minecraft/util/Util;anyOf(Ljava/util/List;)Ljava/util/function/Predicate;intermediary method_56616Lnet/minecraft/class_156;method_56616(Ljava/util/List;)Ljava/util/function/Predicate;official bLag;b(Ljava/util/List;)Ljava/util/function/Predicate;
-
isSymmetrical
- Mappings:
Namespace Name Mixin selector named isSymmetricalLnet/minecraft/util/Util;isSymmetrical(IILjava/util/List;)Zintermediary method_59901Lnet/minecraft/class_156;method_59901(IILjava/util/List;)Zofficial aLag;a(IILjava/util/List;)Z
-
nextCapacity
public static int nextCapacity(int current, int min) Returns the optimal capacity of a collection given the current capacity.- Returns:
- the optimal capacity of a collection given the current capacity
- Mappings:
Namespace Name Mixin selector named nextCapacityLnet/minecraft/util/Util;nextCapacity(II)Iintermediary method_68172Lnet/minecraft/class_156;method_68172(II)Iofficial aLag;a(II)I
-
getOperatingSystem
Returns the operating system instance for the current platform.- Returns:
- the operating system instance for the current platform
- API Note:
- This is used for opening links.
- Implementation Note:
- This uses the
os.namesystem property to determine the operating system. - Mappings:
Namespace Name Mixin selector named getOperatingSystemLnet/minecraft/util/Util;getOperatingSystem()Lnet/minecraft/util/Util$OperatingSystem;intermediary method_668Lnet/minecraft/class_156;method_668()Lnet/minecraft/class_156$class_158;official nLag;n()Lag$a;
-
validateUri
- Throws:
URISyntaxException- Mappings:
Namespace Name Mixin selector named validateUriLnet/minecraft/util/Util;validateUri(Ljava/lang/String;)Ljava/net/URI;intermediary method_60931Lnet/minecraft/class_156;method_60931(Ljava/lang/String;)Ljava/net/URI;official aLag;a(Ljava/lang/String;)Ljava/net/URI;
-
getJVMFlags
Returns a stream of JVM flags passed when launching.The streamed strings include the
-Xprefix.- Returns:
- a stream of JVM flags passed when launching
- Mappings:
Namespace Name Mixin selector named getJVMFlagsLnet/minecraft/util/Util;getJVMFlags()Ljava/util/stream/Stream;intermediary method_651Lnet/minecraft/class_156;method_651()Ljava/util/stream/Stream;official oLag;o()Ljava/util/stream/Stream;
-
getLast
Returns the last item oflist.- Returns:
- the last item of
list - Throws:
IndexOutOfBoundsException- iflistis empty- Mappings:
Namespace Name Mixin selector named getLastLnet/minecraft/util/Util;getLast(Ljava/util/List;)Ljava/lang/Object;intermediary method_20793Lnet/minecraft/class_156;method_20793(Ljava/util/List;)Ljava/lang/Object;official cLag;c(Ljava/util/List;)Ljava/lang/Object;
-
next
Returns the item succeedingobjectiniterable.- Returns:
- the item succeeding
objectiniterable - Implementation Note:
- If
objectisnull, this returns the first item of the iterable. Ifobjectis not initerable, this enters into an infinite loop.objectis compared using the==operator. - Mappings:
Namespace Name Mixin selector named nextLnet/minecraft/util/Util;next(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/lang/Object;intermediary method_660Lnet/minecraft/class_156;method_660(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/lang/Object;official aLag;a(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/lang/Object;
-
previous
Returns the item precedingobjectiniterable.If
objectis not initerable, this returns the last item of the iterable.objectis compared using the==operator.- Returns:
- the item preceding
objectiniterable - Mappings:
Namespace Name Mixin selector named previousLnet/minecraft/util/Util;previous(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/lang/Object;intermediary method_645Lnet/minecraft/class_156;method_645(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/lang/Object;official bLag;b(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/lang/Object;
-
make
Returns the value supplied fromfactory.This is useful when initializing static fields:
private static final Map<String, String> MAP = Util.make(() -> { Map<String, String> map = new HashMap<>(); map.put("example", "hello"); return map; });- Returns:
- the value supplied from
factory - Mappings:
Namespace Name Mixin selector named makeLnet/minecraft/util/Util;make(Ljava/util/function/Supplier;)Ljava/lang/Object;intermediary method_656Lnet/minecraft/class_156;method_656(Ljava/util/function/Supplier;)Ljava/lang/Object;official aLag;a(Ljava/util/function/Supplier;)Ljava/lang/Object;
-
make
Returnsobjectinitialized withinitializer.This is useful when initializing static fields:
private static final Map<String, String> MAP = Util.make(new HashMap<>(), (map) -> { map.put("example", "hello"); });- Returns:
objectinitialized withinitializer- Mappings:
Namespace Name Mixin selector named makeLnet/minecraft/util/Util;make(Ljava/lang/Object;Ljava/util/function/Consumer;)Ljava/lang/Object;intermediary method_654Lnet/minecraft/class_156;method_654(Ljava/lang/Object;Ljava/util/function/Consumer;)Ljava/lang/Object;official aLag;a(Ljava/lang/Object;Ljava/util/function/Consumer;)Ljava/lang/Object;
-
mapEnum
- Mappings:
Namespace Name Mixin selector named mapEnumLnet/minecraft/util/Util;mapEnum(Ljava/lang/Class;Ljava/util/function/Function;)Ljava/util/Map;intermediary method_63541Lnet/minecraft/class_156;method_63541(Ljava/lang/Class;Ljava/util/function/Function;)Ljava/util/Map;official aLag;a(Ljava/lang/Class;Ljava/util/function/Function;)Ljava/util/Map;
-
transformMapValues
public static <K,V1, Map<K,V2> V2> transformMapValues(Map<K, V1> map, Function<? super V1, V2> transformer) - Mappings:
Namespace Name Mixin selector named transformMapValuesLnet/minecraft/util/Util;transformMapValues(Ljava/util/Map;Ljava/util/function/Function;)Ljava/util/Map;intermediary method_65968Lnet/minecraft/class_156;method_65968(Ljava/util/Map;Ljava/util/function/Function;)Ljava/util/Map;official aLag;a(Ljava/util/Map;Ljava/util/function/Function;)Ljava/util/Map;
-
transformMapValuesLazy
public static <K,V1, Map<K,V2> V2> transformMapValuesLazy(Map<K, V1> map, Function<V1, V2> transformer) - Mappings:
Namespace Name Mixin selector named transformMapValuesLazyLnet/minecraft/util/Util;transformMapValuesLazy(Ljava/util/Map;Lcom/google/common/base/Function;)Ljava/util/Map;intermediary method_65967Lnet/minecraft/class_156;method_65967(Ljava/util/Map;Lcom/google/common/base/Function;)Ljava/util/Map;official aLag;a(Ljava/util/Map;Lcom/google/common/base/Function;)Ljava/util/Map;
-
combineSafe
public static <V> CompletableFuture<List<V>> combineSafe(List<? extends CompletableFuture<V>> futures) Combines a list offuturesinto one future that holds a list of their results.This version expects all futures to complete successfully and is not optimized in case any of the input futures throws.
- Parameters:
futures- the completable futures to combine- Returns:
- the combined future
- See Also:
- Mappings:
Namespace Name Mixin selector named combineSafeLnet/minecraft/util/Util;combineSafe(Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;intermediary method_33791Lnet/minecraft/class_156;method_33791(Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;official dLag;d(Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;
-
combine
public static <V> CompletableFuture<List<V>> combine(List<? extends CompletableFuture<? extends V>> futures) Combines a list offuturesinto one future that holds a list of their results.The returned future is fail-fast; if any of the input futures fails, this returned future will be immediately completed exceptionally than waiting for other input futures.
- Parameters:
futures- the completable futures to combine- Returns:
- the combined future
- See Also:
- Mappings:
Namespace Name Mixin selector named combineLnet/minecraft/util/Util;combine(Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;intermediary method_652Lnet/minecraft/class_156;method_652(Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;official eLag;e(Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;
-
combineCancellable
public static <V> CompletableFuture<List<V>> combineCancellable(List<? extends CompletableFuture<? extends V>> futures) Combines a list offuturesinto one future that holds a list of their results.The returned future is fail-fast; if any of the input futures fails, this returned future will be immediately completed exceptionally than waiting for other input futures. Additionally, all other futures will be canceled.
- Returns:
- the combined future
- See Also:
- Mappings:
Namespace Name Mixin selector named combineCancellableLnet/minecraft/util/Util;combineCancellable(Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;intermediary method_43373Lnet/minecraft/class_156;method_43373(Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;official fLag;f(Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;
-
combine
private static <V> CompletableFuture<List<V>> combine(List<? extends CompletableFuture<? extends V>> futures, Consumer<Throwable> exceptionHandler) - Mappings:
Namespace Name Mixin selector named combineLnet/minecraft/util/Util;combine(Ljava/util/List;Ljava/util/function/Consumer;)Ljava/util/concurrent/CompletableFuture;intermediary method_43370Lnet/minecraft/class_156;method_43370(Ljava/util/List;Ljava/util/function/Consumer;)Ljava/util/concurrent/CompletableFuture;official aLag;a(Ljava/util/List;Ljava/util/function/Consumer;)Ljava/util/concurrent/CompletableFuture;
-
ifPresentOrElse
public static <T> Optional<T> ifPresentOrElse(Optional<T> optional, Consumer<T> presentAction, Runnable elseAction) Ifoptionalhas value, callspresentActionwith the value, otherwise callselseAction.- Returns:
- the passed
optional - Mappings:
Namespace Name Mixin selector named ifPresentOrElseLnet/minecraft/util/Util;ifPresentOrElse(Ljava/util/Optional;Ljava/util/function/Consumer;Ljava/lang/Runnable;)Ljava/util/Optional;intermediary method_17974Lnet/minecraft/class_156;method_17974(Ljava/util/Optional;Ljava/util/function/Consumer;Ljava/lang/Runnable;)Ljava/util/Optional;official aLag;a(Ljava/util/Optional;Ljava/util/function/Consumer;Ljava/lang/Runnable;)Ljava/util/Optional;
-
debugSupplier
- Mappings:
Namespace Name Mixin selector named debugSupplierLnet/minecraft/util/Util;debugSupplier(Ljava/util/function/Supplier;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;intermediary method_41238Lnet/minecraft/class_156;method_41238(Ljava/util/function/Supplier;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;official aLag;a(Ljava/util/function/Supplier;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;
-
debugRunnable
- Mappings:
Namespace Name Mixin selector named debugRunnableLnet/minecraft/util/Util;debugRunnable(Ljava/lang/Runnable;Ljava/util/function/Supplier;)Ljava/lang/Runnable;intermediary method_18839Lnet/minecraft/class_156;method_18839(Ljava/lang/Runnable;Ljava/util/function/Supplier;)Ljava/lang/Runnable;official aLag;a(Ljava/lang/Runnable;Ljava/util/function/Supplier;)Ljava/lang/Runnable;
-
logErrorOrPause
Logs an error-level message and pauses the game ifSharedConstants.isDevelopmentistrue.- Parameters:
message- the log message- Mappings:
Namespace Name Mixin selector named logErrorOrPauseLnet/minecraft/util/Util;logErrorOrPause(Ljava/lang/String;)Vintermediary method_33559Lnet/minecraft/class_156;method_33559(Ljava/lang/String;)Vofficial bLag;b(Ljava/lang/String;)V
-
logErrorOrPause
Logs an error-level message and pauses the game ifSharedConstants.isDevelopmentistrue.- Parameters:
message- the log messagethrowable- a throwable related to the log message- Mappings:
Namespace Name Mixin selector named logErrorOrPauseLnet/minecraft/util/Util;logErrorOrPause(Ljava/lang/String;Ljava/lang/Throwable;)Vintermediary method_39977Lnet/minecraft/class_156;method_39977(Ljava/lang/String;Ljava/lang/Throwable;)Vofficial aLag;a(Ljava/lang/String;Ljava/lang/Throwable;)V
-
getFatalOrPause
Returns the provided fatal throwable, or pauses the game ifSharedConstants.isDevelopmentistrue.This method is usually chained with a
throwstatement:throw Util.getFatalOrPause(theFatalException);- Parameters:
t- the throwable- Returns:
- the provided throwable
- Mappings:
Namespace Name Mixin selector named getFatalOrPauseLnet/minecraft/util/Util;getFatalOrPause(Ljava/lang/Throwable;)Ljava/lang/Throwable;intermediary method_22320Lnet/minecraft/class_156;method_22320(Ljava/lang/Throwable;)Ljava/lang/Throwable;official bLag;b(Ljava/lang/Throwable;)Ljava/lang/Throwable;
-
setMissingBreakpointHandler
- Mappings:
Namespace Name Mixin selector named setMissingBreakpointHandlerLnet/minecraft/util/Util;setMissingBreakpointHandler(Ljava/util/function/Consumer;)Vintermediary method_38646Lnet/minecraft/class_156;method_38646(Ljava/util/function/Consumer;)Vofficial aLag;a(Ljava/util/function/Consumer;)V
-
pause
- Mappings:
Namespace Name Mixin selector named pauseLnet/minecraft/util/Util;pause(Ljava/lang/String;)Vintermediary method_33560Lnet/minecraft/class_156;method_33560(Ljava/lang/String;)Vofficial dLag;d(Ljava/lang/String;)V
-
getInnermostMessage
- Mappings:
Namespace Name Mixin selector named getInnermostMessageLnet/minecraft/util/Util;getInnermostMessage(Ljava/lang/Throwable;)Ljava/lang/String;intermediary method_22321Lnet/minecraft/class_156;method_22321(Ljava/lang/Throwable;)Ljava/lang/String;official cLag;c(Ljava/lang/Throwable;)Ljava/lang/String;
-
getRandom
Returns a random item fromarray.- Returns:
- a random item from
array - Throws:
IllegalArgumentException- ifarrayis empty- Mappings:
Namespace Name Mixin selector named getRandomLnet/minecraft/util/Util;getRandom([Ljava/lang/Object;Lnet/minecraft/util/math/random/Random;)Ljava/lang/Object;intermediary method_27173Lnet/minecraft/class_156;method_27173([Ljava/lang/Object;Lnet/minecraft/class_5819;)Ljava/lang/Object;official aLag;a([Ljava/lang/Object;Lbai;)Ljava/lang/Object;
-
getRandom
Returns a random integer fromarray.- Returns:
- a random integer from
array - Throws:
IllegalArgumentException- ifarrayis empty- Mappings:
Namespace Name Mixin selector named getRandomLnet/minecraft/util/Util;getRandom([ILnet/minecraft/util/math/random/Random;)Iintermediary method_27172Lnet/minecraft/class_156;method_27172([ILnet/minecraft/class_5819;)Iofficial aLag;a([ILbai;)I
-
getRandom
Returns a random item fromlist.- Returns:
- a random item from
list - Throws:
IllegalArgumentException- iflistis empty- See Also:
- Mappings:
Namespace Name Mixin selector named getRandomLnet/minecraft/util/Util;getRandom(Ljava/util/List;Lnet/minecraft/util/math/random/Random;)Ljava/lang/Object;intermediary method_32309Lnet/minecraft/class_156;method_32309(Ljava/util/List;Lnet/minecraft/class_5819;)Ljava/lang/Object;official aLag;a(Ljava/util/List;Lbai;)Ljava/lang/Object;
-
getRandomOrEmpty
Returns anOptionalof a random item fromlist, or an empty optional if the list is empty.- Returns:
- an
Optionalof a random item fromlist, or an empty optional if the list is empty - See Also:
- Mappings:
Namespace Name Mixin selector named getRandomOrEmptyLnet/minecraft/util/Util;getRandomOrEmpty(Ljava/util/List;Lnet/minecraft/util/math/random/Random;)Ljava/util/Optional;intermediary method_40083Lnet/minecraft/class_156;method_40083(Ljava/util/List;Lnet/minecraft/class_5819;)Ljava/util/Optional;official bLag;b(Ljava/util/List;Lbai;)Ljava/util/Optional;
-
renameTask
- Mappings:
Namespace Name Mixin selector named renameTaskLnet/minecraft/util/Util;renameTask(Ljava/nio/file/Path;Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;intermediary method_30625Lnet/minecraft/class_156;method_30625(Ljava/nio/file/Path;Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;official aLag;a(Ljava/nio/file/Path;Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;
-
deleteTask
- Mappings:
Namespace Name Mixin selector named deleteTaskLnet/minecraft/util/Util;deleteTask(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;intermediary method_30624Lnet/minecraft/class_156;method_30624(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;official aLag;a(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;
-
deletionVerifyTask
- Mappings:
Namespace Name Mixin selector named deletionVerifyTaskLnet/minecraft/util/Util;deletionVerifyTask(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;intermediary method_30628Lnet/minecraft/class_156;method_30628(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;official bLag;b(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;
-
existenceCheckTask
- Mappings:
Namespace Name Mixin selector named existenceCheckTaskLnet/minecraft/util/Util;existenceCheckTask(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;intermediary method_30629Lnet/minecraft/class_156;method_30629(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;official cLag;c(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;
-
attemptTasks
- Mappings:
Namespace Name Mixin selector named attemptTasksLnet/minecraft/util/Util;attemptTasks([Ljava/util/function/BooleanSupplier;)Zintermediary method_30627Lnet/minecraft/class_156;method_30627([Ljava/util/function/BooleanSupplier;)Zofficial aLag;a([Ljava/util/function/BooleanSupplier;)Z
-
attemptTasks
- Mappings:
Namespace Name Mixin selector named attemptTasksLnet/minecraft/util/Util;attemptTasks(ILjava/lang/String;[Ljava/util/function/BooleanSupplier;)Zintermediary method_30622Lnet/minecraft/class_156;method_30622(ILjava/lang/String;[Ljava/util/function/BooleanSupplier;)Zofficial aLag;a(ILjava/lang/String;[Ljava/util/function/BooleanSupplier;)Z
-
backupAndReplace
Copiescurrenttobackupand then replacescurrentwithnewPath.- Mappings:
Namespace Name Mixin selector named backupAndReplaceLnet/minecraft/util/Util;backupAndReplace(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;)Vintermediary method_30626Lnet/minecraft/class_156;method_30626(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;)Vofficial aLag;a(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;)V
-
backupAndReplace
public static boolean backupAndReplace(Path current, Path newPath, Path backup, boolean noRestoreOnFail) Copiescurrenttobackupand then replacescurrentwithnewPath.- Parameters:
noRestoreOnFail- iftrue, does not restore the current file when replacing fails- Mappings:
Namespace Name Mixin selector named backupAndReplaceLnet/minecraft/util/Util;backupAndReplace(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;Z)Zintermediary method_41204Lnet/minecraft/class_156;method_41204(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;Z)Zofficial aLag;a(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;Z)Z
-
moveCursor
Moves thecursorin thestringby adeltaamount. Skips surrogate characters.- Mappings:
Namespace Name Mixin selector named moveCursorLnet/minecraft/util/Util;moveCursor(Ljava/lang/String;II)Iintermediary method_27761Lnet/minecraft/class_156;method_27761(Ljava/lang/String;II)Iofficial aLag;a(Ljava/lang/String;II)I
-
addPrefix
Returns a consumer that first prependsprefixto its input string and passes the result toconsumer.- Returns:
- a consumer that first prepends
prefixto its input string and passes the result toconsumer - API Note:
- This is useful in codec-based deserialization when passing the
error consumer to some methods, e.g.
Util.addPrefix("Could not parse Example", LOGGER::error). - Mappings:
Namespace Name Mixin selector named addPrefixLnet/minecraft/util/Util;addPrefix(Ljava/lang/String;Ljava/util/function/Consumer;)Ljava/util/function/Consumer;intermediary method_29188Lnet/minecraft/class_156;method_29188(Ljava/lang/String;Ljava/util/function/Consumer;)Ljava/util/function/Consumer;official aLag;a(Ljava/lang/String;Ljava/util/function/Consumer;)Ljava/util/function/Consumer;
-
decodeFixedLengthArray
public static com.mojang.serialization.DataResult<int[]> decodeFixedLengthArray(IntStream stream, int length) - Mappings:
Namespace Name Mixin selector named decodeFixedLengthArrayLnet/minecraft/util/Util;decodeFixedLengthArray(Ljava/util/stream/IntStream;I)Lcom/mojang/serialization/DataResult;intermediary method_29190Lnet/minecraft/class_156;method_29190(Ljava/util/stream/IntStream;I)Lcom/mojang/serialization/DataResult;official aLag;a(Ljava/util/stream/IntStream;I)Lcom/mojang/serialization/DataResult;
-
decodeFixedLengthArray
public static com.mojang.serialization.DataResult<long[]> decodeFixedLengthArray(LongStream stream, int length) - Mappings:
Namespace Name Mixin selector named decodeFixedLengthArrayLnet/minecraft/util/Util;decodeFixedLengthArray(Ljava/util/stream/LongStream;I)Lcom/mojang/serialization/DataResult;intermediary method_51822Lnet/minecraft/class_156;method_51822(Ljava/util/stream/LongStream;I)Lcom/mojang/serialization/DataResult;official aLag;a(Ljava/util/stream/LongStream;I)Lcom/mojang/serialization/DataResult;
-
decodeFixedLengthList
public static <T> com.mojang.serialization.DataResult<List<T>> decodeFixedLengthList(List<T> list, int length) - Mappings:
Namespace Name Mixin selector named decodeFixedLengthListLnet/minecraft/util/Util;decodeFixedLengthList(Ljava/util/List;I)Lcom/mojang/serialization/DataResult;intermediary method_33141Lnet/minecraft/class_156;method_33141(Ljava/util/List;I)Lcom/mojang/serialization/DataResult;official aLag;a(Ljava/util/List;I)Lcom/mojang/serialization/DataResult;
-
startTimerHack
public static void startTimerHack()- Mappings:
Namespace Name Mixin selector named startTimerHackLnet/minecraft/util/Util;startTimerHack()Vintermediary method_29476Lnet/minecraft/class_156;method_29476()Vofficial pLag;p()V
-
relativeCopy
Copies a file contained in the foldersrcto the folderdest. This will replicate any path structure that may exist betweensrcandtoCopy.- Throws:
IOException- Mappings:
Namespace Name Mixin selector named relativeCopyLnet/minecraft/util/Util;relativeCopy(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;)Vintermediary method_29775Lnet/minecraft/class_156;method_29775(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;)Vofficial bLag;b(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;)V
-
replaceInvalidChars
- Mappings:
Namespace Name Mixin selector named replaceInvalidCharsLnet/minecraft/util/Util;replaceInvalidChars(Ljava/lang/String;Lnet/minecraft/util/function/CharPredicate;)Ljava/lang/String;intermediary method_30309Lnet/minecraft/class_156;method_30309(Ljava/lang/String;Lnet/minecraft/class_5462;)Ljava/lang/String;official aLag;a(Ljava/lang/String;Ln;)Ljava/lang/String;
-
cachedMapper
- Mappings:
Namespace Name Mixin selector named cachedMapperLnet/minecraft/util/Util;cachedMapper(Ljava/util/function/Function;)Lnet/minecraft/util/CachedMapper;intermediary method_48746Lnet/minecraft/class_156;method_48746(Ljava/util/function/Function;)Lnet/minecraft/class_8105;official aLag;a(Ljava/util/function/Function;)Lbar;
-
memoize
- Mappings:
Namespace Name Mixin selector named memoizeLnet/minecraft/util/Util;memoize(Ljava/util/function/Function;)Ljava/util/function/Function;intermediary method_34866Lnet/minecraft/class_156;method_34866(Ljava/util/function/Function;)Ljava/util/function/Function;official bLag;b(Ljava/util/function/Function;)Ljava/util/function/Function;
-
memoize
- Mappings:
Namespace Name Mixin selector named memoizeLnet/minecraft/util/Util;memoize(Ljava/util/function/BiFunction;)Ljava/util/function/BiFunction;intermediary method_34865Lnet/minecraft/class_156;method_34865(Ljava/util/function/BiFunction;)Ljava/util/function/BiFunction;official aLag;a(Ljava/util/function/BiFunction;)Ljava/util/function/BiFunction;
-
copyShuffled
Returns the contents ofstreamcopied to a list and then shuffled.- Returns:
- the contents of
streamcopied to a list and then shuffled - Mappings:
Namespace Name Mixin selector named copyShuffledLnet/minecraft/util/Util;copyShuffled(Ljava/util/stream/Stream;Lnet/minecraft/util/math/random/Random;)Ljava/util/List;intermediary method_43252Lnet/minecraft/class_156;method_43252(Ljava/util/stream/Stream;Lnet/minecraft/class_5819;)Ljava/util/List;official aLag;a(Ljava/util/stream/Stream;Lbai;)Ljava/util/List;
-
shuffle
Returns the contents ofstreamcopied to a list and then shuffled.- Returns:
- the contents of
streamcopied to a list and then shuffled - Mappings:
Namespace Name Mixin selector named shuffleLnet/minecraft/util/Util;shuffle(Ljava/util/stream/IntStream;Lnet/minecraft/util/math/random/Random;)Lit/unimi/dsi/fastutil/ints/IntArrayList;intermediary method_43251Lnet/minecraft/class_156;method_43251(Ljava/util/stream/IntStream;Lnet/minecraft/class_5819;)Lit/unimi/dsi/fastutil/ints/IntArrayList;official aLag;a(Ljava/util/stream/IntStream;Lbai;)Lit/unimi/dsi/fastutil/ints/IntArrayList;
-
copyShuffled
Returns the contents ofarraycopied to a list and then shuffled.- Returns:
- the contents of
arraycopied to a list and then shuffled - Mappings:
Namespace Name Mixin selector named copyShuffledLnet/minecraft/util/Util;copyShuffled([Ljava/lang/Object;Lnet/minecraft/util/math/random/Random;)Ljava/util/List;intermediary method_43253Lnet/minecraft/class_156;method_43253([Ljava/lang/Object;Lnet/minecraft/class_5819;)Ljava/util/List;official bLag;b([Ljava/lang/Object;Lbai;)Ljava/util/List;
-
copyShuffled
Returns the contents ofstreamcopied to a list and then shuffled.- Returns:
- the contents of
streamcopied to a list and then shuffled - Mappings:
Namespace Name Mixin selector named copyShuffledLnet/minecraft/util/Util;copyShuffled(Lit/unimi/dsi/fastutil/objects/ObjectArrayList;Lnet/minecraft/util/math/random/Random;)Ljava/util/List;intermediary method_43027Lnet/minecraft/class_156;method_43027(Lit/unimi/dsi/fastutil/objects/ObjectArrayList;Lnet/minecraft/class_5819;)Ljava/util/List;official aLag;a(Lit/unimi/dsi/fastutil/objects/ObjectArrayList;Lbai;)Ljava/util/List;
-
shuffle
Shuffleslist, modifying the passed list in place.- Mappings:
Namespace Name Mixin selector named shuffleLnet/minecraft/util/Util;shuffle(Ljava/util/List;Lnet/minecraft/util/math/random/Random;)Vintermediary method_43028Lnet/minecraft/class_156;method_43028(Ljava/util/List;Lnet/minecraft/class_5819;)Vofficial cLag;c(Ljava/util/List;Lbai;)V
-
waitAndApply
public static <T> CompletableFuture<T> waitAndApply(Function<Executor, CompletableFuture<T>> resultFactory) Runs tasks using the prepare-apply model, such as creation of aSaveLoader.- Parameters:
resultFactory- a function that takes the apply-stage executor and returns the future- API Note:
- This method takes a function that supplies an executor to use in the apply stage. Inside the function, callers should run the preparation, and use the passed executor for applying.
- Mappings:
Namespace Name Mixin selector named waitAndApplyLnet/minecraft/util/Util;waitAndApply(Ljava/util/function/Function;)Ljava/util/concurrent/CompletableFuture;intermediary method_43499Lnet/minecraft/class_156;method_43499(Ljava/util/function/Function;)Ljava/util/concurrent/CompletableFuture;official cLag;c(Ljava/util/function/Function;)Ljava/util/concurrent/CompletableFuture;
-
waitAndApply
Runs tasks using the prepare-apply model.- Parameters:
resultFactory- a function that takes the apply-stage executor and returns the preliminary resultdonePredicate- a predicate that, given the result, checks whether applying has finished- API Note:
- This method takes a function that supplies an executor to use in the apply stage. Inside the function, callers should run the preparation, and use the passed executor for applying.
- Mappings:
Namespace Name Mixin selector named waitAndApplyLnet/minecraft/util/Util;waitAndApply(Ljava/util/function/Function;Ljava/util/function/Predicate;)Ljava/lang/Object;intermediary method_43498Lnet/minecraft/class_156;method_43498(Ljava/util/function/Function;Ljava/util/function/Predicate;)Ljava/lang/Object;official aLag;a(Ljava/util/function/Function;Ljava/util/function/Predicate;)Ljava/lang/Object;
-
lastIndexGetter
Returns a function that, when given a value invalues, returns the last index of the value in the list.- Returns:
- a function that, when given a value in
values, returns the last index of the value in the list - See Also:
- Implementation Note:
- Unlike
List.lastIndexOf(java.lang.Object), the returned function will return0when given values not in the passed list. - Mappings:
Namespace Name Mixin selector named lastIndexGetterLnet/minecraft/util/Util;lastIndexGetter(Ljava/util/List;)Ljava/util/function/ToIntFunction;intermediary method_43658Lnet/minecraft/class_156;method_43658(Ljava/util/List;)Ljava/util/function/ToIntFunction;official gLag;g(Ljava/util/List;)Ljava/util/function/ToIntFunction;
-
lastIdentityIndexGetter
Returns a function that, when given a value invalues, returns the last index of the value in the list using identity comparison.- Returns:
- a function that, when given a value in
values, returns the last index of the value in the list using identity comparison - See Also:
- Implementation Note:
- Unlike
List.lastIndexOf(java.lang.Object), the returned function will return0when given values not in the passed list. - Mappings:
Namespace Name Mixin selector named lastIdentityIndexGetterLnet/minecraft/util/Util;lastIdentityIndexGetter(Ljava/util/List;)Ljava/util/function/ToIntFunction;intermediary method_53909Lnet/minecraft/class_156;method_53909(Ljava/util/List;)Ljava/util/function/ToIntFunction;official hLag;h(Ljava/util/List;)Ljava/util/function/ToIntFunction;
-
apply
public static <A,B> com.mojang.datafixers.Typed<B> apply(com.mojang.datafixers.Typed<A> typed, com.mojang.datafixers.types.Type<B> type, UnaryOperator<com.mojang.serialization.Dynamic<?>> modifier) - Mappings:
Namespace Name Mixin selector named applyLnet/minecraft/util/Util;apply(Lcom/mojang/datafixers/Typed;Lcom/mojang/datafixers/types/Type;Ljava/util/function/UnaryOperator;)Lcom/mojang/datafixers/Typed;intermediary method_54907Lnet/minecraft/class_156;method_54907(Lcom/mojang/datafixers/Typed;Lcom/mojang/datafixers/types/Type;Ljava/util/function/UnaryOperator;)Lcom/mojang/datafixers/Typed;official aLag;a(Lcom/mojang/datafixers/Typed;Lcom/mojang/datafixers/types/Type;Ljava/util/function/UnaryOperator;)Lcom/mojang/datafixers/Typed;
-
readTyped
public static <T> com.mojang.datafixers.Typed<T> readTyped(com.mojang.datafixers.types.Type<T> type, com.mojang.serialization.Dynamic<?> value) - Mappings:
Namespace Name Mixin selector named readTypedLnet/minecraft/util/Util;readTyped(Lcom/mojang/datafixers/types/Type;Lcom/mojang/serialization/Dynamic;)Lcom/mojang/datafixers/Typed;intermediary method_54908Lnet/minecraft/class_156;method_54908(Lcom/mojang/datafixers/types/Type;Lcom/mojang/serialization/Dynamic;)Lcom/mojang/datafixers/Typed;official aLag;a(Lcom/mojang/datafixers/types/Type;Lcom/mojang/serialization/Dynamic;)Lcom/mojang/datafixers/Typed;
-
readTyped
public static <T> com.mojang.datafixers.Typed<T> readTyped(com.mojang.datafixers.types.Type<T> type, com.mojang.serialization.Dynamic<?> value, boolean allowPartial) - Mappings:
Namespace Name Mixin selector named readTypedLnet/minecraft/util/Util;readTyped(Lcom/mojang/datafixers/types/Type;Lcom/mojang/serialization/Dynamic;Z)Lcom/mojang/datafixers/Typed;intermediary method_55333Lnet/minecraft/class_156;method_55333(Lcom/mojang/datafixers/types/Type;Lcom/mojang/serialization/Dynamic;Z)Lcom/mojang/datafixers/Typed;official aLag;a(Lcom/mojang/datafixers/types/Type;Lcom/mojang/serialization/Dynamic;Z)Lcom/mojang/datafixers/Typed;
-
withAppended
- Mappings:
Namespace Name Mixin selector named withAppendedLnet/minecraft/util/Util;withAppended(Ljava/util/List;Ljava/lang/Object;)Ljava/util/List;intermediary method_57108Lnet/minecraft/class_156;method_57108(Ljava/util/List;Ljava/lang/Object;)Ljava/util/List;official aLag;a(Ljava/util/List;Ljava/lang/Object;)Ljava/util/List;
-
withPrepended
- Mappings:
Namespace Name Mixin selector named withPrependedLnet/minecraft/util/Util;withPrepended(Ljava/lang/Object;Ljava/util/List;)Ljava/util/List;intermediary method_58272Lnet/minecraft/class_156;method_58272(Ljava/lang/Object;Ljava/util/List;)Ljava/util/List;official aLag;a(Ljava/lang/Object;Ljava/util/List;)Ljava/util/List;
-
mapWith
- Mappings:
Namespace Name Mixin selector named mapWithLnet/minecraft/util/Util;mapWith(Ljava/util/Map;Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/Map;intermediary method_57109Lnet/minecraft/class_156;method_57109(Ljava/util/Map;Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/Map;official aLag;a(Ljava/util/Map;Ljava/lang/Object;Ljava/lang/Object;)Ljava/util/Map;
-