Prevent NPE and deprecated MissingMappings.getMappings function. Closes #6252

This commit is contained in:
LexManos 2021-01-05 11:47:00 -08:00
parent b6a9274870
commit c4b148b84b
1 changed files with 12 additions and 1 deletions

View File

@ -122,9 +122,20 @@ public class RegistryEvent<T extends IForgeRegistryEntry<T>> extends GenericEven
return this.registry;
}
/*
* This used to be fired on the Mod specific bus, and we could tell which mod was asking for mappings.
* It no longer is, so this method is useless and just returns getAllMappings.
* TODO: Ask cpw how if he wants to re-enable the ModBus rethrow.
*/
@Deprecated
public ImmutableList<Mapping<T>> getMappings()
{
return ImmutableList.copyOf(this.mappings.stream().filter(e -> e.key.getNamespace().equals(this.activeMod.getModId())).collect(Collectors.toList()));
return this.activeMod == null ? getAllMappings() : getMappings(this.activeMod.getModId());
}
public ImmutableList<Mapping<T>> getMappings(String modid)
{
return ImmutableList.copyOf(this.mappings.stream().filter(e -> e.key.getNamespace().equals(modid)).collect(Collectors.toList()));
}
public ImmutableList<Mapping<T>> getAllMappings()