Tutorial-Mod icon indicating copy to clipboard operation
Tutorial-Mod copied to clipboard

IllegalStateException: Model at tutorial:block/silver_block does not exist

Open cedral opened this issue 4 years ago • 12 comments

I was getting the above error while trying to follow this tutorial. You got the error to and then glossed over how you fixed it. It looked like you actually cut out that part of the video. As a sanity check I decided to clone this repo and deleted the generated/resources folder to verify it generates that. I did RunData and got the same error. help appreciated.

cedral avatar Dec 01 '20 21:12 cedral

I believe that was from the item model provider? That path is the block model. I should have started with the block model generator. Once you generate the block model, the item model will no longer fail.

SilentChaos512 avatar Dec 01 '20 21:12 SilentChaos512

So I've been persistently getting this error when running runData, despite having gone through and finishing the rest of the tutorial, and even directly comparing my code with your code here, the error persists.

Some others in the YouTube comments section were getting similar errors and nobody seemed to be able to get to the bottom of it. My limited understanding leads me to believe that the textures cannot be found, and thus the appropriate JSON files for them cannot be generated. Others in the comments section were having issues with the JSON files for Items not being generated. I can manually copy your JSON files and move them in and it works, there just seems to be some issues with this error and generating the JSON files.

TangledChords avatar Dec 24 '20 04:12 TangledChords

I can't help with no information. I need a log file at the very least, preferably a repo containing your code as well..

SilentChaos512 avatar Dec 24 '20 13:12 SilentChaos512

I get the same error so I tried to copy your code but nothing changed. Here is a part of my log file.

[23:45:07] [main/INFO] [minecraft/DataGenerator]: Starting provider: Item Models: testmod Exception in thread "main" [23:45:07] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1050]: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException [23:45:07] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1050]: at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:39) [23:45:07] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1050]: at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) [23:45:07] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1050]: at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) [23:45:07] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1050]: at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) [23:45:07] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1050]: at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) [23:45:07] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1050]: at net.minecraftforge.userdev.LaunchTesting.main(LaunchTesting.java:105) [23:45:07] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1059]: Caused by: java.lang.reflect.InvocationTargetException [23:45:07] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1059]: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [23:45:07] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1059]: at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) [23:45:07] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1059]: at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [23:45:07] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1059]: at java.base/java.lang.reflect.Method.invoke(Method.java:566) [23:45:07] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1059]: at net.minecraftforge.userdev.FMLUserdevDataLaunchProvider.lambda$launchService$0(FMLUserdevDataLaunchProvider.java:51) [23:45:07] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1059]: at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) [23:45:07] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1059]: ... 5 more [23:45:07] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:648]: Caused by: java.lang.IllegalStateException: Model at testmod:block/silver_block does not exist [23:45:07] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:648]: at com.google.common.base.Preconditions.checkState(Preconditions.java:518) [23:45:07] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:648]: at net.minecraftforge.client.model.generators.ModelFile.assertExistence(ModelFile.java:48) [23:45:07] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:648]: at net.minecraftforge.client.model.generators.ModelProvider.getExistingFile(ModelProvider.java:398) [23:45:07] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:648]: at net.minecraftforge.client.model.generators.ModelProvider.withExistingParent(ModelProvider.java:148) [23:45:07] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:648]: at LolXpro.testmod.data.client.ModItemModelProvider.registerModels(ModItemModelProvider.java:17) [23:45:07] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:648]: at net.minecraftforge.client.model.generators.ModelProvider.act(ModelProvider.java:409) [23:45:07] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:648]: at net.minecraft.data.DataGenerator.run(DataGenerator.java:44) [23:45:07] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:648]: at net.minecraftforge.fml.event.lifecycle.GatherDataEvent$DataGeneratorConfig.lambda$runAll$0(GatherDataEvent.java:111) [23:45:07] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:648]: at cpw.mods.modlauncher.api.LamdbaExceptionUtils.lambda$rethrowConsumer$0(LamdbaExceptionUtils.java:34) [23:45:07] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:648]: at java.base/java.util.HashMap$Values.forEach(HashMap.java:976) [23:45:07] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:648]: at net.minecraftforge.fml.event.lifecycle.GatherDataEvent$DataGeneratorConfig.runAll(GatherDataEvent.java:107) [23:45:07] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:648]: at net.minecraftforge.fml.DatagenModLoader.begin(DatagenModLoader.java:61) [23:45:07] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:648]: at net.minecraft.data.Main.main(Main.java:43) [23:45:07] [main/INFO] [STDERR/]: [java.lang.Throwable:printStackTrace:648]: ... 11 more

I use Eclipse, hope the log is not different to IntelliJ

LolXpro avatar Dec 26 '20 23:12 LolXpro

@LolXpro Looks like the same issue. You aren't generating the block model. The item model relies on it, so you have to do those first. I know I initially got the order wrong in the video, but I know I corrected myself.

SilentChaos512 avatar Dec 27 '20 00:12 SilentChaos512

I generated the block model files but for any reason they can't be found gen.addProvider(new ModBlockStateProvider(gen, existingFileHelper)); gen.addProvider(new ModItemModelProvider(gen, existingFileHelper)); image

I tried without the blocks but can't get any texture for the ingot either

LolXpro avatar Dec 27 '20 01:12 LolXpro

Do you have these lines in your build.gradle? The 'tutorial' part should match the mod ID.

https://github.com/SilentChaos512/Tutorial-Mod/blob/1.16.x/build.gradle#L78-L81

https://github.com/SilentChaos512/Tutorial-Mod/blob/1.16.x/build.gradle#L92-L94

SilentChaos512 avatar Dec 27 '20 02:12 SilentChaos512

My build.gradle is like this, but it doesn't work either. I tried coping the generated/assets into the main/assets and got no error but no texture either. Then i copied the generated/assets into the bin/main/assets and the blocks and items have textures, only the block items have no texture.

LolXpro avatar Dec 27 '20 13:12 LolXpro

After completely rewriting in IntelliJ I managed to get it to work which leads me to believe I had simply made an error I was unable to find, thank you for your help.

TangledChords avatar Dec 29 '20 21:12 TangledChords

I also have this issue.

KP2048 avatar Jan 05 '21 14:01 KP2048

nvm

KP2048 avatar Jan 05 '21 14:01 KP2048

anyone having this issue reload your gradle project

KP2048 avatar Jan 05 '21 14:01 KP2048