Jump to content

[1.8] [CLOSED] Get the actual location of the mod's 'assets' folder.


Recommended Posts

Posted

Hello!

I'm kind of new in modding and I would like to know one thing. I'm making a mod for 1.8 and I want to make model creating (you know, writing all those .json files) a bit easier.

I want to make a model maker! I've already made a little preview of it, but there's one thing missing. Get the location of the assets folder, and inside of it, the models/item or models/block folder.

I'm working in the IntellijIDEA IDE and it is possible to do this by creating a separate module in the whole modding project, and set up a custom application launch, where it launches the model maker module before Minecraft runs. Because it's a separate module, it can easily reference the directories in the source folder. But after a good bit of time it is kind of annoying that every time I launch Minecraft the model maker runs, and it's not even needed. I think it is possible to implement all of this into the mod and get the assets folder location while Minecraft is running. Any ideas how to do this?

Posted

Why wouldn't you output to a different folder? Create an output location that you want and access it with an IResourcePack. This will also allow you to 'hotswap' (guessing you'll have to force the ResourceManagers to reload unless you're feeling rather fancy) models in an out with something like a whitelist for the file contents (contained models).

I don't really see the merits of a secondary application launch, either wrap it up inside of a gui in minecraft or create a standalone, as you've mentioned dual launching applications is a PITA

I think its my java of the variables.

Posted

Do you mean you want to read from the existing models, or do you want to write your new model to that location? Also, are you talking about models for entities, or for blocks and items?

 

In 1.8, entity models are defined in Java code (i.e. the classes that extend ModelBase) but blocks are defined in the blockstates JSON files. So I think you'd have to use different approaches for each case.

 

For the entity models, since the model is active code instead of a resource file I think it would be difficult to "parse" directly. Basically your parser would have  to sort through the class file and figure out what it is doing. So for entities I suggest you simply make your own type of resource and copy the information over but in a format that is easier for you to use.

 

For the blockstate and item models, they are already JSON so are fairly easy to parse. However, the vanilla models are going to be in Minecraft JAR, not your mod JAR. There is probably a way to access the vanilla models from your code, but again it might be easier to simply copy all of them over into your mod (you's simply have to cut and paste all the blockstate related asset packages into your project.

 

Reading existing ones is fairly easy, you just can either use standard Java methods for navigating the JAR, or you can use Minecraft helper methods for accessing resources. Parsing JSON files can be done with the GSON library, or you can make your own text-based format with your own parser.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

  • 2 weeks later...
Posted

Sorry for the VERRRRY late response, and I'd like to thank both of you for the information.

After re-thinking the whole thing again and I think I'll go with the one that jabelar said. Now, I figured out that making this is VERRRRY complicated or it is not even possible. I don't really want to make that whole IResource thingy, but it is a good information... thanks RANKSHANK!

 

And, again thanks for both of you it really helped finding the solution: Copy + paste!  ;D

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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