3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-14 20:10:05 +01:00

Run 'freeze' listeners before tag events

Dieser Commit ist enthalten in:
Jake Potrebic 2024-11-10 14:50:09 -08:00
Ursprung 1ef4c0e7ff
Commit c50ca4d114
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: ECE0B3C133C016C5
2 geänderte Dateien mit 17 neuen und 12 gelöschten Zeilen

Datei anzeigen

@ -11,7 +11,7 @@ public net.minecraft.resources.RegistryOps lookupProvider
public net.minecraft.resources.RegistryOps$HolderLookupAdapter
diff --git a/src/main/java/io/papermc/paper/registry/PaperRegistries.java b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
index 39120c63ed25d45a4083523fbfe79d871f4d892e..f563e6e7a558d22f571154640e99cc86718c89f5 100644
index c6969f968b45eff2aeb44e647712abda10c7c113..d34ffad8a36abbb215491d74ae8d9b490a0bc64f 100644
--- a/src/main/java/io/papermc/paper/registry/PaperRegistries.java
+++ b/src/main/java/io/papermc/paper/registry/PaperRegistries.java
@@ -2,6 +2,7 @@ package io.papermc.paper.registry;
@ -1174,7 +1174,7 @@ index 4638ba98dbbdb0f880337347be85a6e0fbed2191..bc448f8511c629d1f13d4baf717a11e6
}
}
diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
index 61774165a25209ee6d26cf8d80149b220c3874e6..fdc88e52235a152dbe3cca273990b4b68f8daaf8 100644
index 61774165a25209ee6d26cf8d80149b220c3874e6..c5e279216f6cb880397ea2768ee6e99a8798e3e1 100644
--- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java
+++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
@@ -130,7 +130,7 @@ public class RegistryDataLoader {
@ -1195,7 +1195,7 @@ index 61774165a25209ee6d26cf8d80149b220c3874e6..fdc88e52235a152dbe3cca273990b4b6
}
private static RegistryAccess.Frozen load(
@@ -148,9 +148,11 @@ public class RegistryDataLoader {
@@ -148,7 +148,8 @@ public class RegistryDataLoader {
Map<ResourceKey<?>, Exception> map = new HashMap<>();
List<RegistryDataLoader.Loader<?>> list = entries.stream().map(entry -> entry.create(Lifecycle.stable(), map)).collect(Collectors.toUnmodifiableList());
RegistryOps.RegistryInfoLookup registryInfoLookup = createContext(registries, list);
@ -1204,11 +1204,8 @@ index 61774165a25209ee6d26cf8d80149b220c3874e6..fdc88e52235a152dbe3cca273990b4b6
+ list.forEach(loader -> loadable.apply((RegistryDataLoader.Loader<?>)loader, registryInfoLookup, conversions));
list.forEach(loader -> {
Registry<?> registry = loader.registry();
+ io.papermc.paper.registry.PaperRegistryListenerManager.INSTANCE.runFreezeListeners(loader.registry.key(), conversions); // Paper - run pre-freeze listeners
try {
registry.freeze();
@@ -238,13 +240,13 @@ public class RegistryDataLoader {
@@ -238,13 +239,13 @@ public class RegistryDataLoader {
}
private static <E> void loadElementFromResource(
@ -1224,7 +1221,7 @@ index 61774165a25209ee6d26cf8d80149b220c3874e6..fdc88e52235a152dbe3cca273990b4b6
}
}
@@ -253,7 +255,8 @@ public class RegistryDataLoader {
@@ -253,7 +254,8 @@ public class RegistryDataLoader {
RegistryOps.RegistryInfoLookup infoGetter,
WritableRegistry<E> registry,
Decoder<E> elementDecoder,
@ -1234,7 +1231,7 @@ index 61774165a25209ee6d26cf8d80149b220c3874e6..fdc88e52235a152dbe3cca273990b4b6
) {
String string = Registries.elementsDirPath(registry.key());
FileToIdConverter fileToIdConverter = FileToIdConverter.json(string);
@@ -266,7 +269,7 @@ public class RegistryDataLoader {
@@ -266,7 +268,7 @@ public class RegistryDataLoader {
RegistrationInfo registrationInfo = REGISTRATION_INFO_CACHE.apply(resource.knownPackInfo());
try {
@ -1243,6 +1240,14 @@ index 61774165a25209ee6d26cf8d80149b220c3874e6..fdc88e52235a152dbe3cca273990b4b6
} catch (Exception var15) {
errors.put(
resourceKey,
@@ -275,6 +277,7 @@ public class RegistryDataLoader {
}
}
+ io.papermc.paper.registry.PaperRegistryListenerManager.INSTANCE.runFreezeListeners(registry.key(), conversions); // Paper - run pre-freeze listeners
TagLoader.loadTagsForRegistry(resourceManager, registry);
}
@@ -284,7 +287,8 @@ public class RegistryDataLoader {
RegistryOps.RegistryInfoLookup infoGetter,
WritableRegistry<E> registry,

Datei anzeigen

@ -461,20 +461,20 @@ index 0000000000000000000000000000000000000000..d6d4bfc6f45d646afeace422a038c670
+) {
+}
diff --git a/src/main/java/net/minecraft/resources/RegistryDataLoader.java b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
index fdc88e52235a152dbe3cca273990b4b68f8daaf8..13797035494a1e010e1da529fb46040f8a6e859f 100644
index c5e279216f6cb880397ea2768ee6e99a8798e3e1..46bf2b95658ca3bbd3048df5f8adf1bdcc2d3571 100644
--- a/src/main/java/net/minecraft/resources/RegistryDataLoader.java
+++ b/src/main/java/net/minecraft/resources/RegistryDataLoader.java
@@ -278,7 +278,7 @@ public class RegistryDataLoader {
}
}
io.papermc.paper.registry.PaperRegistryListenerManager.INSTANCE.runFreezeListeners(registry.key(), conversions); // Paper - run pre-freeze listeners
- TagLoader.loadTagsForRegistry(resourceManager, registry);
+ TagLoader.loadTagsForRegistry(resourceManager, registry, io.papermc.paper.plugin.lifecycle.event.registrar.ReloadableRegistrarEvent.Cause.INITIAL); // Paper - tag lifecycle - add cause
}
static <E> void loadContentsFromNetwork(
diff --git a/src/main/java/net/minecraft/server/MinecraftServer.java b/src/main/java/net/minecraft/server/MinecraftServer.java
index e3e3099bb33d21055e480fdbd2df2a3e159f0f1a..843f8ccce6302a6db6cc61c496a5eee21305a88f 100644
index ff6f2dc31bbbaa420323a68282cb1ee3d8b98c0f..e18692ad6bdbc8bc2df605833501b1ad888b8b7d 100644
--- a/src/main/java/net/minecraft/server/MinecraftServer.java
+++ b/src/main/java/net/minecraft/server/MinecraftServer.java
@@ -2208,7 +2208,7 @@ public abstract class MinecraftServer extends ReentrantBlockableEventLoop<TickTa