ModelResourceLocation .java

net.minecraft.client.resources.model.ModelResourceLocation (class, 83 lines): members: parsePathString, variant, getVariant, hashCode, equals, toString.

net.minecraft.client.resources.modelclass83 linesclientextends ResourceLocation2.2 KB

API Surface (5)

String[] parsePathString(String p_177517_0_)
String getVariant()
boolean equals(Object p_equals_1_)
int hashCode()
String toString()

Fields & Constants (1)

variant

String literals (1)

"normal"

Code Graph: Dependencies (2)

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

Full Source

ModelResourceLocation.java83 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.client.resources.model;
2
3
import net.minecraft.util.ResourceLocation;
4
import org.apache.commons.lang3.StringUtils;
5
6
public class ModelResourceLocation extends ResourceLocation
7
{
8
    private final String variant;
9
10
    protected ModelResourceLocation(int p_i46078_1_, String... p_i46078_2_)
11
    {
12
        super(0, new String[] {p_i46078_2_[0], p_i46078_2_[1]});
13
        this.variant = StringUtils.isEmpty(p_i46078_2_[2]) ? "normal" : p_i46078_2_[2].toLowerCase();
14
    }
15
16
    public ModelResourceLocation(String p_i46079_1_)
17
    {
18
        this(0, parsePathString(p_i46079_1_));
19
    }
20
21
    public ModelResourceLocation(ResourceLocation p_i46080_1_, String p_i46080_2_)
22
    {
23
        this(p_i46080_1_.toString(), p_i46080_2_);
24
    }
25
26
    public ModelResourceLocation(String p_i46081_1_, String p_i46081_2_)
27
    {
28
        this(0, parsePathString(p_i46081_1_ + '#' + (p_i46081_2_ == null ? "normal" : p_i46081_2_)));
29
    }
30
31
    protected static String[] parsePathString(String p_177517_0_)
32
    {
33
        String[] astring = new String[] {null, p_177517_0_, null};
34
        int i = p_177517_0_.indexOf(35);
35
        String s = p_177517_0_;
36
37
        if (i >= 0)
38
        {
39
            astring[2] = p_177517_0_.substring(i + 1, p_177517_0_.length());
40
41
            if (i > 1)
42
            {
43
                s = p_177517_0_.substring(0, i);
44
            }
45
        }
46
47
        System.arraycopy(ResourceLocation.splitObjectName(s), 0, astring, 0, 2);
48
        return astring;
49
    }
50
51
    public String getVariant()
52
    {
53
        return this.variant;
54
    }
55
56
    public boolean equals(Object p_equals_1_)
57
    {
58
        if (this == p_equals_1_)
59
        {
60
            return true;
61
        }
62
        else if (p_equals_1_ instanceof ModelResourceLocation && super.equals(p_equals_1_))
63
        {
64
            ModelResourceLocation modelresourcelocation = (ModelResourceLocation)p_equals_1_;
65
            return this.variant.equals(modelresourcelocation.variant);
66
        }
67
        else
68
        {
69
            return false;
70
        }
71
    }
72
73
    public int hashCode()
74
    {
75
        return 31 * super.hashCode() + this.variant.hashCode();
76
    }
77
78
    public String toString()
79
    {
80
        return super.toString() + '#' + this.variant;
81
    }
82
}
83

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