--- a/net/minecraft/util/RegistryKey.java
+++ b/net/minecraft/util/RegistryKey.java
@@ -6,7 +6,7 @@
 import java.util.function.Function;
 import net.minecraft.util.registry.Registry;
 
-public class RegistryKey<T> {
+public class RegistryKey<T> implements Comparable<RegistryKey<?>> {
    private static final Map<String, RegistryKey<?>> field_240898_a_ = Collections.synchronizedMap(Maps.newIdentityHashMap());
    private final ResourceLocation field_240899_b_;
    private final ResourceLocation field_240900_c_;
@@ -48,4 +48,15 @@
          return func_240903_a_(p_240902_0_, p_240907_1_);
       };
    }
+
+   public ResourceLocation getRegistryName() {
+      return this.field_240899_b_;
+   }
+
+   @Override
+   public int compareTo(RegistryKey<?> o) {
+      int ret = this.getRegistryName().compareTo(o.getRegistryName());
+      if (ret == 0) ret = this.func_240901_a_().compareTo(o.func_240901_a_());
+      return ret;
+   }
 }
