net/minecraft/core/registries

This commit is contained in:
Owen1212055 2024-12-14 15:59:29 -05:00
parent aa4dd1b840
commit 5c36e5e6b5
No known key found for this signature in database
GPG key ID: 2133292072886A30

View file

@ -1,6 +1,6 @@
--- a/net/minecraft/core/registries/BuiltInRegistries.java --- a/net/minecraft/core/registries/BuiltInRegistries.java
+++ b/net/minecraft/core/registries/BuiltInRegistries.java +++ b/net/minecraft/core/registries/BuiltInRegistries.java
@@ -296,6 +296,17 @@ @@ -296,6 +_,17 @@
public static final Registry<SlotDisplay.Type<?>> SLOT_DISPLAY = registerSimple(Registries.SLOT_DISPLAY, SlotDisplays::bootstrap); public static final Registry<SlotDisplay.Type<?>> SLOT_DISPLAY = registerSimple(Registries.SLOT_DISPLAY, SlotDisplays::bootstrap);
public static final Registry<RecipeBookCategory> RECIPE_BOOK_CATEGORY = registerSimple(Registries.RECIPE_BOOK_CATEGORY, RecipeBookCategories::bootstrap); public static final Registry<RecipeBookCategory> RECIPE_BOOK_CATEGORY = registerSimple(Registries.RECIPE_BOOK_CATEGORY, RecipeBookCategories::bootstrap);
public static final Registry<? extends Registry<?>> REGISTRY = WRITABLE_REGISTRY; public static final Registry<? extends Registry<?>> REGISTRY = WRITABLE_REGISTRY;
@ -16,18 +16,17 @@
+ }); + });
+ // Paper end - add built-in registry conversions + // Paper end - add built-in registry conversions
private static <T> Registry<T> registerSimple(ResourceKey<? extends Registry<T>> key, BuiltInRegistries.RegistryBootstrap<T> initializer) { private static <T> Registry<T> registerSimple(ResourceKey<? extends Registry<T>> key, BuiltInRegistries.RegistryBootstrap<T> bootstrap) {
return internalRegister(key, new MappedRegistry<>(key, Lifecycle.stable(), false), initializer); return internalRegister(key, new MappedRegistry<>(key, Lifecycle.stable(), false), bootstrap);
@@ -323,14 +334,22 @@ @@ -321,6 +_,7 @@
ResourceKey<? extends Registry<T>> key, R registry, BuiltInRegistries.RegistryBootstrap<T> initializer ResourceKey<? extends Registry<T>> key, R registry, BuiltInRegistries.RegistryBootstrap<T> bootstrap
) { ) {
Bootstrap.checkBootstrapCalled(() -> "registry " + key.location()); Bootstrap.checkBootstrapCalled(() -> "registry " + key.location());
+ io.papermc.paper.registry.PaperRegistryAccess.instance().registerRegistry(registry.key(), registry); // Paper - initialize API registry + io.papermc.paper.registry.PaperRegistryAccess.instance().registerRegistry(registry.key(), registry); // Paper - initialize API registry
ResourceLocation resourceLocation = key.location(); ResourceLocation resourceLocation = key.location();
LOADERS.put(resourceLocation, () -> initializer.run(registry)); LOADERS.put(resourceLocation, () -> bootstrap.run(registry));
- WRITABLE_REGISTRY.register((ResourceKey<WritableRegistry<?>>)key, registry, RegistrationInfo.BUILT_IN); WRITABLE_REGISTRY.register((ResourceKey)key, registry, RegistrationInfo.BUILT_IN);
+ WRITABLE_REGISTRY.register((ResourceKey)key, registry, RegistrationInfo.BUILT_IN); // Paper - decompile fix @@ -328,7 +_,14 @@
return registry;
} }
public static void bootStrap() { public static void bootStrap() {
@ -42,7 +41,7 @@
freeze(); freeze();
validate(REGISTRY); validate(REGISTRY);
} }
@@ -348,6 +367,7 @@ @@ -346,6 +_,7 @@
for (Registry<?> registry : REGISTRY) { for (Registry<?> registry : REGISTRY) {
bindBootstrappedTagsToEmpty(registry); bindBootstrappedTagsToEmpty(registry);