mirror of
https://github.com/PaperMC/Paper.git
synced 2025-08-01 04:32:11 -07:00
Handle disabled vanilla registry values correctly (#11781)
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
ResourceLocation resourceLocation = key.location();
|
||||
LOADERS.put(resourceLocation, () -> bootstrap.run(registry));
|
||||
WRITABLE_REGISTRY.register((ResourceKey)key, registry, RegistrationInfo.BUILT_IN);
|
||||
@@ -328,7 +_,14 @@
|
||||
@@ -328,16 +_,34 @@
|
||||
}
|
||||
|
||||
public static void bootStrap() {
|
||||
@@ -41,6 +41,26 @@
|
||||
freeze();
|
||||
validate(REGISTRY);
|
||||
}
|
||||
|
||||
private static void createContents() {
|
||||
+ // Paper start - class-load org.bukkit.Registry
|
||||
+ // we have to class-load Registry here to create all the CraftRegistry instances
|
||||
+ // that will be created when Registry is class-loaded before RegistryAccess#getRegistry
|
||||
+ // would try to create them in lockReferenceHolder
|
||||
+ try {
|
||||
+ Class.forName(org.bukkit.Registry.class.getName());
|
||||
+ } catch (final ClassNotFoundException ex) {
|
||||
+ throw new RuntimeException(ex);
|
||||
+ }
|
||||
+ // Paper end - class-load org.bukkit.Registry
|
||||
LOADERS.forEach((resourceLocation, supplier) -> {
|
||||
if (supplier.get() == null) {
|
||||
LOGGER.error("Unable to bootstrap registry '{}'", resourceLocation);
|
||||
}
|
||||
+ io.papermc.paper.registry.PaperRegistryAccess.instance().lockReferenceHolders(ResourceKey.createRegistryKey(resourceLocation)); // Paper - lock reference holder creation
|
||||
});
|
||||
}
|
||||
|
||||
@@ -346,6 +_,7 @@
|
||||
|
||||
for (Registry<?> registry : REGISTRY) {
|
||||
|
@@ -34,11 +34,12 @@
|
||||
} catch (Exception var14) {
|
||||
loadingErrors.put(
|
||||
resourceKey,
|
||||
@@ -283,7 +_,8 @@
|
||||
@@ -283,7 +_,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
- TagLoader.loadTagsForRegistry(resourceManager, registry);
|
||||
+ io.papermc.paper.registry.PaperRegistryAccess.instance().lockReferenceHolders(registry.key()); // Paper - lock reference holders
|
||||
+ io.papermc.paper.registry.PaperRegistryListenerManager.INSTANCE.runFreezeListeners(registry.key(), conversions); // Paper - run pre-freeze listeners
|
||||
+ TagLoader.loadTagsForRegistry(resourceManager, registry, io.papermc.paper.plugin.lifecycle.event.registrar.ReloadableRegistrarEvent.Cause.INITIAL); // Paper - tag lifecycle - add cause
|
||||
}
|
||||
|
Reference in New Issue
Block a user