Skip running the datagenerator on unrequested mods.

Add a run config for the data task for modders to use

Signed-off-by: cpw <cpw+github@weeksfamily.ca>
This commit is contained in:
cpw 2019-06-16 00:34:23 -04:00
parent 7e3e6b1969
commit 604987a005
No known key found for this signature in database
GPG Key ID: 8EB3DF749553B1B7
3 changed files with 16 additions and 3 deletions

View File

@ -877,6 +877,19 @@ project(':forge') {
environment 'MCP_MAPPINGS', '{mcp_mappings}'
environment 'FORGE_VERSION', "${project.version.substring(MC_VERSION.length() + 1)}"
}
data {
main 'net.minecraftforge.userdev.LaunchTesting'
environment 'target', 'fmldevdata'
environment 'MC_VERSION', "${MC_VERSION}"
environment 'FORGE_GROUP', "${project.group}"
environment 'MCP_VERSION', "${MCP_VERSION}"
environment 'MOD_CLASSES', '{source_roots}'
environment 'MCP_MAPPINGS', '{mcp_mappings}'
environment 'FORGE_VERSION', "${project.version.substring(MC_VERSION.length() + 1)}"
}
}
}

View File

@ -231,6 +231,6 @@ public class ModLoader
}
public Function<ModContainer, ModLifecycleEvent> getDataGeneratorEvent() {
return mc -> new GatherDataEvent(mc, dataGeneratorConfig.makeGenerator(p->dataGeneratorConfig.getMods().size() == 1 ? p : p.resolve(mc.getModId())), dataGeneratorConfig);
return mc -> new GatherDataEvent(mc, dataGeneratorConfig.makeGenerator(p->dataGeneratorConfig.getMods().size() == 1 ? p : p.resolve(mc.getModId()), dataGeneratorConfig.getMods().contains(mc.getModId())), dataGeneratorConfig);
}
}

View File

@ -74,9 +74,9 @@ public class GatherDataEvent extends ModLifecycleEvent
return mods;
}
public DataGenerator makeGenerator(final Function<Path,Path> pathEnhancer) {
public DataGenerator makeGenerator(final Function<Path,Path> pathEnhancer, final boolean shouldExecute) {
final DataGenerator generator = new DataGenerator(pathEnhancer.apply(path), inputs);
generators.add(generator);
if (shouldExecute) generators.add(generator);
return generator;
}