Metadata .java

net.minecraft.client.stream.Metadata (class): members: field_152811_a, func_152806_b, func_152807_a, func_152808_a, func_152809_a, func_152810_c, payload.

net.minecraft.client.streamclass84 linesclient2.2 KB

API Surface (6)

void func_152807_a(String p_152807_1_)
String func_152809_a()
void func_152808_a(String p_152808_1_, String p_152808_2_)
String func_152806_b()
String func_152810_c()
String toString()

Fields & Constants (4)

field_152811_a
name
description
payload

String literals (6)

"Metadata payload is full, cannot add more to it!"
"Metadata payload key cannot be null!"
"Metadata payload key is too long!"
"Metadata payload value cannot be null!"
"Metadata payload value is too long!"
"description"

Full Source

Metadata.java84 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.stream;
2
3
import com.google.common.base.Objects;
4
import com.google.common.collect.Maps;
5
import com.google.gson.Gson;
6
import java.util.Map;
7
8
public class Metadata
9
{
10
    private static final Gson field_152811_a = new Gson();
11
    private final String name;
12
    private String description;
13
    private Map<String, String> payload;
14
15
    public Metadata(String p_i46345_1_, String p_i46345_2_)
16
    {
17
        this.name = p_i46345_1_;
18
        this.description = p_i46345_2_;
19
    }
20
21
    public Metadata(String p_i1030_1_)
22
    {
23
        this(p_i1030_1_, (String)null);
24
    }
25
26
    public void func_152807_a(String p_152807_1_)
27
    {
28
        this.description = p_152807_1_;
29
    }
30
31
    public String func_152809_a()
32
    {
33
        return this.description == null ? this.name : this.description;
34
    }
35
36
    public void func_152808_a(String p_152808_1_, String p_152808_2_)
37
    {
38
        if (this.payload == null)
39
        {
40
            this.payload = Maps.<String, String>newHashMap();
41
        }
42
43
        if (this.payload.size() > 50)
44
        {
45
            throw new IllegalArgumentException("Metadata payload is full, cannot add more to it!");
46
        }
47
        else if (p_152808_1_ == null)
48
        {
49
            throw new IllegalArgumentException("Metadata payload key cannot be null!");
50
        }
51
        else if (p_152808_1_.length() > 255)
52
        {
53
            throw new IllegalArgumentException("Metadata payload key is too long!");
54
        }
55
        else if (p_152808_2_ == null)
56
        {
57
            throw new IllegalArgumentException("Metadata payload value cannot be null!");
58
        }
59
        else if (p_152808_2_.length() > 255)
60
        {
61
            throw new IllegalArgumentException("Metadata payload value is too long!");
62
        }
63
        else
64
        {
65
            this.payload.put(p_152808_1_, p_152808_2_);
66
        }
67
    }
68
69
    public String func_152806_b()
70
    {
71
        return this.payload != null && !this.payload.isEmpty() ? field_152811_a.toJson((Object)this.payload) : null;
72
    }
73
74
    public String func_152810_c()
75
    {
76
        return this.name;
77
    }
78
79
    public String toString()
80
    {
81
        return Objects.toStringHelper(this).add("name", this.name).add("description", this.description).add("data", this.func_152806_b()).toString();
82
    }
83
}
84

Deobfuscated MCP 1.8.9 source of Metadata from Marcelektro/MavenMCP-1.8.9 (net/minecraft/client/stream/Metadata.java), stored verbatim.