From 34865fd6a0b9ff34d1b73dd212dd1dffbf3cad6a Mon Sep 17 00:00:00 2001 From: apple502j <33279053+apple502j@users.noreply.github.com> Date: Fri, 21 Oct 2022 18:33:14 +0900 Subject: [PATCH] 22w42a util stuff (#3337) * 22w42a util stuff * Update mappings/net/minecraft/util/PathUtil.mapping Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com> Co-authored-by: Juuz <6596629+Juuxel@users.noreply.github.com> --- ...{FileNameUtil.mapping => PathUtil.mapping} | 21 ++++++++++++++++--- .../util/collection/WeightedList.mapping | 2 ++ .../util/profiler/ProfilerTiming.mapping | 2 ++ 3 files changed, 22 insertions(+), 3 deletions(-) rename mappings/net/minecraft/util/{FileNameUtil.mapping => PathUtil.mapping} (68%) diff --git a/mappings/net/minecraft/util/FileNameUtil.mapping b/mappings/net/minecraft/util/PathUtil.mapping similarity index 68% rename from mappings/net/minecraft/util/FileNameUtil.mapping rename to mappings/net/minecraft/util/PathUtil.mapping index 5ae73ec022..1d66134cd0 100644 --- a/mappings/net/minecraft/util/FileNameUtil.mapping +++ b/mappings/net/minecraft/util/PathUtil.mapping @@ -1,5 +1,5 @@ -CLASS net/minecraft/class_4239 net/minecraft/util/FileNameUtil - COMMENT A class holding file name-related utility methods. +CLASS net/minecraft/class_4239 net/minecraft/util/PathUtil + COMMENT A class holding path-related utility methods. FIELD field_18955 RESERVED_WINDOWS_NAMES Ljava/util/regex/Pattern; FIELD field_18956 FILE_NAME_WITH_COUNT Ljava/util/regex/Pattern; FIELD field_33384 MAX_NAME_LENGTH I @@ -41,11 +41,26 @@ CLASS net/minecraft/class_4239 net/minecraft/util/FileNameUtil COMMENT to {@code /}} ARG 0 path METHOD method_46344 getPath (Ljava/nio/file/Path;Ljava/util/List;)Ljava/nio/file/Path; + COMMENT {@return {@code paths} resolved as a path from {@code root}} + COMMENT + COMMENT

If {@code paths} is empty, this returns {@code root}. ARG 0 root ARG 1 paths - METHOD method_46345 isPathValid ([Ljava/lang/String;)V + METHOD method_46345 validatePath ([Ljava/lang/String;)V + COMMENT Validates that {@code paths} is not empty and does not contain invalid segments + COMMENT (such as {@code .}, {@code ..}, or otherwise {@linkplain #isFileNameValid invalid names}). + COMMENT + COMMENT @throws IllegalArgumentException when the {@code paths} are invalid ARG 0 paths METHOD method_46346 split (Ljava/lang/String;)Lcom/mojang/serialization/DataResult; + COMMENT {@return {@code path} split by {@code /}, or an error result if the path is invalid} + COMMENT + COMMENT

All path segments must be a {@linkplain #isFileNameValid valid file name}. Additionally, + COMMENT {@code .} and {@code ..} are forbidden. ARG 0 path METHOD method_46347 isFileNameValid (Ljava/lang/String;)Z + COMMENT {@return whether {@code name} is a valid file name} + COMMENT + COMMENT @apiNote A valid file name contains only ASCII lowercase alphabets, ASCII digits, + COMMENT a dot, or an underscore. Unlike {@link Identifier} paths, hyphens are not allowed. ARG 0 name diff --git a/mappings/net/minecraft/util/collection/WeightedList.mapping b/mappings/net/minecraft/util/collection/WeightedList.mapping index 5dc020418f..4c1e082208 100644 --- a/mappings/net/minecraft/util/collection/WeightedList.mapping +++ b/mappings/net/minecraft/util/collection/WeightedList.mapping @@ -38,3 +38,5 @@ CLASS net/minecraft/class_6032 net/minecraft/util/collection/WeightedList ARG 3 data METHOD method_35105 (Lcom/mojang/serialization/Dynamic;Ljava/lang/Object;)Lnet/minecraft/class_6032$class_6033; ARG 1 data + METHOD method_35106 (Lcom/mojang/serialization/DynamicOps;Lnet/minecraft/class_6032$class_6033;)Lcom/mojang/datafixers/util/Pair; + ARG 1 entry diff --git a/mappings/net/minecraft/util/profiler/ProfilerTiming.mapping b/mappings/net/minecraft/util/profiler/ProfilerTiming.mapping index dcd88b61d6..df6b9743dd 100644 --- a/mappings/net/minecraft/util/profiler/ProfilerTiming.mapping +++ b/mappings/net/minecraft/util/profiler/ProfilerTiming.mapping @@ -8,4 +8,6 @@ CLASS net/minecraft/class_3534 net/minecraft/util/profiler/ProfilerTiming ARG 2 parentUsagePercentage ARG 4 totalUsagePercentage ARG 6 visitCount + METHOD compareTo (Ljava/lang/Object;)I + ARG 1 other METHOD method_15409 getColor ()I