Fix createAndPopulateRegistryMap() always returning null, preventing registry sync.

This was caused by the changes in the port to 23w32a
This commit is contained in:
modmuss50 2023-08-11 12:14:20 +01:00
parent a336222d5a
commit 09816d0313
2 changed files with 8 additions and 19 deletions
fabric-registry-sync-v0/src/main/java/net/fabricmc/fabric/impl/registry/sync
gradle.properties

View file

@ -87,7 +87,7 @@ public final class RegistrySyncManager {
return;
}
final Map<Identifier, Object2IntMap<Identifier>> map = RegistrySyncManager.createAndPopulateRegistryMap(null);
final Map<Identifier, Object2IntMap<Identifier>> map = RegistrySyncManager.createAndPopulateRegistryMap();
if (map == null) {
// Don't send when there is nothing to map
@ -149,13 +149,12 @@ public final class RegistrySyncManager {
}
/**
* Creates a {@link NbtCompound} used to save or sync the registry ids.
* Creates a {@link NbtCompound} used to sync the registry ids.
*
* @param activeMap contains the registry ids that were previously read and applied, can be null.
* @return a {@link NbtCompound} to save or sync, null when empty
* @return a {@link NbtCompound} to sync, null when empty
*/
@Nullable
public static Map<Identifier, Object2IntMap<Identifier>> createAndPopulateRegistryMap(@Nullable Map<Identifier, Object2IntMap<Identifier>> activeMap) {
public static Map<Identifier, Object2IntMap<Identifier>> createAndPopulateRegistryMap() {
Map<Identifier, Object2IntMap<Identifier>> map = new LinkedHashMap<>();
for (Identifier registryId : Registries.REGISTRIES.getIds()) {
@ -197,16 +196,6 @@ public final class RegistrySyncManager {
}
}
/*
* This contains the previous state's registry data, this is used for a few things:
* Such as ensuring that previously modded registries or registry entries are not lost or overwritten.
*/
Object2IntMap<Identifier> previousIdMap = null;
if (activeMap != null && activeMap.containsKey(registryId)) {
previousIdMap = activeMap.get(registryId);
}
RegistryAttributeHolder attributeHolder = RegistryAttributeHolder.get(registry.getKey());
if (!attributeHolder.hasAttribute(RegistryAttribute.SYNCED)) {
@ -220,7 +209,7 @@ public final class RegistrySyncManager {
* This will not sync IDs if a world has been previously modded, either from removed mods
* or a previous version of fabric registry sync.
*/
if (previousIdMap == null || !attributeHolder.hasAttribute(RegistryAttribute.MODDED)) {
if (!attributeHolder.hasAttribute(RegistryAttribute.MODDED)) {
LOGGER.debug("Skipping un-modded registry: " + registryId);
continue;
}

View file

@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx2560M
org.gradle.parallel=true
fabric.loom.multiProjectOptimisation=true
version=0.86.2
version=0.86.3
minecraft_version=23w32a
yarn_version=+build.2
loader_version=0.14.22
@ -23,7 +23,7 @@ fabric-commands-v0-version=0.2.51
fabric-containers-v0-version=0.1.64
fabric-content-registries-v0-version=5.0.0
fabric-crash-report-info-v1-version=0.2.19
fabric-data-generation-api-v1-version=12.2.3
fabric-data-generation-api-v1-version=12.2.4
fabric-dimensions-v1-version=2.1.53
fabric-entity-events-v1-version=1.5.23
fabric-events-interaction-v0-version=0.6.3
@ -44,7 +44,7 @@ fabric-networking-api-v1-version=3.0.0
fabric-object-builder-api-v1-version=11.1.2
fabric-particles-v1-version=1.1.2
fabric-recipe-api-v1-version=1.0.21
fabric-registry-sync-v0-version=3.0.0
fabric-registry-sync-v0-version=3.0.1
fabric-renderer-api-v1-version=3.1.2
fabric-renderer-indigo-version=1.4.2
fabric-renderer-registries-v1-version=3.2.46