Rename ChatUtil, add javadoc (#2771)

* Rename ChatUtil, add javadoc

* Apply suggestions from code review

Co-authored-by: liach <7806504+liach@users.noreply.github.com>
Co-authored-by: enbrain <69905075+enbrain@users.noreply.github.com>

Co-authored-by: liach <7806504+liach@users.noreply.github.com>
Co-authored-by: enbrain <69905075+enbrain@users.noreply.github.com>
This commit is contained in:
apple502j 2021-10-20 23:36:14 +09:00 committed by GitHub
parent 7f07ed765e
commit 1e9a8ba415
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 61 additions and 18 deletions

View File

@ -1,18 +0,0 @@
CLASS net/minecraft/class_3544 net/minecraft/util/ChatUtil
FIELD field_15771 PATTERN Ljava/util/regex/Pattern;
FIELD field_29204 LINE_BREAK Ljava/util/regex/Pattern;
FIELD field_33559 ENDS_WITH_LINE_BREAK Ljava/util/regex/Pattern;
METHOD method_15438 isEmpty (Ljava/lang/String;)Z
ARG 0 text
METHOD method_15439 ticksToString (I)Ljava/lang/String;
ARG 0 ticks
METHOD method_15440 stripTextFormat (Ljava/lang/String;)Ljava/lang/String;
ARG 0 text
METHOD method_34238 countLines (Ljava/lang/String;)I
ARG 0 text
METHOD method_34963 truncate (Ljava/lang/String;IZ)Ljava/lang/String;
ARG 0 text
ARG 1 maxLength
ARG 2 addEllipsis
METHOD method_36358 endsWithLineBreak (Ljava/lang/String;)Z
ARG 0 text

View File

@ -1,4 +1,10 @@
CLASS net/minecraft/class_124 net/minecraft/util/Formatting
COMMENT An enum holding formattings.
COMMENT
COMMENT <p>There are two types of formattings, color and modifier. Color formattings
COMMENT are associated with a specific color, while modifier formattings modify the
COMMENT style, such as by bolding the text. {@link #RESET} is a special formatting
COMMENT and is not classified as either of these two.
FIELD field_1052 BY_NAME Ljava/util/Map;
FIELD field_1053 colorValue Ljava/lang/Integer;
FIELD field_1057 name Ljava/lang/String;
@ -7,6 +13,7 @@ CLASS net/minecraft/class_124 net/minecraft/util/Formatting
FIELD field_1069 stringValue Ljava/lang/String;
FIELD field_1071 colorIndex I
FIELD field_1081 modifier Z
FIELD field_33292 FORMATTING_CODE_PREFIX C
METHOD <init> (Ljava/lang/String;ILjava/lang/String;CILjava/lang/Integer;)V
ARG 3 name
ARG 4 code
@ -23,25 +30,44 @@ CLASS net/minecraft/class_124 net/minecraft/util/Formatting
ARG 6 colorIndex
ARG 7 colorValue
METHOD method_36145 getCode ()C
COMMENT {@return the code to be placed after the {@value FORMATTING_CODE_PREFIX} when this format is converted to a string}
METHOD method_531 (Lnet/minecraft/class_124;)Ljava/lang/String;
ARG 0 f
METHOD method_532 getColorValue ()Ljava/lang/Integer;
COMMENT {@return the color of the formatted text, or {@code null} if the formatting
COMMENT has no associated color}
METHOD method_533 byName (Ljava/lang/String;)Lnet/minecraft/class_124;
COMMENT {@return the formatting with the name {@code name}, or {@code null} if there is none}
ARG 0 name
METHOD method_534 byColorIndex (I)Lnet/minecraft/class_124;
COMMENT {@return the formatting with the color index {@code colorIndex},
COMMENT or {@code null} if there is none}
ARG 0 colorIndex
METHOD method_535 sanitize (Ljava/lang/String;)Ljava/lang/String;
ARG 0 name
METHOD method_536 getColorIndex ()I
COMMENT {@return the color index for the formatting, or {@code -1} to indicate no color}
COMMENT
COMMENT @apiNote This is also used to calculate scoreboard team display slot IDs.
METHOD method_537 getName ()Ljava/lang/String;
COMMENT {@return the name of the formatting}
METHOD method_539 strip (Ljava/lang/String;)Ljava/lang/String;
COMMENT {@return the {@code text} with all formatting codes removed}
COMMENT
COMMENT @see StringHelper#stripTextFormat
ARG 0 string
METHOD method_540 getNames (ZZ)Ljava/util/Collection;
COMMENT {@return the list of formattings matching the given condition}
ARG 0 colors
COMMENT whether or not to include color formattings
ARG 1 modifiers
COMMENT whether or not to include modifier formattings
METHOD method_541 (Lnet/minecraft/class_124;)Lnet/minecraft/class_124;
ARG 0 f
METHOD method_542 isModifier ()Z
COMMENT {@return true if the formatting is a modifier, false otherwise}
METHOD method_543 isColor ()Z
COMMENT {@return true if the formatting is associated with a color, false otherwise}
METHOD method_544 byCode (C)Lnet/minecraft/class_124;
COMMENT {@return the formatting with the code {@code code}, or {@code null} if there is none}
ARG 0 code

View File

@ -0,0 +1,35 @@
CLASS net/minecraft/class_3544 net/minecraft/util/StringHelper
FIELD field_15771 FORMATTING_CODE Ljava/util/regex/Pattern;
FIELD field_29204 LINE_BREAK Ljava/util/regex/Pattern;
FIELD field_33559 ENDS_WITH_LINE_BREAK Ljava/util/regex/Pattern;
METHOD method_15438 isEmpty (Ljava/lang/String;)Z
COMMENT {@return true if {@code text} is {@code null} or empty, false otherwise}
ARG 0 text
METHOD method_15439 formatTicks (I)Ljava/lang/String;
COMMENT {@return the length of the {@code tick} in the MM:SS format, where
COMMENT the MM is the minutes and SS is the seconds (optionally zero-padded)}
ARG 0 ticks
METHOD method_15440 stripTextFormat (Ljava/lang/String;)Ljava/lang/String;
COMMENT {@return the {@code text} with all formatting codes removed}
COMMENT
COMMENT <p>A formatting code is the character {@code §} followed by
COMMENT a numeric character or a letter A to F, K to O, or R.
COMMENT
COMMENT @see Formatting#strip
ARG 0 text
METHOD method_34238 countLines (Ljava/lang/String;)I
COMMENT {@return the number of linebreaks in {@code text}}
COMMENT
COMMENT <p>A linebreak is either a CRLF sequence or a vertical tab (U+000B).
ARG 0 text
METHOD method_34963 truncate (Ljava/lang/String;IZ)Ljava/lang/String;
COMMENT {@return {@code text} truncated to at most {@code maxLength} characters,
COMMENT optionally with ellipsis}
ARG 0 text
ARG 1 maxLength
ARG 2 addEllipsis
METHOD method_36358 endsWithLineBreak (Ljava/lang/String;)Z
COMMENT {@return true if {@code text} ends with a linebreak, false otherwise}
COMMENT
COMMENT <p>A linebreak is either a CRLF sequence or a vertical tab (U+000B).
ARG 0 text