mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 16:27:47 +00:00
Fire registry events in the order vanilla registers to registries (#8677)
Custom registries are still fired in alphabetical order, after all vanilla registries. Move forge's data_serializers registry to forge namespace.
This commit is contained in:
1 parent
0c35436217
commit
9b144f4541
5 files changed
+25
-12
No files matched your search
@@ -12,6 +12,7 @@ import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Multimap;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
import java.util.LinkedHashSet;
|
||||
import net.minecraft.core.DefaultedRegistry;
|
||||
import net.minecraft.core.IdMapper;
|
||||
import net.minecraft.core.MappedRegistry;
|
||||
@@ -297,20 +298,14 @@ public class GameData
|
||||
Set<ResourceLocation> keySet = new HashSet<>(RegistryManager.ACTIVE.registries.keySet());
|
||||
keySet.addAll(RegistryManager.getVanillaRegistryKeys());
|
||||
keySet.addAll(BuiltinRegistries.REGISTRY.keySet());
|
||||
List<ResourceLocation> keys = keySet.stream()
|
||||
.sorted((o1, o2) -> String.valueOf(o1).compareToIgnoreCase(String.valueOf(o2)))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
//Move Blocks to first, and Items to second.
|
||||
keys.remove(BLOCKS.location());
|
||||
keys.remove(ITEMS.location());
|
||||
|
||||
keys.add(0, BLOCKS.location());
|
||||
keys.add(1, ITEMS.location());
|
||||
Set<ResourceLocation> ordered = new LinkedHashSet<>(MappedRegistry.getKnownRegistries());
|
||||
ordered.retainAll(keySet);
|
||||
ordered.addAll(keySet.stream().sorted(ResourceLocation::compareNamespaced).toList());
|
||||
|
||||
RuntimeException aggregate = new RuntimeException();
|
||||
|
||||
for (ResourceLocation rootRegistryName : keys)
|
||||
for (ResourceLocation rootRegistryName : ordered)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user