Class Util
- Mappings:
Namespace Name official ac
intermediary net/minecraft/class_156
named net/minecraft/util/Util
-
Nested Class Summary
Modifier and TypeClassDescriptionprivate static enum
static enum
An enum representing the operating system of the current platform. -
Field Summary
Modifier and TypeFieldDescriptionprivate static final DateTimeFormatter
A locale-independent datetime formatter that usesyyyy-MM-dd_HH.mm.ss
as the format string.static final long
private static final ExecutorService
static final FileSystemProvider
The file system provider for handling jar and zip files.(package private) static final Logger
private static final ExecutorService
private static final String
private static final int
static TimeSupplier.Nanoseconds
private static final AtomicInteger
static final UUID
The "nil UUID" that represents lack of a UUID.static final Ticker
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionReturns a consumer that first prependsprefix
to its input string and passes the result toconsumer
.private static void
attemptShutdown
(ExecutorService service) private static boolean
attemptTasks
(int retries, String taskName, BooleanSupplier[] tasks) private static boolean
attemptTasks
(BooleanSupplier[] tasks) static void
backupAndReplace
(File current, File newFile, File backup) Copiescurrent
tobackup
and then replacescurrent
withnewPath
.static void
backupAndReplace
(File current, File newPath, File backup, boolean noRestoreOnFail) Copiescurrent
tobackup
and then replacescurrent
withnewPath
.static void
backupAndReplace
(Path current, Path newPath, Path backup) Copiescurrent
tobackup
and then replacescurrent
withnewPath
.static void
backupAndReplace
(Path current, Path newPath, Path backup, boolean noRestoreOnFail) Copiescurrent
tobackup
and then replacescurrent
withnewPath
.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 offutures
into 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 offutures
into one future that holds a list of their results.static <V> CompletableFuture<List<V>>
combineSafe
(List<? extends CompletableFuture<V>> futures) Combines a list offutures
into one future that holds a list of their results.static <T> List<T>
copyShuffled
(ObjectArrayList<T> list, Random random) Returns the contents ofstream
copied to a list and then shuffled.static <T> List<T>
copyShuffled
(Stream<T> stream, Random random) Returns the contents ofstream
copied to a list and then shuffled.static <T> List<T>
copyShuffled
(T[] array, Random random) Returns the contents ofarray
copied to a list and then shuffled.private static ExecutorService
static String
createTranslationKey
(String type, @Nullable Identifier id) Returns the translation key constructed fromtype
andid
.private static ExecutorService
createWorker
(String name) static Runnable
debugRunnable
(Runnable runnable, Supplier<String> messageSupplier) static Runnable
debugRunnable
(String activeThreadName, Runnable task) static <V> Supplier<V>
debugSupplier
(String activeThreadName, Supplier<V> supplier) 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 BooleanSupplier
deleteTask
(Path path) private static BooleanSupplier
deletionVerifyTask
(Path path) static void
static void
private static BooleanSupplier
existenceCheckTask
(Path path) static @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 long
Returns the milliseconds passed since the Unix epoch.static String
Returns the current time formatted usingDATE_TIME_FORMATTER
.static String
static ExecutorService
Returns the executor for disk or network IO tasks.Returns a stream of JVM flags passed when launching.static <T> T
Returns the last item oflist
.static ExecutorService
Returns the main worker executor for miscellaneous asynchronous tasks.private static int
static long
Returns the current time in milliseconds, to be used for measuring a duration.static long
Returns the current time in nanoseconds, to be used for measuring a duration.static Util.OperatingSystem
Returns the operating system instance for the current platform.static int
Returns a random integer fromarray
.static <T> T
Returns a random item fromlist
.static <T> T
Returns a random item fromarray
.static <T> Optional<T>
getRandomOrEmpty
(List<T> list, Random random) Returns anOptional
of a random item fromlist
, or an empty optional if the list is empty.static <T,
E extends Exception>
TReturns the result wrapped inresult
.static <T extends Comparable<T>>
StringgetValueAsString
(Property<T> property, Object value) static <K> Hash.Strategy<K>
Returns theHash.Strategy
that uses identity comparison.static <T> Optional<T>
ifPresentOrElse
(Optional<T> optional, Consumer<T> presentAction, Runnable elseAction) Ifoptional
has value, callspresentAction
with the value, otherwise callselseAction
.static boolean
static boolean
isWhitespace
(int c) Returns whetherc
represents a space character.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 <T> ToIntFunction<T>
lastIndexGetter
(List<T> values, IntFunction<Object2IntMap<T>> mapCreator) Returns a function that, when given a value invalues
, returns the last index of the value in the list.static <T> T
Returns the value supplied fromfactory
.static <T> T
Returnsobject
initialized withinitializer
.static <T,
U, R> BiFunction<T, U, R> memoize
(BiFunction<T, U, R> biFunction) static <T,
R> Function<T, R> static int
moveCursor
(String string, int cursor, int delta) Moves thecursor
in thestring
by adelta
amount.static <T> T
Returns the item succeedingobject
initerable
.private static void
static <T> T
Returns the item precedingobject
initerable
.static void
relativeCopy
(Path src, Path dest, Path toCopy) Copies a file contained in the foldersrc
to the folderdest
.private static BooleanSupplier
renameTask
(Path src, Path dest) static String
replaceInvalidChars
(String string, CharPredicate predicate) static void
setMissingBreakpointHandler
(Consumer<String> missingBreakpointHandler) static <T> void
shuffle
(ObjectArrayList<T> list, Random random) Shuffleslist
, modifying the passed list in place.static IntArrayList
Returns the contents ofstream
copied to a list and then shuffled.static void
static void
static <T extends Throwable>
TthrowOrPause
(T t) static void
Throwst
if it's aRuntimeException
(or any of its subclass), otherwiset
wrapped in a RuntimeException.toMap()
private static void
uncaughtExceptionHandler
(Thread thread, Throwable t) static <T> CompletableFuture<T>
waitAndApply
(Function<Executor, CompletableFuture<T>> resultFactory) Runs tasks using the prepare-apply model, such as creation of aSaveLoader
.static <T> T
waitAndApply
(Function<Executor, T> resultFactory, Predicate<T> donePredicate) Runs tasks using the prepare-apply model.
-
Field Details
-
LOGGER
- Mappings:
Namespace Name Mixin selector official f
Lac;f:Lorg/slf4j/Logger;
intermediary field_1129
Lnet/minecraft/class_156;field_1129:Lorg/slf4j/Logger;
named LOGGER
Lnet/minecraft/util/Util;LOGGER:Lorg/slf4j/Logger;
-
MAX_PARALLELISM
private static final int MAX_PARALLELISM- See Also:
- Mappings:
Namespace Name Mixin selector official g
Lac;g:I
intermediary field_34891
Lnet/minecraft/class_156;field_34891:I
named MAX_PARALLELISM
Lnet/minecraft/util/Util;MAX_PARALLELISM:I
-
MAX_BG_THREADS_PROPERTY
- See Also:
- Mappings:
Namespace Name Mixin selector official h
Lac;h:Ljava/lang/String;
intermediary field_34892
Lnet/minecraft/class_156;field_34892:Ljava/lang/String;
named MAX_BG_THREADS_PROPERTY
Lnet/minecraft/util/Util;MAX_BG_THREADS_PROPERTY:Ljava/lang/String;
-
NEXT_WORKER_ID
- Mappings:
Namespace Name Mixin selector official i
Lac;i:Ljava/util/concurrent/atomic/AtomicInteger;
intermediary field_18034
Lnet/minecraft/class_156;field_18034:Ljava/util/concurrent/atomic/AtomicInteger;
named NEXT_WORKER_ID
Lnet/minecraft/util/Util;NEXT_WORKER_ID:Ljava/util/concurrent/atomic/AtomicInteger;
-
MAIN_WORKER_EXECUTOR
- Mappings:
Namespace Name Mixin selector official j
Lac;j:Ljava/util/concurrent/ExecutorService;
intermediary field_18035
Lnet/minecraft/class_156;field_18035:Ljava/util/concurrent/ExecutorService;
named MAIN_WORKER_EXECUTOR
Lnet/minecraft/util/Util;MAIN_WORKER_EXECUTOR:Ljava/util/concurrent/ExecutorService;
-
IO_WORKER_EXECUTOR
- Mappings:
Namespace Name Mixin selector official k
Lac;k:Ljava/util/concurrent/ExecutorService;
intermediary field_24477
Lnet/minecraft/class_156;field_24477:Ljava/util/concurrent/ExecutorService;
named IO_WORKER_EXECUTOR
Lnet/minecraft/util/Util;IO_WORKER_EXECUTOR:Ljava/util/concurrent/ExecutorService;
-
DATE_TIME_FORMATTER
A locale-independent datetime formatter that usesyyyy-MM-dd_HH.mm.ss
as the format string. Example:2022-01-01_00.00.00
- Mappings:
Namespace Name Mixin selector official l
Lac;l:Ljava/time/format/DateTimeFormatter;
intermediary field_39824
Lnet/minecraft/class_156;field_39824:Ljava/time/format/DateTimeFormatter;
named DATE_TIME_FORMATTER
Lnet/minecraft/util/Util;DATE_TIME_FORMATTER:Ljava/time/format/DateTimeFormatter;
-
field_45714
public static final long field_45714- See Also:
- Mappings:
Namespace Name Mixin selector official a
Lac;a:J
intermediary field_45714
Lnet/minecraft/class_156;field_45714:J
named field_45714
Lnet/minecraft/util/Util;field_45714:J
-
nanoTimeSupplier
- Mappings:
Namespace Name Mixin selector official b
Lac;b:Last$a;
intermediary field_1128
Lnet/minecraft/class_156;field_1128:Lnet/minecraft/class_7576$class_7577;
named nanoTimeSupplier
Lnet/minecraft/util/Util;nanoTimeSupplier:Lnet/minecraft/util/TimeSupplier$Nanoseconds;
-
TICKER
- Mappings:
Namespace Name Mixin selector official c
Lac;c:Lcom/google/common/base/Ticker;
intermediary field_37250
Lnet/minecraft/class_156;field_37250:Lcom/google/common/base/Ticker;
named TICKER
Lnet/minecraft/util/Util;TICKER:Lcom/google/common/base/Ticker;
-
NIL_UUID
The "nil UUID" that represents lack of a UUID.- Mappings:
Namespace Name Mixin selector official d
Lac;d:Ljava/util/UUID;
intermediary field_25140
Lnet/minecraft/class_156;field_25140:Ljava/util/UUID;
named NIL_UUID
Lnet/minecraft/util/Util;NIL_UUID:Ljava/util/UUID;
-
JAR_FILE_SYSTEM_PROVIDER
The file system provider for handling jar and zip files.- Mappings:
Namespace Name Mixin selector official e
Lac;e:Ljava/nio/file/spi/FileSystemProvider;
intermediary field_33859
Lnet/minecraft/class_156;field_33859:Ljava/nio/file/spi/FileSystemProvider;
named JAR_FILE_SYSTEM_PROVIDER
Lnet/minecraft/util/Util;JAR_FILE_SYSTEM_PROVIDER:Ljava/nio/file/spi/FileSystemProvider;
-
missingBreakpointHandler
- Mappings:
Namespace Name Mixin selector official m
Lac;m:Ljava/util/function/Consumer;
intermediary field_34893
Lnet/minecraft/class_156;field_34893:Ljava/util/function/Consumer;
named missingBreakpointHandler
Lnet/minecraft/util/Util;missingBreakpointHandler:Ljava/util/function/Consumer;
-
-
Constructor Details
-
Util
public Util()
-
-
Method Details
-
toMap
- Mappings:
Namespace Name Mixin selector official a
Lac;a()Ljava/util/stream/Collector;
intermediary method_664
Lnet/minecraft/class_156;method_664()Ljava/util/stream/Collector;
named toMap
Lnet/minecraft/util/Util;toMap()Ljava/util/stream/Collector;
-
getValueAsString
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ldgm;Ljava/lang/Object;)Ljava/lang/String;
intermediary method_650
Lnet/minecraft/class_156;method_650(Lnet/minecraft/class_2769;Ljava/lang/Object;)Ljava/lang/String;
named getValueAsString
Lnet/minecraft/util/Util;getValueAsString(Lnet/minecraft/state/property/Property;Ljava/lang/Object;)Ljava/lang/String;
-
createTranslationKey
Returns the translation key constructed fromtype
andid
.If
id
isnull
,unregistered_sadface
is used as the ID.- Returns:
- the translation key constructed from
type
andid
- See Also:
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/lang/String;Laew;)Ljava/lang/String;
intermediary method_646
Lnet/minecraft/class_156;method_646(Ljava/lang/String;Lnet/minecraft/class_2960;)Ljava/lang/String;
named createTranslationKey
Lnet/minecraft/util/Util;createTranslationKey(Ljava/lang/String;Lnet/minecraft/util/Identifier;)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 official b
Lac;b()J
intermediary method_658
Lnet/minecraft/class_156;method_658()J
named getMeasuringTimeMs
Lnet/minecraft/util/Util;getMeasuringTimeMs()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 official c
Lac;c()J
intermediary method_648
Lnet/minecraft/class_156;method_648()J
named getMeasuringTimeNano
Lnet/minecraft/util/Util;getMeasuringTimeNano()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 official d
Lac;d()J
intermediary method_659
Lnet/minecraft/class_156;method_659()J
named getEpochTimeMs
Lnet/minecraft/util/Util;getEpochTimeMs()J
-
getFormattedCurrentTime
Returns the current time formatted usingDATE_TIME_FORMATTER
.- Returns:
- the current time formatted using
DATE_TIME_FORMATTER
- Mappings:
Namespace Name Mixin selector official e
Lac;e()Ljava/lang/String;
intermediary method_44893
Lnet/minecraft/class_156;method_44893()Ljava/lang/String;
named getFormattedCurrentTime
Lnet/minecraft/util/Util;getFormattedCurrentTime()Ljava/lang/String;
-
createWorker
- Mappings:
Namespace Name Mixin selector official c
Lac;c(Ljava/lang/String;)Ljava/util/concurrent/ExecutorService;
intermediary method_28122
Lnet/minecraft/class_156;method_28122(Ljava/lang/String;)Ljava/util/concurrent/ExecutorService;
named createWorker
Lnet/minecraft/util/Util;createWorker(Ljava/lang/String;)Ljava/util/concurrent/ExecutorService;
-
getMaxBackgroundThreads
private static int getMaxBackgroundThreads()- Mappings:
Namespace Name Mixin selector official m
Lac;m()I
intermediary method_38648
Lnet/minecraft/class_156;method_38648()I
named getMaxBackgroundThreads
Lnet/minecraft/util/Util;getMaxBackgroundThreads()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 official f
Lac;f()Ljava/util/concurrent/ExecutorService;
intermediary method_18349
Lnet/minecraft/class_156;method_18349()Ljava/util/concurrent/ExecutorService;
named getMainWorkerExecutor
Lnet/minecraft/util/Util;getMainWorkerExecutor()Ljava/util/concurrent/ExecutorService;
-
getIoWorkerExecutor
Returns the executor for disk or network IO tasks.- Returns:
- the executor for disk or network IO tasks
- Mappings:
Namespace Name Mixin selector official g
Lac;g()Ljava/util/concurrent/ExecutorService;
intermediary method_27958
Lnet/minecraft/class_156;method_27958()Ljava/util/concurrent/ExecutorService;
named getIoWorkerExecutor
Lnet/minecraft/util/Util;getIoWorkerExecutor()Ljava/util/concurrent/ExecutorService;
-
shutdownExecutors
public static void shutdownExecutors()- Mappings:
Namespace Name Mixin selector official h
Lac;h()V
intermediary method_18350
Lnet/minecraft/class_156;method_18350()V
named shutdownExecutors
Lnet/minecraft/util/Util;shutdownExecutors()V
-
attemptShutdown
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/util/concurrent/ExecutorService;)V
intermediary method_27957
Lnet/minecraft/class_156;method_27957(Ljava/util/concurrent/ExecutorService;)V
named attemptShutdown
Lnet/minecraft/util/Util;attemptShutdown(Ljava/util/concurrent/ExecutorService;)V
-
createIoWorker
- Mappings:
Namespace Name Mixin selector official n
Lac;n()Ljava/util/concurrent/ExecutorService;
intermediary method_27959
Lnet/minecraft/class_156;method_27959()Ljava/util/concurrent/ExecutorService;
named createIoWorker
Lnet/minecraft/util/Util;createIoWorker()Ljava/util/concurrent/ExecutorService;
-
throwUnchecked
Throwst
if it's aRuntimeException
(or any of its subclass), otherwiset
wrapped in a RuntimeException.Error
is wrapped as well, despite being unchecked.- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/lang/Throwable;)V
intermediary method_24155
Lnet/minecraft/class_156;method_24155(Ljava/lang/Throwable;)V
named throwUnchecked
Lnet/minecraft/util/Util;throwUnchecked(Ljava/lang/Throwable;)V
-
uncaughtExceptionHandler
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/lang/Thread;Ljava/lang/Throwable;)V
intermediary method_18347
Lnet/minecraft/class_156;method_18347(Ljava/lang/Thread;Ljava/lang/Throwable;)V
named uncaughtExceptionHandler
Lnet/minecraft/util/Util;uncaughtExceptionHandler(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 official a
Lac;a(Lcom/mojang/datafixers/DSL$TypeReference;Ljava/lang/String;)Lcom/mojang/datafixers/types/Type;
intermediary method_29187
Lnet/minecraft/class_156;method_29187(Lcom/mojang/datafixers/DSL$TypeReference;Ljava/lang/String;)Lcom/mojang/datafixers/types/Type;
named getChoiceType
Lnet/minecraft/util/Util;getChoiceType(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 official b
Lac;b(Lcom/mojang/datafixers/DSL$TypeReference;Ljava/lang/String;)Lcom/mojang/datafixers/types/Type;
intermediary method_29191
Lnet/minecraft/class_156;method_29191(Lcom/mojang/datafixers/DSL$TypeReference;Ljava/lang/String;)Lcom/mojang/datafixers/types/Type;
named getChoiceTypeInternal
Lnet/minecraft/util/Util;getChoiceTypeInternal(Lcom/mojang/datafixers/DSL$TypeReference;Ljava/lang/String;)Lcom/mojang/datafixers/types/Type;
-
debugRunnable
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;
intermediary method_33787
Lnet/minecraft/class_156;method_33787(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;
named debugRunnable
Lnet/minecraft/util/Util;debugRunnable(Ljava/lang/String;Ljava/lang/Runnable;)Ljava/lang/Runnable;
-
debugSupplier
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;
intermediary method_37910
Lnet/minecraft/class_156;method_37910(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;
named debugSupplier
Lnet/minecraft/util/Util;debugSupplier(Ljava/lang/String;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;
-
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.name
system property to determine the operating system. - Mappings:
Namespace Name Mixin selector official i
Lac;i()Lac$b;
intermediary method_668
Lnet/minecraft/class_156;method_668()Lnet/minecraft/class_156$class_158;
named getOperatingSystem
Lnet/minecraft/util/Util;getOperatingSystem()Lnet/minecraft/util/Util$OperatingSystem;
-
getJVMFlags
Returns a stream of JVM flags passed when launching.The streamed strings include the
-X
prefix.- Returns:
- a stream of JVM flags passed when launching
- Mappings:
Namespace Name Mixin selector official j
Lac;j()Ljava/util/stream/Stream;
intermediary method_651
Lnet/minecraft/class_156;method_651()Ljava/util/stream/Stream;
named getJVMFlags
Lnet/minecraft/util/Util;getJVMFlags()Ljava/util/stream/Stream;
-
getLast
Returns the last item oflist
.- Returns:
- the last item of
list
- Throws:
IndexOutOfBoundsException
- iflist
is empty- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/util/List;)Ljava/lang/Object;
intermediary method_20793
Lnet/minecraft/class_156;method_20793(Ljava/util/List;)Ljava/lang/Object;
named getLast
Lnet/minecraft/util/Util;getLast(Ljava/util/List;)Ljava/lang/Object;
-
next
Returns the item succeedingobject
initerable
.- Returns:
- the item succeeding
object
initerable
- Implementation Note:
- If
object
isnull
, this returns the first item of the iterable. Ifobject
is not initerable
, this enters into an infinite loop.object
is compared using the==
operator. - Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/lang/Object;
intermediary method_660
Lnet/minecraft/class_156;method_660(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/lang/Object;
named next
Lnet/minecraft/util/Util;next(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/lang/Object;
-
previous
Returns the item precedingobject
initerable
.If
object
is not initerable
, this returns the last item of the iterable.object
is compared using the==
operator.- Returns:
- the item preceding
object
initerable
- Mappings:
Namespace Name Mixin selector official b
Lac;b(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/lang/Object;
intermediary method_645
Lnet/minecraft/class_156;method_645(Ljava/lang/Iterable;Ljava/lang/Object;)Ljava/lang/Object;
named previous
Lnet/minecraft/util/Util;previous(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 official a
Lac;a(Ljava/util/function/Supplier;)Ljava/lang/Object;
intermediary method_656
Lnet/minecraft/class_156;method_656(Ljava/util/function/Supplier;)Ljava/lang/Object;
named make
Lnet/minecraft/util/Util;make(Ljava/util/function/Supplier;)Ljava/lang/Object;
-
make
Returnsobject
initialized 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:
object
initialized withinitializer
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/lang/Object;Ljava/util/function/Consumer;)Ljava/lang/Object;
intermediary method_654
Lnet/minecraft/class_156;method_654(Ljava/lang/Object;Ljava/util/function/Consumer;)Ljava/lang/Object;
named make
Lnet/minecraft/util/Util;make(Ljava/lang/Object;Ljava/util/function/Consumer;)Ljava/lang/Object;
-
identityHashStrategy
Returns theHash.Strategy
that uses identity comparison.fastutil's "reference" object types should be used instead in most cases.
- Returns:
- the
Hash.Strategy
that uses identity comparison - Mappings:
Namespace Name Mixin selector official k
Lac;k()Lit/unimi/dsi/fastutil/Hash$Strategy;
intermediary method_655
Lnet/minecraft/class_156;method_655()Lit/unimi/dsi/fastutil/Hash$Strategy;
named identityHashStrategy
Lnet/minecraft/util/Util;identityHashStrategy()Lit/unimi/dsi/fastutil/Hash$Strategy;
-
combineSafe
public static <V> CompletableFuture<List<V>> combineSafe(List<? extends CompletableFuture<V>> futures) Combines a list offutures
into 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 official b
Lac;b(Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;
intermediary method_33791
Lnet/minecraft/class_156;method_33791(Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;
named combineSafe
Lnet/minecraft/util/Util;combineSafe(Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;
-
combine
public static <V> CompletableFuture<List<V>> combine(List<? extends CompletableFuture<? extends V>> futures) Combines a list offutures
into 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 official c
Lac;c(Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;
intermediary method_652
Lnet/minecraft/class_156;method_652(Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;
named combine
Lnet/minecraft/util/Util;combine(Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;
-
combineCancellable
public static <V> CompletableFuture<List<V>> combineCancellable(List<? extends CompletableFuture<? extends V>> futures) Combines a list offutures
into 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 official d
Lac;d(Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;
intermediary method_43373
Lnet/minecraft/class_156;method_43373(Ljava/util/List;)Ljava/util/concurrent/CompletableFuture;
named combineCancellable
Lnet/minecraft/util/Util;combineCancellable(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 official a
Lac;a(Ljava/util/List;Ljava/util/function/Consumer;)Ljava/util/concurrent/CompletableFuture;
intermediary method_43370
Lnet/minecraft/class_156;method_43370(Ljava/util/List;Ljava/util/function/Consumer;)Ljava/util/concurrent/CompletableFuture;
named combine
Lnet/minecraft/util/Util;combine(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) Ifoptional
has value, callspresentAction
with the value, otherwise callselseAction
.- Returns:
- the passed
optional
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/util/Optional;Ljava/util/function/Consumer;Ljava/lang/Runnable;)Ljava/util/Optional;
intermediary method_17974
Lnet/minecraft/class_156;method_17974(Ljava/util/Optional;Ljava/util/function/Consumer;Ljava/lang/Runnable;)Ljava/util/Optional;
named ifPresentOrElse
Lnet/minecraft/util/Util;ifPresentOrElse(Ljava/util/Optional;Ljava/util/function/Consumer;Ljava/lang/Runnable;)Ljava/util/Optional;
-
debugSupplier
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/util/function/Supplier;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;
intermediary method_41238
Lnet/minecraft/class_156;method_41238(Ljava/util/function/Supplier;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;
named debugSupplier
Lnet/minecraft/util/Util;debugSupplier(Ljava/util/function/Supplier;Ljava/util/function/Supplier;)Ljava/util/function/Supplier;
-
debugRunnable
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/lang/Runnable;Ljava/util/function/Supplier;)Ljava/lang/Runnable;
intermediary method_18839
Lnet/minecraft/class_156;method_18839(Ljava/lang/Runnable;Ljava/util/function/Supplier;)Ljava/lang/Runnable;
named debugRunnable
Lnet/minecraft/util/Util;debugRunnable(Ljava/lang/Runnable;Ljava/util/function/Supplier;)Ljava/lang/Runnable;
-
error
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/lang/String;)V
intermediary method_33559
Lnet/minecraft/class_156;method_33559(Ljava/lang/String;)V
named error
Lnet/minecraft/util/Util;error(Ljava/lang/String;)V
-
error
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/lang/String;Ljava/lang/Throwable;)V
intermediary method_39977
Lnet/minecraft/class_156;method_39977(Ljava/lang/String;Ljava/lang/Throwable;)V
named error
Lnet/minecraft/util/Util;error(Ljava/lang/String;Ljava/lang/Throwable;)V
-
throwOrPause
- Mappings:
Namespace Name Mixin selector official b
Lac;b(Ljava/lang/Throwable;)Ljava/lang/Throwable;
intermediary method_22320
Lnet/minecraft/class_156;method_22320(Ljava/lang/Throwable;)Ljava/lang/Throwable;
named throwOrPause
Lnet/minecraft/util/Util;throwOrPause(Ljava/lang/Throwable;)Ljava/lang/Throwable;
-
setMissingBreakpointHandler
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/util/function/Consumer;)V
intermediary method_38646
Lnet/minecraft/class_156;method_38646(Ljava/util/function/Consumer;)V
named setMissingBreakpointHandler
Lnet/minecraft/util/Util;setMissingBreakpointHandler(Ljava/util/function/Consumer;)V
-
pause
- Mappings:
Namespace Name Mixin selector official d
Lac;d(Ljava/lang/String;)V
intermediary method_33560
Lnet/minecraft/class_156;method_33560(Ljava/lang/String;)V
named pause
Lnet/minecraft/util/Util;pause(Ljava/lang/String;)V
-
getInnermostMessage
- Mappings:
Namespace Name Mixin selector official c
Lac;c(Ljava/lang/Throwable;)Ljava/lang/String;
intermediary method_22321
Lnet/minecraft/class_156;method_22321(Ljava/lang/Throwable;)Ljava/lang/String;
named getInnermostMessage
Lnet/minecraft/util/Util;getInnermostMessage(Ljava/lang/Throwable;)Ljava/lang/String;
-
getRandom
Returns a random item fromarray
.- Returns:
- a random item from
array
- Throws:
IllegalArgumentException
- ifarray
is empty- Mappings:
Namespace Name Mixin selector official a
Lac;a([Ljava/lang/Object;Lasc;)Ljava/lang/Object;
intermediary method_27173
Lnet/minecraft/class_156;method_27173([Ljava/lang/Object;Lnet/minecraft/class_5819;)Ljava/lang/Object;
named getRandom
Lnet/minecraft/util/Util;getRandom([Ljava/lang/Object;Lnet/minecraft/util/math/random/Random;)Ljava/lang/Object;
-
getRandom
Returns a random integer fromarray
.- Returns:
- a random integer from
array
- Throws:
IllegalArgumentException
- ifarray
is empty- Mappings:
Namespace Name Mixin selector official a
Lac;a([ILasc;)I
intermediary method_27172
Lnet/minecraft/class_156;method_27172([ILnet/minecraft/class_5819;)I
named getRandom
Lnet/minecraft/util/Util;getRandom([ILnet/minecraft/util/math/random/Random;)I
-
getRandom
Returns a random item fromlist
.- Returns:
- a random item from
list
- Throws:
IllegalArgumentException
- iflist
is empty- See Also:
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/util/List;Lasc;)Ljava/lang/Object;
intermediary method_32309
Lnet/minecraft/class_156;method_32309(Ljava/util/List;Lnet/minecraft/class_5819;)Ljava/lang/Object;
named getRandom
Lnet/minecraft/util/Util;getRandom(Ljava/util/List;Lnet/minecraft/util/math/random/Random;)Ljava/lang/Object;
-
getRandomOrEmpty
Returns anOptional
of a random item fromlist
, or an empty optional if the list is empty.- Returns:
- an
Optional
of a random item fromlist
, or an empty optional if the list is empty - See Also:
- Mappings:
Namespace Name Mixin selector official b
Lac;b(Ljava/util/List;Lasc;)Ljava/util/Optional;
intermediary method_40083
Lnet/minecraft/class_156;method_40083(Ljava/util/List;Lnet/minecraft/class_5819;)Ljava/util/Optional;
named getRandomOrEmpty
Lnet/minecraft/util/Util;getRandomOrEmpty(Ljava/util/List;Lnet/minecraft/util/math/random/Random;)Ljava/util/Optional;
-
renameTask
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/nio/file/Path;Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;
intermediary method_30625
Lnet/minecraft/class_156;method_30625(Ljava/nio/file/Path;Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;
named renameTask
Lnet/minecraft/util/Util;renameTask(Ljava/nio/file/Path;Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;
-
deleteTask
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;
intermediary method_30624
Lnet/minecraft/class_156;method_30624(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;
named deleteTask
Lnet/minecraft/util/Util;deleteTask(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;
-
deletionVerifyTask
- Mappings:
Namespace Name Mixin selector official b
Lac;b(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;
intermediary method_30628
Lnet/minecraft/class_156;method_30628(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;
named deletionVerifyTask
Lnet/minecraft/util/Util;deletionVerifyTask(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;
-
existenceCheckTask
- Mappings:
Namespace Name Mixin selector official c
Lac;c(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;
intermediary method_30629
Lnet/minecraft/class_156;method_30629(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;
named existenceCheckTask
Lnet/minecraft/util/Util;existenceCheckTask(Ljava/nio/file/Path;)Ljava/util/function/BooleanSupplier;
-
attemptTasks
- Mappings:
Namespace Name Mixin selector official a
Lac;a([Ljava/util/function/BooleanSupplier;)Z
intermediary method_30627
Lnet/minecraft/class_156;method_30627([Ljava/util/function/BooleanSupplier;)Z
named attemptTasks
Lnet/minecraft/util/Util;attemptTasks([Ljava/util/function/BooleanSupplier;)Z
-
attemptTasks
- Mappings:
Namespace Name Mixin selector official a
Lac;a(ILjava/lang/String;[Ljava/util/function/BooleanSupplier;)Z
intermediary method_30622
Lnet/minecraft/class_156;method_30622(ILjava/lang/String;[Ljava/util/function/BooleanSupplier;)Z
named attemptTasks
Lnet/minecraft/util/Util;attemptTasks(ILjava/lang/String;[Ljava/util/function/BooleanSupplier;)Z
-
backupAndReplace
Copiescurrent
tobackup
and then replacescurrent
withnewPath
.- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/io/File;Ljava/io/File;Ljava/io/File;)V
intermediary method_27760
Lnet/minecraft/class_156;method_27760(Ljava/io/File;Ljava/io/File;Ljava/io/File;)V
named backupAndReplace
Lnet/minecraft/util/Util;backupAndReplace(Ljava/io/File;Ljava/io/File;Ljava/io/File;)V
-
backupAndReplace
Copiescurrent
tobackup
and then replacescurrent
withnewPath
.- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;)V
intermediary method_30626
Lnet/minecraft/class_156;method_30626(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;)V
named backupAndReplace
Lnet/minecraft/util/Util;backupAndReplace(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;)V
-
backupAndReplace
public static void backupAndReplace(File current, File newPath, File backup, boolean noRestoreOnFail) Copiescurrent
tobackup
and then replacescurrent
withnewPath
.- Parameters:
noRestoreOnFail
- iftrue
, does not restore the current file when replacing fails- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/io/File;Ljava/io/File;Ljava/io/File;Z)V
intermediary method_41203
Lnet/minecraft/class_156;method_41203(Ljava/io/File;Ljava/io/File;Ljava/io/File;Z)V
named backupAndReplace
Lnet/minecraft/util/Util;backupAndReplace(Ljava/io/File;Ljava/io/File;Ljava/io/File;Z)V
-
backupAndReplace
public static void backupAndReplace(Path current, Path newPath, Path backup, boolean noRestoreOnFail) Copiescurrent
tobackup
and then replacescurrent
withnewPath
.- Parameters:
noRestoreOnFail
- iftrue
, does not restore the current file when replacing fails- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;Z)V
intermediary method_41204
Lnet/minecraft/class_156;method_41204(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;Z)V
named backupAndReplace
Lnet/minecraft/util/Util;backupAndReplace(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;Z)V
-
moveCursor
Moves thecursor
in thestring
by adelta
amount. Skips surrogate characters.- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/lang/String;II)I
intermediary method_27761
Lnet/minecraft/class_156;method_27761(Ljava/lang/String;II)I
named moveCursor
Lnet/minecraft/util/Util;moveCursor(Ljava/lang/String;II)I
-
addPrefix
Returns a consumer that first prependsprefix
to its input string and passes the result toconsumer
.- Returns:
- a consumer that first prepends
prefix
to 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 official a
Lac;a(Ljava/lang/String;Ljava/util/function/Consumer;)Ljava/util/function/Consumer;
intermediary method_29188
Lnet/minecraft/class_156;method_29188(Ljava/lang/String;Ljava/util/function/Consumer;)Ljava/util/function/Consumer;
named addPrefix
Lnet/minecraft/util/Util;addPrefix(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 official a
Lac;a(Ljava/util/stream/IntStream;I)Lcom/mojang/serialization/DataResult;
intermediary method_29190
Lnet/minecraft/class_156;method_29190(Ljava/util/stream/IntStream;I)Lcom/mojang/serialization/DataResult;
named decodeFixedLengthArray
Lnet/minecraft/util/Util;decodeFixedLengthArray(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 official a
Lac;a(Ljava/util/stream/LongStream;I)Lcom/mojang/serialization/DataResult;
intermediary method_51822
Lnet/minecraft/class_156;method_51822(Ljava/util/stream/LongStream;I)Lcom/mojang/serialization/DataResult;
named decodeFixedLengthArray
Lnet/minecraft/util/Util;decodeFixedLengthArray(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 official a
Lac;a(Ljava/util/List;I)Lcom/mojang/serialization/DataResult;
intermediary method_33141
Lnet/minecraft/class_156;method_33141(Ljava/util/List;I)Lcom/mojang/serialization/DataResult;
named decodeFixedLengthList
Lnet/minecraft/util/Util;decodeFixedLengthList(Ljava/util/List;I)Lcom/mojang/serialization/DataResult;
-
startTimerHack
public static void startTimerHack()- Mappings:
Namespace Name Mixin selector official l
Lac;l()V
intermediary method_29476
Lnet/minecraft/class_156;method_29476()V
named startTimerHack
Lnet/minecraft/util/Util;startTimerHack()V
-
relativeCopy
Copies a file contained in the foldersrc
to the folderdest
. This will replicate any path structure that may exist betweensrc
andtoCopy
.- Throws:
IOException
- Mappings:
Namespace Name Mixin selector official b
Lac;b(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;)V
intermediary method_29775
Lnet/minecraft/class_156;method_29775(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;)V
named relativeCopy
Lnet/minecraft/util/Util;relativeCopy(Ljava/nio/file/Path;Ljava/nio/file/Path;Ljava/nio/file/Path;)V
-
replaceInvalidChars
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/lang/String;Lm;)Ljava/lang/String;
intermediary method_30309
Lnet/minecraft/class_156;method_30309(Ljava/lang/String;Lnet/minecraft/class_5462;)Ljava/lang/String;
named replaceInvalidChars
Lnet/minecraft/util/Util;replaceInvalidChars(Ljava/lang/String;Lnet/minecraft/util/function/CharPredicate;)Ljava/lang/String;
-
cachedMapper
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/util/function/Function;)Lask;
intermediary method_48746
Lnet/minecraft/class_156;method_48746(Ljava/util/function/Function;)Lnet/minecraft/class_8105;
named cachedMapper
Lnet/minecraft/util/Util;cachedMapper(Ljava/util/function/Function;)Lnet/minecraft/util/CachedMapper;
-
memoize
- Mappings:
Namespace Name Mixin selector official b
Lac;b(Ljava/util/function/Function;)Ljava/util/function/Function;
intermediary method_34866
Lnet/minecraft/class_156;method_34866(Ljava/util/function/Function;)Ljava/util/function/Function;
named memoize
Lnet/minecraft/util/Util;memoize(Ljava/util/function/Function;)Ljava/util/function/Function;
-
memoize
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/util/function/BiFunction;)Ljava/util/function/BiFunction;
intermediary method_34865
Lnet/minecraft/class_156;method_34865(Ljava/util/function/BiFunction;)Ljava/util/function/BiFunction;
named memoize
Lnet/minecraft/util/Util;memoize(Ljava/util/function/BiFunction;)Ljava/util/function/BiFunction;
-
copyShuffled
Returns the contents ofstream
copied to a list and then shuffled.- Returns:
- the contents of
stream
copied to a list and then shuffled - Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/util/stream/Stream;Lasc;)Ljava/util/List;
intermediary method_43252
Lnet/minecraft/class_156;method_43252(Ljava/util/stream/Stream;Lnet/minecraft/class_5819;)Ljava/util/List;
named copyShuffled
Lnet/minecraft/util/Util;copyShuffled(Ljava/util/stream/Stream;Lnet/minecraft/util/math/random/Random;)Ljava/util/List;
-
shuffle
Returns the contents ofstream
copied to a list and then shuffled.- Returns:
- the contents of
stream
copied to a list and then shuffled - Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/util/stream/IntStream;Lasc;)Lit/unimi/dsi/fastutil/ints/IntArrayList;
intermediary method_43251
Lnet/minecraft/class_156;method_43251(Ljava/util/stream/IntStream;Lnet/minecraft/class_5819;)Lit/unimi/dsi/fastutil/ints/IntArrayList;
named shuffle
Lnet/minecraft/util/Util;shuffle(Ljava/util/stream/IntStream;Lnet/minecraft/util/math/random/Random;)Lit/unimi/dsi/fastutil/ints/IntArrayList;
-
copyShuffled
Returns the contents ofarray
copied to a list and then shuffled.- Returns:
- the contents of
array
copied to a list and then shuffled - Mappings:
Namespace Name Mixin selector official b
Lac;b([Ljava/lang/Object;Lasc;)Ljava/util/List;
intermediary method_43253
Lnet/minecraft/class_156;method_43253([Ljava/lang/Object;Lnet/minecraft/class_5819;)Ljava/util/List;
named copyShuffled
Lnet/minecraft/util/Util;copyShuffled([Ljava/lang/Object;Lnet/minecraft/util/math/random/Random;)Ljava/util/List;
-
copyShuffled
Returns the contents ofstream
copied to a list and then shuffled.- Returns:
- the contents of
stream
copied to a list and then shuffled - Mappings:
Namespace Name Mixin selector official a
Lac;a(Lit/unimi/dsi/fastutil/objects/ObjectArrayList;Lasc;)Ljava/util/List;
intermediary method_43027
Lnet/minecraft/class_156;method_43027(Lit/unimi/dsi/fastutil/objects/ObjectArrayList;Lnet/minecraft/class_5819;)Ljava/util/List;
named copyShuffled
Lnet/minecraft/util/Util;copyShuffled(Lit/unimi/dsi/fastutil/objects/ObjectArrayList;Lnet/minecraft/util/math/random/Random;)Ljava/util/List;
-
shuffle
Shuffleslist
, modifying the passed list in place.- Mappings:
Namespace Name Mixin selector official b
Lac;b(Lit/unimi/dsi/fastutil/objects/ObjectArrayList;Lasc;)V
intermediary method_43028
Lnet/minecraft/class_156;method_43028(Lit/unimi/dsi/fastutil/objects/ObjectArrayList;Lnet/minecraft/class_5819;)V
named shuffle
Lnet/minecraft/util/Util;shuffle(Lit/unimi/dsi/fastutil/objects/ObjectArrayList;Lnet/minecraft/util/math/random/Random;)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 official c
Lac;c(Ljava/util/function/Function;)Ljava/util/concurrent/CompletableFuture;
intermediary method_43499
Lnet/minecraft/class_156;method_43499(Ljava/util/function/Function;)Ljava/util/concurrent/CompletableFuture;
named waitAndApply
Lnet/minecraft/util/Util;waitAndApply(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 official a
Lac;a(Ljava/util/function/Function;Ljava/util/function/Predicate;)Ljava/lang/Object;
intermediary method_43498
Lnet/minecraft/class_156;method_43498(Ljava/util/function/Function;Ljava/util/function/Predicate;)Ljava/lang/Object;
named waitAndApply
Lnet/minecraft/util/Util;waitAndApply(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 - Implementation Note:
- Unlike
List.lastIndexOf(java.lang.Object)
, the returned function will return0
when given values not in the passed list. - Mappings:
Namespace Name Mixin selector official e
Lac;e(Ljava/util/List;)Ljava/util/function/ToIntFunction;
intermediary method_43658
Lnet/minecraft/class_156;method_43658(Ljava/util/List;)Ljava/util/function/ToIntFunction;
named lastIndexGetter
Lnet/minecraft/util/Util;lastIndexGetter(Ljava/util/List;)Ljava/util/function/ToIntFunction;
-
lastIndexGetter
public static <T> ToIntFunction<T> lastIndexGetter(List<T> values, IntFunction<Object2IntMap<T>> mapCreator) Returns a function that, when given a value invalues
, returns the last index of the value in the list.- Parameters:
mapCreator
- a function that, when given the size ofvalues
, returns a map for storing the indices of the values- Returns:
- a function that, when given a value in
values
, returns the last index of the value in the list - Implementation Note:
- Unlike
List.lastIndexOf(java.lang.Object)
, the returned function will return0
when given values not in the passed list. - Mappings:
Namespace Name Mixin selector official a
Lac;a(Ljava/util/List;Ljava/util/function/IntFunction;)Ljava/util/function/ToIntFunction;
intermediary method_44146
Lnet/minecraft/class_156;method_44146(Ljava/util/List;Ljava/util/function/IntFunction;)Ljava/util/function/ToIntFunction;
named lastIndexGetter
Lnet/minecraft/util/Util;lastIndexGetter(Ljava/util/List;Ljava/util/function/IntFunction;)Ljava/util/function/ToIntFunction;
-
getResult
public static <T,E extends Exception> T getResult(com.mojang.serialization.DataResult<T> result, Function<String, E> exceptionGetter) throws EReturns the result wrapped inresult
.- Returns:
- the result wrapped in
result
- Throws:
E
- Mappings:
Namespace Name Mixin selector official a
Lac;a(Lcom/mojang/serialization/DataResult;Ljava/util/function/Function;)Ljava/lang/Object;
intermediary method_47526
Lnet/minecraft/class_156;method_47526(Lcom/mojang/serialization/DataResult;Ljava/util/function/Function;)Ljava/lang/Object;
named getResult
Lnet/minecraft/util/Util;getResult(Lcom/mojang/serialization/DataResult;Ljava/util/function/Function;)Ljava/lang/Object;
-
isWhitespace
public static boolean isWhitespace(int c) Returns whetherc
represents a space character.- Returns:
- whether
c
represents a space character - See Also:
- Mappings:
Namespace Name Mixin selector official a
Lac;a(I)Z
intermediary method_51893
Lnet/minecraft/class_156;method_51893(I)Z
named isWhitespace
Lnet/minecraft/util/Util;isWhitespace(I)Z
-
isBlank
- Returns:
- whether
string
isnull
, empty, or composed entirely of isWhitespace(int) spaces - Mappings:
Namespace Name Mixin selector official b
Lac;b(Ljava/lang/String;)Z
intermediary method_51894
Lnet/minecraft/class_156;method_51894(Ljava/lang/String;)Z
named isBlank
Lnet/minecraft/util/Util;isBlank(Ljava/lang/String;)Z
-