You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 18, 2021. It is now read-only.
Mark Vainomaa edited this page Jan 13, 2020
·
4 revisions
Asset manager
As all mods are loaded to singe classloader, then it means that resources cannot have same name. To "workaround" that issue, an asset manager was created to make things prettier.
Adding assets to own mod
You must add assets to /assets/<your mod id>/ in jar, e.g resources directory in your IDE should look like this:
Then you can access it using injected AssetManager instance.
@InjectprivateOrionorion;
ModInfofooMod = orion.getMod("foo");
AssetManagerfooAssetManager = orion.getAssetManager().forMod(fooMod);
InputStreamconfigStream;
if ((configStream = fooAssetManager.getAsset("config.cfg")) == null) {
thrownewIllegalStateException("Could not get asset 'config.cfg' from mod 'foo'!");
}