Jump to content

Recommended Posts

Posted

I'm attempting to make a mod that essentially lets you add blocks and items to the game via JSON (yes, I know some already exist, but 1. this is mostly just to see if I can and 2. they all have some drawback or another). What I'm wondering is, is it possible to change the location that Minecraft looks for block and item models at? For example, would it be possible to add my own directory as an additional directory to search for domains in (i.e. it would search for assets both in assets/<domain> as usual and in my own moddirectory/<domain>)?

 

The one other thought I've had at the moment is to copy the model files into the built-in folder at runtime, but that would really not be ideal if it can be avoided.

Posted (edited)

If your models are located anywhere within the assets folder then it is a matter of a setCustomModelResourceLocation invocation. If they are not - you need to use a custom ICustomModelLoader. 

It may be possible to do with a custom IResource/IResourcePack implementation but I have never done anything like that and can't really help you with it. 

Edited by V0idWa1k3r
Posted

What would really be ideal is to be able to load the assets from a folder within the .minecraft folder, where I'm already loading the blocks themselves from. I'm aiming to make these "block packs" as easy as possible to install, which means that the models and textures need to be in roughly the same location as everything else so they come down to a simple drag and drop install.

Posted

As far as I can tell from my tests you will need to register a IStateMapper implementation for your blocks(ModelLoader::setCustomStateMapper) and a ICustomModelLoader implementation. How you do that is up to you, really. I'm afraid there are not many examples out there with making them work with assets that are not included in resource packs but you could theoretically do it. The problem comes with custom textures though... I am starting to feel that implementing your own IResourcePack would be easier. I was able to find some information on how that could be done but it may be different in more modern versions of the game. You could look at how forge handles mod resourcepacks at FMLClientHandler::addModAsResource. It seems that there are 2 fields that hold resourcepacks for mods - resourcePackList and resourcePackMap. In theory you could 'inject' your resourcepack implementation in them using reflection but I am not sure that the game will not proceed to "bite the dust" afterwards.

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.