程序包 net.minecraft
类 Util
java.lang.Object
net.minecraft.Util
-
嵌套类概要
嵌套类 -
字段概要
字段修饰符和类型字段说明private static final ExecutorService
private static final int
private static final DateTimeFormatter
private static LongSupplier
private static LongSupplier
private static final ExecutorService
(专用程序包) static final org.slf4j.Logger
private static final String
static final UUID
static final com.google.common.base.Ticker
static TimeSource.NanoTimeSource
private static final AtomicInteger
static final FileSystemProvider
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static ExecutorService
static <T> CompletableFuture<T>
blockUntilDone
(Function<Executor, CompletableFuture<T>> p_214680_) static <T> T
blockUntilDone
(Function<Executor, T> p_214653_, Predicate<T> pDonePredicate) static void
copyBetweenDirs
(Path pFromDirectory, Path pToDirectory, Path pFilePath) private static BooleanSupplier
createDeleter
(Path pFilePath) private static BooleanSupplier
createFileCreatedCheck
(Path pFilePath) private static BooleanSupplier
createFileDeletedCheck
(Path pFilePath) static <T> ToIntFunction<T>
createIndexLookup
(List<T> pList) static <T> ToIntFunction<T>
createIndexLookup
(List<T> pList, IntFunction<it.unimi.dsi.fastutil.objects.Object2IntMap<T>> p_214636_) private static BooleanSupplier
createRenamer
(Path pFilePath, Path pNewName) static String
describeError
(Throwable pThrowable) private static com.mojang.datafixers.types.Type<?>
doFetchChoiceType
(com.mojang.datafixers.DSL.TypeReference pType, String pChoiceName) private static void
private static boolean
executeInSequence
(BooleanSupplier... pSuppliers) private static <V> CompletableFuture<List<V>>
fallibleSequence
(List<? extends CompletableFuture<? extends V>> pCompletableFutures, Consumer<Throwable> pThrowableConsumer) static com.mojang.datafixers.types.Type<?>
fetchChoiceType
(com.mojang.datafixers.DSL.TypeReference pType, String pChoiceName) static <T> T
findNextInIterable
(Iterable<T> pIterable, T pElement) static <T> T
findPreviousInIterable
(Iterable<T> pIterable, T pCurrent) static <T> com.mojang.serialization.DataResult<List<T>>
static com.mojang.serialization.DataResult<int[]>
static com.mojang.serialization.DataResult<long[]>
fixedSize
(LongStream pStream, int pExpectedSize) static long
static String
private static int
static long
static long
getNanos()
static <T,
E extends Exception>
TgetOrThrow
(com.mojang.serialization.DataResult<T> pDataResult, Function<String, E> pExceptionGetter) static Util.OS
static <T extends Comparable<T>>
StringgetPropertyName
(Property<T> pProperty, Object pValue) static int
getRandom
(int[] pSelections, RandomSource pRandom) static <T> T
getRandom
(List<T> pSelections, RandomSource pRandom) static <T> T
getRandom
(T[] pSelections, RandomSource pRandom) static <T> Optional<T>
getRandomSafe
(List<T> pSelections, RandomSource pRandom) static <K> it.unimi.dsi.fastutil.Hash.Strategy<K>
static <T> Optional<T>
static ExecutorService
ioPool()
static boolean
static boolean
isWhitespace
(int p_289004_) static <T> T
static void
logAndPauseIfInIde
(String pError) static void
logAndPauseIfInIde
(String pMsg, Throwable pErr) static <T> T
static <T> T
static String
makeDescriptionId
(String pType, ResourceLocation pId) private static ExecutorService
makeExecutor
(String pServiceName) private static ExecutorService
static <T,
U, R> BiFunction<T, U, R> memoize
(BiFunction<T, U, R> pMemoBiFunction) static <T,
R> Function<T, R> static Runnable
static <T> Supplier<T>
static int
offsetByCodepoints
(String pText, int pCursorPos, int pDirection) private static void
onThreadException
(Thread p_137496_, Throwable p_137497_) static <T extends Throwable>
TpauseInIde
(T pThrowable) private static boolean
runWithRetries
(int pMaxTries, String pActionName, BooleanSupplier... pSuppliers) static void
safeReplaceFile
(File pCurrent, File pLatest, File pOldBackup) static void
safeReplaceFile
(Path pCurrent, Path pLatest, Path pOldBackup) static void
safeReplaceOrMoveFile
(File pCurrent, File pLatest, File pOldBackup, boolean pMove) static void
safeReplaceOrMoveFile
(Path pCurrent, Path pLatest, Path pOldBackup, boolean pMove) static String
sanitizeName
(String pFileName, CharPredicate pCharacterValidator) static <V> CompletableFuture<List<V>>
sequence
(List<? extends CompletableFuture<V>> pFutures) static <V> CompletableFuture<List<V>>
sequenceFailFast
(List<? extends CompletableFuture<? extends V>> pCompletableFutures) static <V> CompletableFuture<List<V>>
sequenceFailFastAndCancel
(List<? extends CompletableFuture<? extends V>> pCompletableFutures) static void
static <T> void
shuffle
(it.unimi.dsi.fastutil.objects.ObjectArrayList<T> pList, RandomSource pRandom) static <T> List<T>
shuffledCopy
(it.unimi.dsi.fastutil.objects.ObjectArrayList<T> pList, RandomSource pRandom) static <T> List<T>
shuffledCopy
(T[] pArray, RandomSource pRandom) private static void
shutdownExecutor
(ExecutorService pService) static void
static <K,
V> SingleKeyCache<K, V> singleKeyCache
(Function<K, V> pComputeValue) static void
static void
throwAsRuntime
(Throwable pThrowable) toMap()
static it.unimi.dsi.fastutil.ints.IntArrayList
toShuffledList
(IntStream pStream, RandomSource pRandom) static <T> List<T>
toShuffledList
(Stream<T> pStream, RandomSource pRandom) static Runnable
wrapThreadWithTaskName
(String pName, Runnable pTask) static <V> Supplier<V>
wrapThreadWithTaskName
(String pName, Supplier<V> pTask)
-
字段详细资料
-
LOGGER
static final org.slf4j.Logger LOGGER -
DEFAULT_MAX_THREADS
private static final int DEFAULT_MAX_THREADS- 另请参阅:
-
MAX_THREADS_SYSTEM_PROPERTY
- 另请参阅:
-
WORKER_COUNT
-
BACKGROUND_EXECUTOR
-
IO_POOL
-
FILENAME_DATE_TIME_FORMATTER
-
timeSource
-
TICKER
public static final com.google.common.base.Ticker TICKER -
NIL_UUID
-
ZIP_FILE_SYSTEM_PROVIDER
-
thePauser
-
INNER_CLASS_SHIFT1
-
INNER_CLASS_SHIFT2
-
-
构造器详细资料
-
Util
public Util()
-
-
方法详细资料
-
toMap
-
getPropertyName
public static <T extends Comparable<T>> String getPropertyName(Property<T> pProperty, Object pValue) -
makeDescriptionId
-
getMillis
public static long getMillis() -
getNanos
public static long getNanos() -
getEpochMillis
public static long getEpochMillis() -
getFilenameFormattedDateTime
-
makeExecutor
-
getMaxThreads
private static int getMaxThreads() -
backgroundExecutor
-
ioPool
-
shutdownExecutors
public static void shutdownExecutors() -
shutdownExecutor
-
makeIoExecutor
-
throwAsRuntime
-
onThreadException
-
fetchChoiceType
@Nullable public static com.mojang.datafixers.types.Type<?> fetchChoiceType(com.mojang.datafixers.DSL.TypeReference pType, String pChoiceName) -
doFetchChoiceType
@Nullable private static com.mojang.datafixers.types.Type<?> doFetchChoiceType(com.mojang.datafixers.DSL.TypeReference pType, String pChoiceName) -
wrapThreadWithTaskName
-
wrapThreadWithTaskName
-
getPlatform
-
getVmArguments
-
lastOf
-
findNextInIterable
-
findPreviousInIterable
-
make
-
make
-
identityStrategy
public static <K> it.unimi.dsi.fastutil.Hash.Strategy<K> identityStrategy() -
sequence
public static <V> CompletableFuture<List<V>> sequence(List<? extends CompletableFuture<V>> pFutures) -
sequenceFailFast
public static <V> CompletableFuture<List<V>> sequenceFailFast(List<? extends CompletableFuture<? extends V>> pCompletableFutures) -
sequenceFailFastAndCancel
public static <V> CompletableFuture<List<V>> sequenceFailFastAndCancel(List<? extends CompletableFuture<? extends V>> pCompletableFutures) -
fallibleSequence
private static <V> CompletableFuture<List<V>> fallibleSequence(List<? extends CompletableFuture<? extends V>> pCompletableFutures, Consumer<Throwable> pThrowableConsumer) -
ifElse
-
name
-
name
-
logAndPauseIfInIde
-
logAndPauseIfInIde
-
pauseInIde
-
setPause
-
doPause
-
describeError
-
getRandom
-
getRandom
-
getRandom
-
getRandomSafe
-
createRenamer
-
createDeleter
-
createFileDeletedCheck
-
createFileCreatedCheck
-
executeInSequence
-
runWithRetries
private static boolean runWithRetries(int pMaxTries, String pActionName, BooleanSupplier... pSuppliers) -
safeReplaceFile
-
safeReplaceFile
-
safeReplaceOrMoveFile
-
safeReplaceOrMoveFile
-
offsetByCodepoints
-
prefix
-
fixedSize
-
fixedSize
public static com.mojang.serialization.DataResult<long[]> fixedSize(LongStream pStream, int pExpectedSize) -
fixedSize
-
startTimerHackThread
public static void startTimerHackThread() -
copyBetweenDirs
public static void copyBetweenDirs(Path pFromDirectory, Path pToDirectory, Path pFilePath) throws IOException - 抛出:
IOException
-
sanitizeName
-
singleKeyCache
-
memoize
-
memoize
-
toShuffledList
-
toShuffledList
public static it.unimi.dsi.fastutil.ints.IntArrayList toShuffledList(IntStream pStream, RandomSource pRandom) -
shuffledCopy
-
shuffledCopy
public static <T> List<T> shuffledCopy(it.unimi.dsi.fastutil.objects.ObjectArrayList<T> pList, RandomSource pRandom) -
shuffle
public static <T> void shuffle(it.unimi.dsi.fastutil.objects.ObjectArrayList<T> pList, RandomSource pRandom) -
blockUntilDone
public static <T> CompletableFuture<T> blockUntilDone(Function<Executor, CompletableFuture<T>> p_214680_) -
blockUntilDone
-
createIndexLookup
-
createIndexLookup
public static <T> ToIntFunction<T> createIndexLookup(List<T> pList, IntFunction<it.unimi.dsi.fastutil.objects.Object2IntMap<T>> p_214636_) -
getOrThrow
public static <T,E extends Exception> T getOrThrow(com.mojang.serialization.DataResult<T> pDataResult, Function<String, E> pExceptionGetter) throws E- 抛出:
E extends Exception
-
isWhitespace
public static boolean isWhitespace(int p_289004_) -
isBlank
-