Jump to content

Recommended Posts

Posted

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

Posted (edited)

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?

Edited by Triphion
Posted (edited)
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
Posted (edited)
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.

Posted (edited)

So in my blockclass then? Well, do my objmodel call work as it is right now? Or in what class should i call objloader?

Edited by Triphion
Posted
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.

Posted (edited)

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

Posted

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. 

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

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

Posted

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();
    }

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

Posted

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

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

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.