Add a flag to the modidremapping event. If the remapevent is because the registry is refreezing, it'll be true.

This commit is contained in:
cpw 2015-12-03 17:21:04 -05:00
parent f8447264e6
commit 30bc2653c5
3 changed files with 7 additions and 6 deletions

View File

@ -974,9 +974,9 @@ public class Loader
return PersistentRegistryManager.processIdRematches(missingMappings.values(), isLocalWorld, remapBlocks, remapItems);
}
public void fireRemapEvent(Map<ResourceLocation, Integer[]> remapBlocks, Map<ResourceLocation, Integer[]> remapItems)
public void fireRemapEvent(Map<ResourceLocation, Integer[]> remapBlocks, Map<ResourceLocation, Integer[]> remapItems, boolean isFreezing)
{
modController.propogateStateMessage(new FMLModIdMappingEvent(remapBlocks, remapItems));
modController.propogateStateMessage(new FMLModIdMappingEvent(remapBlocks, remapItems, isFreezing));
}
public void runtimeDisableMod(String modId)

View File

@ -44,9 +44,10 @@ public class FMLModIdMappingEvent extends FMLEvent {
}
public final ImmutableList<ModRemapping> remappedIds;
public FMLModIdMappingEvent(Map<ResourceLocation, Integer[]> blocks, Map<ResourceLocation, Integer[]> items)
public final boolean isFrozen;
public FMLModIdMappingEvent(Map<ResourceLocation, Integer[]> blocks, Map<ResourceLocation, Integer[]> items, boolean isFrozen)
{
this.isFrozen = isFrozen;
List<ModRemapping> remappings = Lists.newArrayList();
for (Entry<ResourceLocation, Integer[]> mapping : blocks.entrySet())
{

View File

@ -188,7 +188,7 @@ public class PersistentRegistryManager
forAllRegistries(PersistentRegistry.ACTIVE, DumpRegistryFunction.OPERATION);
// Tell mods that the ids have changed
Loader.instance().fireRemapEvent(remaps.get(BLOCKS), remaps.get(ITEMS));
Loader.instance().fireRemapEvent(remaps.get(BLOCKS), remaps.get(ITEMS), false);
// The id map changed, ensure we apply object holders
ObjectHolderRegistry.INSTANCE.applyObjectHolders();
@ -267,7 +267,7 @@ public class PersistentRegistryManager
loadRegistry(r.getKey(), PersistentRegistry.FROZEN, PersistentRegistry.ACTIVE, PersistentRegistry.ACTIVE.registrySuperTypes.inverse().get(r.getKey()));
}
// the id mapping has reverted, fire remap events for those that care about id changes
Loader.instance().fireRemapEvent(ImmutableMap.<ResourceLocation, Integer[]>of(), ImmutableMap.<ResourceLocation, Integer[]>of());
Loader.instance().fireRemapEvent(ImmutableMap.<ResourceLocation, Integer[]>of(), ImmutableMap.<ResourceLocation, Integer[]>of(), true);
// the id mapping has reverted, ensure we sync up the object holders
ObjectHolderRegistry.INSTANCE.applyObjectHolders();