TheGreyGhost / MinecraftByExample

Working sample code for the basic concepts in Minecraft and Forge.
Other
1.24k stars 187 forks source link

MBE05 not working in Forge 2759 (Model not loading/blockstate not found) #49

Closed Fureniku closed 5 years ago

Fureniku commented 5 years ago

Seems like MBE05 isn't working properly in Forge 2759 (and I assume later versions too).

At first I thought I was going mad and doing something wrong, after a day or so of debugging I eventually cloned MBE and had the exact same issue on there too.

Logs:

[02:55:46] [main/ERROR] [FML]: Exception loading model for variant minecraftbyexample:mbe05_block_3d_web_statemapper_name#normal for blockstate "minecraftbyexample:mbe05_block_3d_web_registry_name"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model minecraftbyexample:mbe05_block_3d_web_statemapper_name#normal with loader VariantLoader.INSTANCE, skipping
    at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:161) ~[ModelLoaderRegistry.class:?]
    at net.minecraftforge.client.model.ModelLoader.registerVariant(ModelLoader.java:235) ~[ModelLoader.class:?]
    at net.minecraft.client.renderer.block.model.ModelBakery.loadBlock(ModelBakery.java:153) ~[ModelBakery.class:?]
    at net.minecraftforge.client.model.ModelLoader.loadBlocks(ModelLoader.java:223) ~[ModelLoader.class:?]
    at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:150) ~[ModelLoader.class:?]
    at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]
    at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:121) [SimpleReloadableResourceManager.class:?]
    at net.minecraft.client.Minecraft.init(Minecraft.java:559) [Minecraft.class:?]
    at net.minecraft.client.Minecraft.run(Minecraft.java:421) [Minecraft.class:?]
    at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
    at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]
    at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_161]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_161]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_161]
    at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]
    at GradleStart.main(GradleStart.java:25) [start/:?]
Caused by: java.lang.NullPointerException: Model minecraftbyexample:block/smartmodel/webmodel returned null as default state
    at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:864) ~[guava-21.0.jar:?]
    at net.minecraftforge.client.model.ModelLoader$WeightedRandomModel.<init>(ModelLoader.java:673) ~[ModelLoader$WeightedRandomModel.class:?]
    at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1176) ~[ModelLoader$VariantLoader.class:?]
    at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:157) ~[ModelLoaderRegistry.class:?]
    ... 21 more

image

As a sanity check I also installed Forge 2491, which this guide was made with - it all works absolutely fine in there. Looking through the Forge changelog this looks like a likely culprit, but I'll test further tomorrow:

Build 1.12.2-14.23.3.2695:
    bs2609:
        Change composite models to fetch quads from submodels using full context
        (#4809)

Hopefully you can get it updated, but someone could at least tell me what needs to be changed it'd be very useful!

Thanks

TheGreyGhost commented 5 years ago

Howdy Unfortunately I don't have so much time these days; I'll try to have a look in the next few days but can't promise anything. You might get a faster reply if you ask in the forge forum... although it sounds like you've almost tracked the problem down yourself already!

Thanks for letting me know about the problem

Cheers TGG

TheGreyGhost commented 5 years ago

It turned out to be a pretty simple fix

WebModel: // Our custom loader doesn't need a default state // BUGFIX: but if we return null Forge gets upset // BUGFIX: The interface now provides a sensible default so just use that. Comment out previous: / @Override public IModelState getDefaultState() { return null; } /