ChatComponentSelector .java

net.minecraft.util.ChatComponentSelector (class, 70 lines): members: getSelector, selector, getUnformattedTextForChat, createCopy, equals, toString.

net.minecraft.utilclass70 linescommonextends ChatComponentStyle1.9 KB

API Surface (5)

String getSelector()
String getUnformattedTextForChat()
ChatComponentSelector createCopy()
boolean equals(Object p_equals_1_)
String toString()

Fields & Constants (1)

selector

String literals (3)

"SelectorComponent{pattern=\'"
", 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

ChatComponentSelector.java70 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.util;
2
3
public class ChatComponentSelector extends ChatComponentStyle
4
{
5
    /**
6
     * The selector used to find the matching entities of this text component
7
     */
8
    private final String selector;
9
10
    public ChatComponentSelector(String selectorIn)
11
    {
12
        this.selector = selectorIn;
13
    }
14
15
    /**
16
     * Gets the selector of this component, in plain text.
17
     */
18
    public String getSelector()
19
    {
20
        return this.selector;
21
    }
22
23
    /**
24
     * Gets the text of this component, without any special formatting codes added, for chat.  TODO: why is this two
25
     * different methods?
26
     */
27
    public String getUnformattedTextForChat()
28
    {
29
        return this.selector;
30
    }
31
32
    /**
33
     * Creates a copy of this component.  Almost a deep copy, except the style is shallow-copied.
34
     */
35
    public ChatComponentSelector createCopy()
36
    {
37
        ChatComponentSelector chatcomponentselector = new ChatComponentSelector(this.selector);
38
        chatcomponentselector.setChatStyle(this.getChatStyle().createShallowCopy());
39
40
        for (IChatComponent ichatcomponent : this.getSiblings())
41
        {
42
            chatcomponentselector.appendSibling(ichatcomponent.createCopy());
43
        }
44
45
        return chatcomponentselector;
46
    }
47
48
    public boolean equals(Object p_equals_1_)
49
    {
50
        if (this == p_equals_1_)
51
        {
52
            return true;
53
        }
54
        else if (!(p_equals_1_ instanceof ChatComponentSelector))
55
        {
56
            return false;
57
        }
58
        else
59
        {
60
            ChatComponentSelector chatcomponentselector = (ChatComponentSelector)p_equals_1_;
61
            return this.selector.equals(chatcomponentselector.selector) && super.equals(p_equals_1_);
62
        }
63
    }
64
65
    public String toString()
66
    {
67
        return "SelectorComponent{pattern=\'" + this.selector + '\'' + ", siblings=" + this.siblings + ", style=" + this.getChatStyle() + '}';
68
    }
69
}
70

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