Posted February 18, 20205 yr Hello I tryed to generate json resources but GatherDataEvent is never called and idk why because it worked before and now it's not beeing called, there is no error in console. DataGenerators.class @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public class DataGenerators { @SubscribeEvent public static void gatherData(GatherDataEvent event) { DataGenerator generator = event.getGenerator(); if (event.includeServer()) { generator.addProvider(new Recipes(generator)); generator.addProvider(new LootTables(generator)); } } } build.gradle data { workingDirectory project.file('run') property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' property 'forge.logging.console.level', 'debug' args '--mod', 'indreb', '--all', '--output', file('src/generated/resources/') environment 'target', 'fmluserdevdata' mods { indreb { source sourceSets.main } } }
February 18, 20205 yr This is likely because the annotation cannot find / generate an instance of your class. Try to use an inner static class instead. Like this: public class DataGenerators { @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) public static class GatherDataSubscriber { @SubscribeEvent public static void gatherData(GatherDataEvent event) { DataGenerator generator = event.getGenerator(); if (event.includeServer()) { generator.addProvider(new Recipes(generator)); generator.addProvider(new LootTables(generator)); } } } } Or use DeferredRegister instead. PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.
February 18, 20205 yr 2 hours ago, Busti said: Or use DeferredRegister instead. DeferredRegister has nothing to do w/ it. how do you run the data generator ?
February 18, 20205 yr They are subscribing to an event and the event is never called. That is an error that lies in the subscription, IMO and not in the code that is being executed. They could also place a println in their subscriber to see if the subscription worked. I have previously experienced relatively unpredictable behaviour when using @Mod.EventBusSubscriber on a top-level class. For some event types it works, for some it won't. DeferredRegister is a lot better than the annotation system IMO, it feels a lot less finicky. But it might be more complicated for new users, who do not have any FP experience. But that won't stop me from recommending it. Edit: I have not used GatherDataEvent or anything related to it yet. So if that's where the problem lies, I won't be able to help here. From the way the post was written it sounded like it was a subscription problem, which is why I replied. Edited February 18, 20205 yr by Busti PM's regarding modding questions should belong in the Modder Support sub-forum and won't be answered.
March 9, 20205 yr Hi! I had the same problem. I found out that the modid I put in build.gradle wasn't updating the one in the actual run config. So look your run config and make sure the argument is indeed your modid. Edited March 9, 20205 yr by mooviies
May 24, 20214 yr On 3/9/2020 at 8:16 PM, mooviies said: Hi! I had the same problem. I found out that the modid I put in build.gradle wasn't updating the one in the actual run config. So look your run config and make sure the argument is indeed your modid. I can confirm that this also solved the problem for me! In build.gradle there's a line for specifying the modid for data generation.
May 24, 20214 yr Just now, C J said: I can confirm that this also solved the problem for me! In build.gradle there's a line for specifying the modid for data generation. please create your own thread
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.