| 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 |
|