Jump to content

(Solved) [ 1.7.2 ] External Resource Loading Issue


Recommended Posts

Posted

    Hello, I do not normally post on the forums because almost every question I have to ask is pretty much already answered, but I am having a rather frustrating issue with the way textures are being loaded by my mod. I currently am developing alongside a graphic designer a mod which is distributed via a custom launcher to players when we release an update.  Currently we have to include the textures and language assets directly in the released jar file for them to load properly in a production build (this is the norm).

 

    The reason this is a problem is because I want to be able to only send updated assets to clients instead of the entire package (which could soon exceed 40+ MB by itself).  With the current system I have to send the entire packaged jar to every player every time we release an update.  This is very inefficient and a total waste of good bandwidth since the mod code itself is only around 200KB.

 

    My first idea was to simply move the assets into the "mods" directory and preceed the ResourceLocation constructor's resource path (not resource domain) with the correct parent directory chain (../).  However, having a ResourceLocation(ASSET_ROOT, "../../../textures/blah/blah/blah.png") to get outside of the jar file does not work.

 

    My next idea is to have our custom launcher dynamically rebuild the downloaded mod.jar file with the proper assets that are on our servers.  This, however, is a major pain in the butt and I really do not want to have to implement such a complex solution for something that should be very simple.

   

TL;DR

    I need a way to access textures, sounds and other resources outside of the distributed mod.jar file so that they can be dynamically updated by a custom client without having to re-download the entire jar.

 

    Does anyone have any solutions to this?  If you need any more information let me know, but I feel like I am overlooking something very simple in order to get these textures loaded properly.  Thank you for the long read, I know it was not the most interesting.

 

Edit: Now that I think about it some more, I wouldn't mind using a custom resource pack, but I don't know how to access it from within my mod.  I will do some research on that.

Posted

Brilliant, thank you!  It works perfectly and I can now access all of the files through a custom IResourcePack instance (maybe even files on the web).  I just have one question.  Currently I load my implementation through the following call

 

((SimpleReloadableResourceManager)Minecraft.getMinecraft().getResourceManager()).reloadResourcePack(IResourcePack)

 

Is this the correct way of doing it.  It works perfectly, but I just want to make sure I am following the correct methods.  And once again, thank you so much for that hint.

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.