ChatComponentText .java

net.minecraft.util.ChatComponentText (class): members: getChatComponentText_TextValue, text, getUnformattedTextForChat, createCopy, equals, toString.

net.minecraft.utilclass68 linescommonextends ChatComponentStyle1.9 KB

API Surface (5)

String getChatComponentText_TextValue()
String getUnformattedTextForChat()
ChatComponentText createCopy()
boolean equals(Object p_equals_1_)
String toString()

Fields & Constants (1)

text

String literals (3)

"TextComponent{text=\'"
", siblings="
", style="

Code Graph: Dependencies (1)

Edges (calls / imports / inherits / references) resolved by graphify from the AST. Every chip opens the class source.

Full Source

ChatComponentText.java68 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.util;
2
3
public class ChatComponentText extends ChatComponentStyle
4
{
5
    private final String text;
6
7
    public ChatComponentText(String msg)
8
    {
9
        this.text = msg;
10
    }
11
12
    /**
13
     * Gets the text value of this ChatComponentText.  TODO: what are getUnformattedText and getUnformattedTextForChat
14
     * missing that made someone decide to create a third equivalent method that only ChatComponentText can implement?
15
     */
16
    public String getChatComponentText_TextValue()
17
    {
18
        return this.text;
19
    }
20
21
    /**
22
     * Gets the text of this component, without any special formatting codes added, for chat.  TODO: why is this two
23
     * different methods?
24
     */
25
    public String getUnformattedTextForChat()
26
    {
27
        return this.text;
28
    }
29
30
    /**
31
     * Creates a copy of this component.  Almost a deep copy, except the style is shallow-copied.
32
     */
33
    public ChatComponentText createCopy()
34
    {
35
        ChatComponentText chatcomponenttext = new ChatComponentText(this.text);
36
        chatcomponenttext.setChatStyle(this.getChatStyle().createShallowCopy());
37
38
        for (IChatComponent ichatcomponent : this.getSiblings())
39
        {
40
            chatcomponenttext.appendSibling(ichatcomponent.createCopy());
41
        }
42
43
        return chatcomponenttext;
44
    }
45
46
    public boolean equals(Object p_equals_1_)
47
    {
48
        if (this == p_equals_1_)
49
        {
50
            return true;
51
        }
52
        else if (!(p_equals_1_ instanceof ChatComponentText))
53
        {
54
            return false;
55
        }
56
        else
57
        {
58
            ChatComponentText chatcomponenttext = (ChatComponentText)p_equals_1_;
59
            return this.text.equals(chatcomponenttext.getChatComponentText_TextValue()) && super.equals(p_equals_1_);
60
        }
61
    }
62
63
    public String toString()
64
    {
65
        return "TextComponent{text=\'" + this.text + '\'' + ", siblings=" + this.siblings + ", style=" + this.getChatStyle() + '}';
66
    }
67
}
68

Deobfuscated MCP 1.8.9 source of ChatComponentText from Marcelektro/MavenMCP-1.8.9 (net/minecraft/util/ChatComponentText.java), stored verbatim.