mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-20 20:22:28 +00:00
45 lines
1.6 KiB
Diff
45 lines
1.6 KiB
Diff
--- a/net/minecraft/resources/ResourceLocation.java
|
|
+++ b/net/minecraft/resources/ResourceLocation.java
|
|
@@ -38,10 +_,12 @@
|
|
}
|
|
}
|
|
|
|
+ /** Forge: Consider using {@link #parse(String)} instead, as Mojang made this constructor private in Vanilla 1.21 */
|
|
public ResourceLocation(String p_135809_) {
|
|
this(m_135832_(p_135809_, ':'));
|
|
}
|
|
|
|
+ /** Forge: Consider using {@link #fromNamespaceAndPath(String, String)} instead, as Mojang made this constructor private in Vanilla 1.21 */
|
|
public ResourceLocation(String p_135811_, String p_135812_) {
|
|
this(new String[]{p_135811_, p_135812_});
|
|
}
|
|
@@ -125,6 +_,12 @@
|
|
return i;
|
|
}
|
|
|
|
+ // Normal compare sorts by path first, this compares namespace first.
|
|
+ public int compareNamespaced(ResourceLocation o) {
|
|
+ int ret = this.f_135804_.compareTo(o.f_135804_);
|
|
+ return ret != 0 ? ret : this.f_135805_.compareTo(o.f_135805_);
|
|
+ }
|
|
+
|
|
public String m_179910_() {
|
|
return this.toString().replace('/', '_').replace(':', '_');
|
|
}
|
|
@@ -203,5 +_,15 @@
|
|
public JsonElement serialize(ResourceLocation p_135855_, Type p_135856_, JsonSerializationContext p_135857_) {
|
|
return new JsonPrimitive(p_135855_.toString());
|
|
}
|
|
+ }
|
|
+
|
|
+ /** Forge: Backport of Vanilla 1.21 method */
|
|
+ public static ResourceLocation fromNamespaceAndPath(String namespace, String path) {
|
|
+ return new ResourceLocation(namespace, path);
|
|
+ }
|
|
+
|
|
+ /** Forge: Backport of Vanilla 1.21 method */
|
|
+ public static ResourceLocation parse(String location) {
|
|
+ return new ResourceLocation(location);
|
|
}
|
|
}
|