--- a/net/minecraft/data/Main.java
+++ b/net/minecraft/data/Main.java
@@ -21,8 +21,12 @@
       OptionSpec<Void> optionspec6 = optionparser.accepts("all", "Include all generators");
       OptionSpec<String> optionspec7 = optionparser.accepts("output", "Output folder").withRequiredArg().defaultsTo("generated");
       OptionSpec<String> optionspec8 = optionparser.accepts("input", "Input folder").withRequiredArg();
+      OptionSpec<String> existing = optionparser.accepts("existing", "Existing resource packs that generated resources can reference").withRequiredArg();
+      OptionSpec<java.io.File> gameDir = optionparser.accepts("gameDir").withRequiredArg().ofType(java.io.File.class).defaultsTo(new java.io.File(".")).required(); //Need by modlauncher, so lets just eat it
+      OptionSpec<String> mod = optionparser.accepts("mod", "A modid to dump").withRequiredArg().withValuesSeparatedBy(",");
+      OptionSpec<Void> flat = optionparser.accepts("flat", "Do not append modid prefix to output directory when generating for multiple mods");
       OptionSet optionset = optionparser.parse(p_main_0_);
-      if (!optionset.has(optionspec) && optionset.hasOptions()) {
+      if (!optionset.has(optionspec) && optionset.hasOptions() && !(optionset.specs().size() == 1 && optionset.has(gameDir))) {
          Path path = Paths.get(optionspec7.value(optionset));
          boolean flag = optionset.has(optionspec6);
          boolean flag1 = flag || optionset.has(optionspec2);
@@ -30,10 +34,13 @@
          boolean flag3 = flag || optionset.has(optionspec3);
          boolean flag4 = flag || optionset.has(optionspec4);
          boolean flag5 = flag || optionset.has(optionspec5);
-         DataGenerator datagenerator = func_200264_a(path, optionset.valuesOf(optionspec8).stream().map((p_200263_0_) -> {
-            return Paths.get(p_200263_0_);
-         }).collect(Collectors.toList()), flag1, flag2, flag3, flag4, flag5);
-         datagenerator.func_200392_c();
+         Collection<Path> inputs = optionset.valuesOf(optionspec8).stream().map(Paths::get).collect(Collectors.toList());
+         Collection<Path> existingPacks = optionset.valuesOf(existing).stream().map(Paths::get).collect(Collectors.toList());
+         java.util.Set<String> mods = new java.util.HashSet<>(optionset.valuesOf(mod));
+         boolean isFlat = mods.isEmpty() || optionset.has(flat);
+         net.minecraftforge.fml.DatagenModLoader.begin(mods, path, inputs, existingPacks, flag2, flag1, flag3, flag4, flag5, isFlat);
+         if (mods.contains("minecraft") || mods.isEmpty())
+            func_200264_a(isFlat ? path : path.resolve("minecraft"), inputs, flag1, flag2, flag3, flag4, flag5).func_200392_c();
       } else {
          optionparser.printHelpOn(System.out);
       }
