From 7d00d015f3b6000c68f7e5fa1fda9777042d4114 Mon Sep 17 00:00:00 2001 From: LexManos Date: Sun, 1 Nov 2020 20:30:38 -0800 Subject: [PATCH] Fix Biomes not properly copying over ids loaded from the save to the new Dynamic Registry. --- .../util/registry/DynamicRegistries.java.patch | 11 +++++++++++ .../net/minecraftforge/registries/ForgeRegistry.java | 10 ++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 patches/minecraft/net/minecraft/util/registry/DynamicRegistries.java.patch diff --git a/patches/minecraft/net/minecraft/util/registry/DynamicRegistries.java.patch b/patches/minecraft/net/minecraft/util/registry/DynamicRegistries.java.patch new file mode 100644 index 000000000..b1fd24064 --- /dev/null +++ b/patches/minecraft/net/minecraft/util/registry/DynamicRegistries.java.patch @@ -0,0 +1,11 @@ +--- a/net/minecraft/util/registry/DynamicRegistries.java ++++ b/net/minecraft/util/registry/DynamicRegistries.java +@@ -90,6 +90,8 @@ + RegistryKey> registrykey = p_243607_2_.func_243622_a(); + boolean flag = !registrykey.equals(Registry.field_243549_ar) && !registrykey.equals(Registry.field_239698_ad_); + Registry registry = field_243600_c.func_243612_b(registrykey); ++ if (!registrykey.equals(Registry.field_239698_ad_)) ++ registry = ((Registry>)WorldGenRegistries.field_243650_b).func_230516_a_((RegistryKey>)registrykey); + MutableRegistry mutableregistry = p_243607_0_.func_243612_b(registrykey); + + for(Entry, E> entry : registry.func_239659_c_()) { diff --git a/src/main/java/net/minecraftforge/registries/ForgeRegistry.java b/src/main/java/net/minecraftforge/registries/ForgeRegistry.java index f88f537d6..3af4d8993 100644 --- a/src/main/java/net/minecraftforge/registries/ForgeRegistry.java +++ b/src/main/java/net/minecraftforge/registries/ForgeRegistry.java @@ -22,6 +22,7 @@ package net.minecraftforge.registries; import java.util.BitSet; import java.util.Collection; import java.util.Collections; +import java.util.Comparator; import java.util.Iterator; import java.util.List; import java.util.Map; @@ -840,11 +841,12 @@ public class ForgeRegistry> implements IForgeRe public static class Snapshot { - public final Map ids = Maps.newTreeMap(); - public final Map aliases = Maps.newTreeMap(); + private static final Comparator sorter = (a,b) -> a.compareNamespaced(b); + public final Map ids = Maps.newTreeMap(sorter); + public final Map aliases = Maps.newTreeMap(sorter); public final Set blocked = Sets.newTreeSet(); - public final Set dummied = Sets.newTreeSet(); - public final Map overrides = Maps.newTreeMap(); + public final Set dummied = Sets.newTreeSet(sorter); + public final Map overrides = Maps.newTreeMap(sorter); private PacketBuffer binary = null; public CompoundNBT write()