Jump to content

Need help with rendering .obj models 1.11


Triphion

Recommended Posts

I'm pretty new to modding, have no real knowledge of java so im not trying to do anything super advanced here, just a simple one block obj model that i've done. So here's the problem. I have for a few days been trying and searching all over the internet for support on how to render .obj models into my mod in minecraft. I've tried alot of things according to what people have been suggesting but all i get is either purple, black chess-like block or an invisible one with text on it. I have checked the destinations and such but i just can't get it to work. I register my block(s) in a file i call "modblocks" and my modid and such in a file called "reference". 

 

The code: https://gist.github.com/triphion/d5c39d6ba118e01c17d5c745e634fe88

 

The error: https://gist.github.com/triphion/c613989e139fdbe623213bcce75d6172

Link to comment
Share on other sites

8 minutes ago, Triphion said:

I have already done so in my client proxy preinit.

You don't actually call proxy.preInit.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

6 minutes ago, Triphion said:

What do you mean? I have called objloader.instance.addomain (Reference.modid) in my client proxy class under pre init. Isn't that what i should do?

You only call proxy.registerRenderers, but not proxy.preInit as @Animefan8888 said.

And don't use unlocalized names for model registering, use Block::getRegistryName.

Edited by V0idWa1k3r
Link to comment
Share on other sites

10 minutes ago, Triphion said:

Block getregistryname should be in what class exactly? My block class or my modblock class?

getRegistryName is from IRegistryEntry.Impl which all registry types (Block, Item, etc) extend.

Edited by Animefan8888

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

9 minutes ago, Triphion said:

So in my blockclass then?

In your block object/field/variable call getRegistryName() instead of getUnlocalizedName()

as you do right here

Quote

new ResourceLocation(Reference.MODID, block.getUnlocalizedName().substring(5))

 

 

11 minutes ago, Triphion said:

Well, do my objmodel call work as it is right now?

You are the one with the code...check.

12 minutes ago, Triphion said:

Or in what class should i call objloader?

You call it in your ClientProxy, it is just you never call the method ClientProxy#preInit

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

[19:52:36] [Client thread/INFO] [FML]: OBJLoader: Domain ancient has been added.

Is this line here proof of the objloader working? I'm sorry, but as i said im really new to this and im trying to learn so please be patient with me. ^^

And also, this is what comes up as error. What could this mean? 

[19:52:51] [Client thread/ERROR] [FML]: Could not load vanilla model parent 'ancient:block/bee_box.obj' for 'net.minecraft.client.renderer.block.model.ModelBlock@613da64b

Exception loading model ancient:block/bee_box.obj with loader INSTANCE, skipping

Edited by Triphion
Link to comment
Share on other sites

4 minutes ago, Triphion said:

[19:52:36] [Client thread/INFO] [FML]: OBJLoader: Domain ancient has been added.

Is this line here proof of the objloader working? I'm sorry, but as i said im really new to this and im trying to learn so please be patient with me. ^^

Where do you call proxy.preInit

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Just now, Triphion said:

Okey, so withing proxy.preinit i should call objloader? Right? But in what class should i call proxy.preinit? In the Client proxy? Sorry if im being a complete imbecile here but im really trying lol. 

Look at where you call proxy.init

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Just now, Triphion said:

And you call it in the init method, so you should call proxy.preInit in your ancientmod class's preInit method.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

So this should make the objloader work now?     

@EventHandler
    public void preInit(FMLPreInitializationEvent event) {
        ModBlocks.init();
        ModItems.init();
        ModTools.init();
        ModArmour.init();
        ModDevItems.init();
        ModSpecialItems.init();
        DevModArmour.init();
        ModBlocks.register();
        ModItems.register();
        ModTools.register();
        ModArmour.register();
        ModDevItems.register();
        ModSpecialItems.register();
        DevModArmour.register();
        
        proxy.preInit();
        OBJLoader.INSTANCE.addDomain(Reference.MODID.toLowerCase());
        
        proxy.registerRenders();
        
        AchievementHandler.registerAchievements();
    }

Link to comment
Share on other sites

4 minutes ago, Triphion said:

So this should make the objloader work now?     

OBJLoader.INSTANCE.addDomain(Reference.MODID.toLowerCase()); is already called in your proxy.preInit class.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

Okey, so i found an error here, but i have no idea what im supposed to change to get rid of it since it looks like my objloader is executed. 

Caused by: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Error loading model previously: ancient:models/block/bee_box.obj
    at net.minecraftforge.client.model.obj.OBJLoader.loadModel(OBJLoader.java:103) ~[OBJLoader.class:?]
    at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]
    ... 23 more
Caused by: java.io.FileNotFoundException: ancient:models/block/beeboxers.mtl

Link to comment
Share on other sites

Your OBJ model needs to have an MTL file associated with it.

Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to comment
Share on other sites

17 minutes ago, Triphion said:

I have an .mtl and an .obj file located in the same directory. models\block. I'm setting up a repository right now so you can navigate through it quickly and maybe tell me exactly where i went wrong. 

What went wrong was it is looking for  beeboxers.mtl not bee_box.mtl

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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