Jump to content

Recommended Posts

Posted

Hi,

 

I am a newbie here, this is my first post, So please please be patient, give me some time to come into the mod writing. :) I am just started meeting with the Minecraft modding, but I hope, I will understand all the important functions/methods at the near future!

 

I have created a 'mod' with the MDK for Forge 1.11.2, and that little 'mod' adds custom cauldron block to the game. At the Eclipse side, the code looks good, however in game, I Cannot give myself the block... So somehow it Cannot be renderred. And I don't see where is the problem exactly...  I pushed the code to Github, here is the link for the repository.

 

Any help is welcome!

 

Many thanks!

Posted

Thanks for Your quick reply!

14 minutes ago, diesieben07 said:
  • Do not use the ItemModelMesher to register your models, use ModelLoader.setCustomModelResourceLocation in preInit from your client proxy.
  • You never register an ItemBlock for your block, as such it can not exist in item form, i.e. in an inventory or as a dropped item. I suggest you read the documentation page on blocks.

I replaced the ItemModelMesher to the ModelManager, as You suggested. Thanks! Is that okay now (link)?

 

How exactly should this be done? :D

Posted (edited)

ModelLoader has to be called in either preInit, after you register your block (as diesieben said in his post), OR in the ModelRegistryEvent (but only if you are using the RegistryEvent to register your block)

Edited by Matryoshika

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Posted
6 hours ago, diniboy said:

I am just started meeting with the Minecraft modding

There are many Forge mods at CurseForge, and many of them link to their source code at github. You can learn much from just walking through others' source code, especially if you can find a mod doing something like what you want to do.

  • Like 1

The debugger is a powerful and necessary tool in any IDE, so learn how to use it. You'll be able to tell us more and get better help here if you investigate your runtime problems in the debugger before posting.

Posted

Well, I have done a lot of testing, but the block didn't appeared... :( I didn't pushed that tries to the Github, it was just done on my local repository, but as I haven't reached any result up to now, I think these steps are unnecessary.

 

If it isn't a big request, Can anybody help with some exact code parts, that must be changed? Many thanks!

 

Other: Is there any Javadoc somewhere for the Forge API?

 

BTW an example mod, with one custom block, one custom item, one tile entity, and so on, the basics might be very helpful for the beginners I think.

Posted

Okay, now I Can render an item (and a block too, but with a bit different way)! :) But just with the old ItemModelMesher method:

 

    public void registerItemRenderer(ItemBase item, int meta, String id) {
        Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(item, meta, new ModelResourceLocation(TestMod.MODID + ":" + id, "inventory"));
        
    }

 

The ModelLoader gives me an untextured object:

 

    public void registerItemRenderer(ItemBase item, int meta, String id) {
        ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(TestMod.MODID + ":" + id, "inventory"));
    }

 

BTW I've followed the linked shadowfacts tutorial.

 

Thanks!

Posted

That doesn't answer the question, when is it called? 

  • Like 1

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted

From the main class, I call my block and item initializator class, and they are call another two classes. And theese executes the ModelLoader at the ClientProxy.

 

Anyways, why I shouldn't use the old method with the IMM? It is working perfectly for items. Just the blocks are buggy.

Posted (edited)

In what events do you call those other classes? It's not about which class the method is in, it's about which stage of mod loading it happens in.

 

Edit: Posting all your up-to-date code would be the easiest solution.

Edited by Jay Avery
  • Like 1

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.