Add RegistryAccess for managing Registries

RegistryAccess is independant from CraftServer and
doesn't require one to be created allowing the
org.bukkit.Registry class to be loaded earlier.

== AT ==
public net.minecraft.server.RegistryLayer STATIC_ACCESS
This commit is contained in:
Jake Potrebic
2023-02-27 18:28:39 -08:00
parent 23b8639dbf
commit 239e7a6b37
38 changed files with 930 additions and 214 deletions

View File

@@ -51,11 +51,14 @@ public class FieldRename {
};
}
@RequireCompatibility("allow-old-keys-in-registry")
public static <T extends Keyed> T get(Registry<T> registry, NamespacedKey namespacedKey) {
// We don't have version-specific changes, so just use current, and don't inject a version
return CraftRegistry.get(registry, namespacedKey, ApiVersion.CURRENT);
}
// Paper start - absolutely not, having this as an expectation for plugin developers opens a huge
// can of worms in the future, especially if mojang comes back and reuses some old key
//@RequireCompatibility("allow-old-keys-in-registry")
//public static <T extends Keyed> T get(Registry<T> registry, NamespacedKey namespacedKey) {
// // We don't have version-specific changes, so just use current, and don't inject a version
// return CraftRegistry.get(registry, namespacedKey, ApiVersion.CURRENT);
//}
// Paper end
// PatternType
private static final FieldRenameData PATTERN_TYPE_DATA = FieldRenameData.Builder.newBuilder()