Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Good morning,

I'm trying to implement ShapedRecipes into my mod via DataGeneration. I'm using vanilla MC code as template, and I'm able to create a single recipe, but the code will fail if I try to build multiple recipes in the same method. Which is a bit confusing, since I pretty much do it exactly as the vanilla code. The code:

	public class DataGenRecipe extends RecipeProvider {
	      public DataGenRecipe(DataGenerator generator) {
        super(generator);
      }
	      @Override
      protected void registerRecipes(Consumer<IFinishedRecipe> consumer) {
          brickBasalt(consumer, RegisterMain.BLOCKBRICKBASALT.get(), RegisterMain.BLOCKBASALTITEM.get());
          brickBluestone(consumer, RegisterMain.BLOCKBRICKBLUESTONE.get(), RegisterMain.BLOCKBLUESTONEITEM.get());
      }
      
      private void brickBasalt(Consumer<IFinishedRecipe> recipeConsumer, IItemProvider output, IItemProvider input) {
          ShapedRecipeBuilder
              .shapedRecipe(output)
              .key('#', input)
              .patternLine("###")
              .patternLine("###")
              .patternLine("###")
              .setGroup("matlibtab")
              .addCriterion("has_item", hasItem(input))
              .build(recipeConsumer);
      }      
      
      private void brickBluestone(Consumer<IFinishedRecipe> recipeConsumer, IItemProvider output, IItemProvider input) {
          ShapedRecipeBuilder
              .shapedRecipe(output)
              .key('#', input)
              .patternLine("###")
              .patternLine("###")
              .patternLine("###")
              .setGroup("matlibtab")
              .addCriterion("has_item", hasItem(input))
              .build(recipeConsumer);
      }           
      
}

The error log:

[22Oct2021 05:06:36.615] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher running: args [--mod, matlib, --all, --output, D:\Ablage\Modding\Minecraft\MatEvo_1.16.4\src\generated\resources, --existing, D:\Ablage\Modding\Minecraft\MatEvo_1.16.4\src\main\resources, --gameDir, ., --launchTarget, fmluserdevdata, --fml.mcpVersion, 20201102.104115, --fml.mcVersion, 1.16.4, --fml.forgeGroup, net.minecraftforge, --fml.forgeVersion, 35.1.4]


