Fix up persistent substitution. Should close #2259

This commit is contained in:
cpw 2015-12-23 10:37:11 -05:00
parent d8ca68b280
commit 5562c14c45
3 changed files with 6 additions and 2 deletions

View File

@ -160,6 +160,8 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespacedDefaul
this.minId = otherRegistry.minId;
this.aliases.clear();
this.aliases.putAll(otherRegistry.aliases);
this.persistentSubstitutions.clear();
this.persistentSubstitutions.putAll(otherRegistry.getPersistentSubstitutions());
this.activeSubstitutions.clear();
underlyingIntegerMap = new ObjectIntIdentityMap<I>();
@ -599,7 +601,7 @@ public class FMLControlledNamespacedRegistry<I> extends RegistryNamespacedDefaul
getPersistentSubstitutions().put(nameToReplace, replacement);
}
private BiMap<ResourceLocation, I> getPersistentSubstitutions()
BiMap<ResourceLocation, I> getPersistentSubstitutions()
{
return persistentSubstitutions;
}

View File

@ -185,7 +185,7 @@ public class GameData
void registerSubstitutionAlias(String name, GameRegistry.Type type, Object toReplace) throws ExistingSubstitutionException
{
ResourceLocation nameToSubstitute = new ResourceLocation(Loader.instance().activeModContainer().getModId(), name);
ResourceLocation nameToSubstitute = new ResourceLocation(name);
if (type == GameRegistry.Type.BLOCK)
{
iBlockRegistry.addSubstitutionAlias(Loader.instance().activeModContainer().getModId(), nameToSubstitute, (Block)toReplace);

View File

@ -269,6 +269,8 @@ public class PersistentRegistryManager
StartupQuery.abort();
}
FMLControlledNamespacedRegistry<T> newRegistry = PersistentRegistry.STAGING.getOrShallowCopyRegistry(registryName, regType, currentRegistry);
// Copy the persistent substitution set from the currently active one into the new registry
newRegistry.getPersistentSubstitutions().putAll(currentRegistry.getPersistentSubstitutions());
GameDataSnapshot.Entry snapshotEntry = snapEntry.getValue();
Set<ResourceLocation> substitutions = snapshotEntry.substitutions;
if (injectFrozenData)