Posted October 5, 20204 yr I am trying to generate items models and block states. I am having problems with my blockstateprovider not passing in debug here is my eventhandler https://github.com/mightydanp/IndustrialTech/blob/master/src/main/java/mightydanp/industrialtech/api/common/handler/DataGenEventHandler.java i put a breaking point on 34 https://github.com/mightydanp/IndustrialTech/blob/master/src/main/java/mightydanp/industrialtech/api/common/datagen/BlockStates.java#L34 but it doesnt pass it. . i am trying to get my blockstates to look like so { "variants": { "": {"model": "industrialtech:block/ore/stone_normal_ore"} } } and my item modes to look like so { "parent": "industrialtech:block/ore/stone_normal_ore", "display": { "gui": { "rotation": [ 30, 225, 0 ], "translation": [ 0, 0, 0], "scale":[ 0.625, 0.625, 0.625 ] }, "ground": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 3, 0], "scale":[ 0.25, 0.25, 0.25 ] }, "fixed": { "rotation": [ 0, 0, 0 ], "translation": [ 0, 0, 0], "scale":[ 0.5, 0.5, 0.5 ] }, "thirdperson_righthand": { "rotation": [ 75, 45, 0 ], "translation": [ 0, 2.5, 0], "scale": [ 0.375, 0.375, 0.375 ] }, "firstperson_righthand": { "rotation": [ 0, 45, 0 ], "translation": [ 0, 0, 0 ], "scale": [ 0.40, 0.40, 0.40 ] }, "firstperson_lefthand": { "rotation": [ 0, 225, 0 ], "translation": [ 0, 0, 0 ], "scale": [ 0.40, 0.40, 0.40 ] } } } Edited October 5, 20204 yr by Mightydanp
October 5, 20204 yr This code looks problematic for a number of reasons: For one, I don't see how the event will run. Two, do you have the build.gradle setup? Three, you're using unchecked model files meaning you don't have anything really set up correctly. Four, don't iterate through an entire block list if you're just looking for a specific case. Five, I think you need to review how the builder works. Six, there's already a simple block state provider that will generate the required block. Seven, you never generate an item for the block.
October 6, 20204 yr Author 1. When i put a debug point on line 22 it gets cause but a debug point on line 34 https://github.com/mightydanp/IndustrialTech/blob/master/src/main/java/mightydanp/industrialtech/api/common/datagen/BlockStates.java#L34 doesnt catch. So what do you mean by that. 2. It is set up here on line 63 https://github.com/mightydanp/IndustrialTech/blob/master/build.gradle#L63 3.it was the onlything i could find inside modelfile that i though would mean get model by adress. Alot of the other just say parent 4. The only reason why im going throw a full list is because i dong want to make 114 lines of code of (matertialHandlerHelper) 5.i have no idea how the builder works most tutorials just throw there version of code at you without explaining what they did. 6. Thank you i didnt know that 7.i was just trying to get the block to generate. You can get the item to generate in the blockstate class ?
October 6, 20204 yr 4 minutes ago, Mightydanp said: doesnt catch. If a line of code never gets caught by a breakpoint, it means that it's either never called from either no entries or not registering the event. 5 minutes ago, Mightydanp said: that i though would mean get model by adress. Alot of the other just say parent Yes. You can give a model a parent that it will borrow a structure from. Most blocks parent block/block if anything. 6 minutes ago, Mightydanp said: The only reason why im going throw a full list is because i dong want to make 114 lines of code of Fair enough. 6 minutes ago, Mightydanp said: i have no idea how the builder works most tutorials just throw there version of code at you without explaining what they did. Here's a list of every method documented in states/models. 8 minutes ago, Mightydanp said: You can get the item to generate in the blockstate class That's what you need to do. The block state provider gives you the ability to create a state parser, block model, and item model from the class. Otherwise, it will most likely throw an error if you make a separate item model provider.
October 6, 20204 yr Author @Mod.EventBusSubscriber(bus = Bus.MOD) public class DataGenEventHandler { @SubscribeEvent public static void gatherData(GatherDataEvent event) { DataGenerator gen = event.getGenerator(); if (event.includeClient()) { gen.addProvider(new BlockStates(gen, event.getExistingFileHelper())); } if (event.includeServer()){ } } } i have it set up like so also what in modelfile do i use use existing model i dont really need to use a parent in my blockstate
October 6, 20204 yr And I quote from the EventBusSubscriber javadocs for the modid parameter 'only necessary if this annotation is not on the same class that has a @Mod annotation.' 5 minutes ago, Mightydanp said: do i use use existing model You should always use existing model. 5 minutes ago, Mightydanp said: i dont really need to use a parent in my blockstate The parent is for your block model, not the block state. Which reminds me, you don't ever show what you want your block model to look like.
October 6, 20204 yr Author Quote also which one in modelfile do i use to use existing model file. i dont really need to use a parent in my blockstate i have these for the block model https://github.com/mightydanp/IndustrialTech/blob/master/src/main/resources/assets/industrialtech/models/block/ore/stone_ore.json https://github.com/mightydanp/IndustrialTech/blob/master/src/main/resources/assets/industrialtech/models/block/ore/state/ore.json as-well as this for the item https://github.com/mightydanp/IndustrialTech/blob/master/src/main/resources/assets/industrialtech/models/item/stone_iron_ore.json
October 6, 20204 yr Author so now i have for(RegistryObject<Block> blockRegistered : material.blockOre) { Block oreBlock = blockRegistered.get(); VariantBlockStateBuilder builder = getVariantBuilder(oreBlock); String modId = oreBlock.getRegistryName().toString().split(":")[0]; String oreName = oreBlock.getRegistryName().toString().split(":")[1]; String stoneVariant = oreBlock.getRegistryName().toString().split(":")[1].split("_")[0]; ModelFile ore = models().withExistingParent(oreName, "block/ore/" + stoneVariant + "_ore"); builder.forAllStates(state -> ConfiguredModel.builder().modelFile(ore).build()); simpleBlock(oreBlock , ore); simpleBlockItem(oreBlock, ore); } also i have @Mod.EventBusSubscriber(bus = Bus.MOD) because its outside the main mod class that has @Mod i put a line BlockStates class on line 29 and the breaking point hits but its not hitting inside registerStatesAndModels Edited October 6, 20204 yr by Mightydanp
October 7, 20204 yr Author This is very irritating because its still wont pass into registerStatesAndModels nomatter what i do.
October 7, 20204 yr 23 hours ago, ChampionAsh5357 said: And I quote from the EventBusSubscriber javadocs for the modid parameter 'only necessary if this annotation is not on the same class that has a @Mod annotation.'
October 7, 20204 yr Author But its not in the same class so i just follow that so why do you keep quoting something i already am following Edited October 7, 20204 yr by Mightydanp
October 7, 20204 yr On 10/5/2020 at 10:05 PM, Mightydanp said: @Mod.EventBusSubscriber(bus = Bus.MOD) Because you're not following it. I don't see a parameter named modid anywhere in here.
October 7, 20204 yr Author might not have updated it on github but i do have @Mod.EventBusSubscriber(bus = Bus.MOD, modid = Ref.mod_id) public class DataGenEventHandler {
October 7, 20204 yr Apologies then. You should probably try refreshing your gradle workspace, regenning your runs, and then select runData.
October 7, 20204 yr Author rebuilding runs fix the problem my only problem atm is i have a IndustrialTech\src\main\resources\assets\industrialtech\models\block\ore\stone_ore.json and i get Caused by: java.lang.IllegalStateException: Model at industrialtech:block/ore/stone_ore does not exist i have it setup like so ModelFile ore = models().withExistingParent(oreName, modId + ":block/ore/" + stoneVariant + "_ore"); i have data { workingDirectory project.file('run') // Recommended logging data for a userdev environment property 'forge.logging.markers', 'SCAN,REGISTRIES,REGISTRYDUMP' // Recommended logging level for the console property 'forge.logging.console.level', 'debug' args '--mod', 'industrialtech', '--all', '--output', file('src/generated/resources/') mods { industrialtech { source sourceSets.main } } } Edited October 7, 20204 yr by Mightydanp
October 7, 20204 yr Yes, that's because it doesn't recognize any existing files with that name. If you want to iterate through the existing files, you will need to add a '--existing' arg pointing to your 'src/main/resources'. Note that this will only cover files in that specific location.
October 7, 20204 yr Author everything inside src/main/resources will be loaded but everything like src/main/resources/industrialcraft wont ?
October 7, 20204 yr 7 minutes ago, Mightydanp said: src/main/resources/industrialcraft That is within 'src/main/resources'. I was saying for generated files it wouldn't be counted as they are saved to 'src/generated/resources' as specified in your code above which is not within 'main/resources'. Edited October 7, 20204 yr by ChampionAsh5357
October 7, 20204 yr Author sweet i got it to find my file but i get a crash on line 51 so i am doing something wrong https://github.com/mightydanp/IndustrialTech/blob/master/src/main/java/mightydanp/industrialtech/api/common/datagen/BlockStates.java#L51 [23:13:38] [main/INFO] [minecraft/DataGenerator]: Starting provider: Block States: industrialtech Exception in thread "main" [23:14:00] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException [23:14:00] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:39) [23:14:00] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [23:14:00] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [23:14:00] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at cpw.mods.modlauncher.Launcher.run(Launcher.java:81) [23:14:00] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at cpw.mods.modlauncher.Launcher.main(Launcher.java:65) [23:14:00] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [23:14:00] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: Caused by: java.lang.reflect.InvocationTargetException [23:14:00] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [23:14:00] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [23:14:00] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [23:14:00] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: at java.lang.reflect.Method.invoke(Method.java:498) [23:14:00] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: at net.minecraftforge.userdev.FMLUserdevDataLaunchProvider.lambda$launchService$0(FMLUserdevDataLaunchProvider.java:51) [23:14:00] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [23:14:00] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: ... 5 more [23:14:00] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:643]: Caused by: java.lang.IllegalArgumentException: Cannot set models for a state that has already been configured: [23:14:00] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:643]: at com.google.common.base.Preconditions.checkArgument(Preconditions.java:191) [23:14:00] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:643]: at net.minecraftforge.client.model.generators.VariantBlockStateBuilder.setModels(VariantBlockStateBuilder.java:146) [23:14:00] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:643]: at net.minecraftforge.client.model.generators.VariantBlockStateBuilder$PartialBlockstate.setModels(VariantBlockStateBuilder.java:249) [23:14:00] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:643]: at net.minecraftforge.client.model.generators.BlockStateProvider.simpleBlock(BlockStateProvider.java:193) [23:14:00] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:643]: at net.minecraftforge.client.model.generators.BlockStateProvider.simpleBlock(BlockStateProvider.java:184) [23:14:00] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:643]: at mightydanp.industrialtech.api.common.datagen.BlockStates.materialHandlerHelper(BlockStates.java:51) [23:14:00] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:643]: at mightydanp.industrialtech.api.common.datagen.BlockStates.registerStatesAndModels(BlockStates.java:36) [23:14:00] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:643]: at net.minecraftforge.client.model.generators.BlockStateProvider.act(BlockStateProvider.java:108) [23:14:00] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:643]: at net.minecraft.data.DataGenerator.run(DataGenerator.java:53) [23:14:00] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:643]: at net.minecraftforge.fml.event.lifecycle.GatherDataEvent$DataGeneratorConfig.lambda$runAll$0(GatherDataEvent.java:111) [23:14:00] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:643]: at cpw.mods.modlauncher.api.LamdbaExceptionUtils.lambda$rethrowConsumer$0(LamdbaExceptionUtils.java:34) [23:14:00] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:643]: at java.util.HashMap$Values.forEach(HashMap.java:980) [23:14:00] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:643]: at net.minecraftforge.fml.event.lifecycle.GatherDataEvent$DataGeneratorConfig.runAll(GatherDataEvent.java:107) [23:14:00] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:643]: at net.minecraftforge.fml.DatagenModLoader.begin(DatagenModLoader.java:51) [23:14:00] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:643]: at net.minecraft.data.Main.main(Main.java:41) [23:14:00] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:643]: ... 11 more Disconnected from the target VM, address: '127.0.0.1:12041', transport: 'socket' Process finished with exit code 1 Edited October 7, 20204 yr by Mightydanp
October 7, 20204 yr Author On 10/5/2020 at 9:00 PM, Mightydanp said: i have these for the block model https://github.com/mightydanp/IndustrialTech/blob/master/src/main/resources/assets/industrialtech/models/block/ore/stone_ore.json https://github.com/mightydanp/IndustrialTech/blob/master/src/main/resources/assets/industrialtech/models/block/ore/state/ore.json as-well as this for the item https://github.com/mightydanp/IndustrialTech/blob/master/src/main/resources/assets/industrialtech/models/item/stone_iron_ore.json this is what my files are sepost to look like
October 7, 20204 yr Uhhh, so you try to set the state for the model after you set the state for the model? You would need to remove any code relating to how you built the previous state parser.
October 7, 20204 yr Author i just figured that out. i got it to generate almost all files correctly it generates a \industrialtech\models\block\ore\andesite_ore.json aswell for some reason that i dont know. What part of my could do i chance to generate a model file for andesite_ore. Also is there not a way to get models/item instead of generating everyting there generate it in models/items/ore? atm i dont know how to classify where the resource location is for a block or item
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.