[22Oct2021 05:06:36.640] [main/INFO] [cpw.mods.modlauncher.Launcher/MODLAUNCHER]: ModLauncher 8.0.6+85+master.325de55 starting: java version 1.8.0_292 by AdoptOpenJDK
[22Oct2021 05:06:36.815] [main/INFO] [net.minecraftforge.fml.loading.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust
[22Oct2021 05:06:36.843] [main/INFO] [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.2 Source=file:/C:/Users/Marcel/.gradle/caches/modules-2/files-2.1/org.spongepowered/mixin/0.8.2/1cf212283d26f706fd3074318870bebd14d2a9ed/mixin-0.8.2.jar Service=ModLauncher Env=UNKNOWN
[22Oct2021 05:06:37.640] [main/INFO] [cpw.mods.modlauncher.LaunchServiceHandler/MODLAUNCHER]: Launching target 'fmluserdevdata' with arguments [--gameDir, ., --mod, matlib, --all, --output, D:\Ablage\Modding\Minecraft\MatEvo_1.16.4\src\generated\resources, --existing, D:\Ablage\Modding\Minecraft\MatEvo_1.16.4\src\main\resources]
[22Oct2021 05:06:37.695] [main/INFO] [net.minecraftforge.fml.DatagenModLoader/]: Initializing Data Gatherer for mods [matlib]
[22Oct2021 05:06:40.839] [modloading-worker-2/INFO] [net.minecraftforge.common.ForgeMod/FORGEMOD]: Forge mod loading, version 35.1.4, for MC 1.16.4 with MCP 20201102.104115
[22Oct2021 05:06:40.840] [modloading-worker-2/INFO] [net.minecraftforge.common.MinecraftForge/FORGE]: MinecraftForge v35.1.4 Initialized
[22Oct2021 05:06:41.083] [main/INFO] [net.minecraft.data.DataGenerator/]: Starting provider: LootTables
[22Oct2021 05:06:41.139] [main/INFO] [net.minecraft.data.DataGenerator/]: LootTables finished after 54 ms
[22Oct2021 05:06:41.139] [main/INFO] [net.minecraft.data.DataGenerator/]: Starting provider: Recipes
[22Oct2021 05:06:41.151] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
[22Oct2021 05:06:41.151] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:39)
[22Oct2021 05:06:41.151] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54)
[22Oct2021 05:06:41.151] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72)
[22Oct2021 05:06:41.151] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at cpw.mods.modlauncher.Launcher.run(Launcher.java:82)
[22Oct2021 05:06:41.151] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at cpw.mods.modlauncher.Launcher.main(Launcher.java:66)
[22Oct2021 05:06:41.151] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]:     at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105)
[22Oct2021 05:06:41.151] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: Caused by: java.lang.reflect.InvocationTargetException
[22Oct2021 05:06:41.151] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]:     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[22Oct2021 05:06:41.151] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]:     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[22Oct2021 05:06:41.151] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]:     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[22Oct2021 05:06:41.151] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]:     at java.lang.reflect.Method.invoke(Method.java:498)
[22Oct2021 05:06:41.151] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]:     at net.minecraftforge.userdev.FMLUserdevDataLaunchProvider.lambda$launchService$0(FMLUserdevDataLaunchProvider.java:51)
[22Oct2021 05:06:41.152] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]:     at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37)
[22Oct2021 05:06:41.152] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]:     ... 5 more
[22Oct2021 05:06:41.152] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:644]: Caused by: java.lang.NullPointerException
[22Oct2021 05:06:41.152] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:644]:     at net.minecraft.data.ShapedRecipeBuilder.build(ShapedRecipeBuilder.java:136)
[22Oct2021 05:06:41.152] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:644]:     at net.minecraft.data.ShapedRecipeBuilder.build(ShapedRecipeBuilder.java:114)
[22Oct2021 05:06:41.152] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:644]:     at com.mofakin.matlib.datagen.DataGenRecipe.brickBluestone(DataGenRecipe.java:46)
[22Oct2021 05:06:41.152] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:644]:     at com.mofakin.matlib.datagen.DataGenRecipe.registerRecipes(DataGenRecipe.java:22)
[22Oct2021 05:06:41.152] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:644]:     at net.minecraft.data.RecipeProvider.act(RecipeProvider.java:53)
[22Oct2021 05:06:41.152] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:644]:     at net.minecraft.data.DataGenerator.run(DataGenerator.java:53)
[22Oct2021 05:06:41.152] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:644]:     at net.minecraftforge.fml.event.lifecycle.GatherDataEvent$DataGeneratorConfig.lambda$runAll$0(GatherDataEvent.java:111)
[22Oct2021 05:06:41.152] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:644]:     at cpw.mods.modlauncher.api.LamdbaExceptionUtils.lambda$rethrowConsumer$0(LamdbaExceptionUtils.java:34)
[22Oct2021 05:06:41.152] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:644]:     at java.util.HashMap$Values.forEach(HashMap.java:981)
[22Oct2021 05:06:41.152] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:644]:     at net.minecraftforge.fml.event.lifecycle.GatherDataEvent$DataGeneratorConfig.runAll(GatherDataEvent.java:107)
[22Oct2021 05:06:41.152] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:644]:     at net.minecraftforge.fml.DatagenModLoader.begin(DatagenModLoader.java:61)
[22Oct2021 05:06:41.152] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:644]:     at net.minecraft.data.Main.main(Main.java:43)
[22Oct2021 05:06:41.152] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:644]:     ... 11 more

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.