tModLoader
420 人が評価
Syla's Resource Pack Library
   
アワード
お気に入り
お気に入り
お気に入りから削除
Mod Features: Utilities, Library
Mod Side: Client
tModLoader Version: 1.4.4
ファイルサイズ
投稿日
22.227 KB
2024年6月17日 2時46分
1 項目の変更履歴 ( 表示 )

サブスクライブしてダウンロード
Syla's Resource Pack Library

解説
Allows for the replacement of textures from Asset<T> and Texture2D objects with resource packs.

How to make a resource pack for a mod that supports this:
1. Instead of a Content folder, use a ModContent folder.
2. Inside of this folder, follow the mod's folder layout.
3. Put your replacement textures in the same place in your resource pack.

Ex: replacing "S_Panel_Middle.png" in my Summoner UI mod.
The file path for the file in the mod is: SummonsUI/UI/S_Panel_Middle.png
Put your file at: YourResourcePackNameHere/ModContent/SummonsUI/UI/S_Panel_Middle.png



How to make your mod support this:
1. Add "modReferences = SylaResourcePackLib@#.#" without the quotation marks, and the #'s being this mod's version number to your build.txt file (if you already have modReferences, add ", SylaResourcePackLib@#.#" instead, still without quotation marks and with replacing the #'s).
2. In your mod, add a new class that inherits from the ResourceLoader abstract class. Name it something you will remember, like "YourModNameHereRL".
3. Add "using SylaResourcePackLib;" and "using SylaResourcePackLib.ResourceTypes;" to the top of the new class's file.
4. Add public static assets, and make them either ModifiableAsset<T> (where T is the type you usually use in Asset<T>) or ModifiableTexture2D. For example: "public static ModifiableAsset<Texture2D> UIFFill;"
5. Add public override void methods for InitializeResources(), ReloadResources(), PostSetupContentResources(), and Unload() to the new class.
6. In InitializeResources(), initialize each asset. You can find the constructors by extracting the mod (source code is included). Here's an example from my Summoner UI mod: "UIFFill = new ModifiableAsset<Texture2D>("SummonsUI/UI/Summon_Fill", mode: AssetRequestMode.ImmediateLoad);"
7. In PostSetupContentResources(), replace assets handled by TextureAssets as follows: "TextureAssets.Item[ModContent.ItemType<Items.YourItem>()] = YourItemAsset.asset;"
8. In ReloadResources(), run the Reload() method on each asset. For example: "UIFFill.Reload();"
9. Also in ReloadResources(), if the asset is for an asset handled by TextureAssets, put this on the next line: "TextureAssets.Item[ModContent.ItemType<Items.YourItem>()] = YourItemAsset.asset;"
10. In Unload(), set each asset to null.
11. In your Mod class in Load(), add "new YourModNameHereRL();"
12. Whenever you need to access your modifiable assets, instead of using the object name (ex: "UIFFill"), you need to use "YourModNameHereRL.UIFBack.asset" (if you're using something other than ModifiableAsset<T>, it won't be ".asset". It will instead be the same type as you were using before, ex: ".texture2D").

Future plans for this:
- Add the ability to allow modders to read .json files from resource packs.
- Figure out how to test when the resource pack menu is closed so that everything can be reloaded then instead of on world/mod load.
tModLoader の投稿を引用:
Developed By Tetriscat66 (Syla)
27 件のコメント
Potat369 7月4日 15時22分 
Source code?
Lion8cake 6月26日 0時11分 
Is it possible to weak reference this mod? I'd like to implement support for this but I don't necessarily want my mods relying on it at all times
TheWalterHubb11 3月25日 19時26分 
when we getting support for this
Tetriscat66  [作成者] 3月22日 19時52分 
I'm not sure if there's a good way to search for other mods that use this (if someone knows of a way please correct me it'll be very helpful to know). The ones I made that work with it are Summoner UI and Encumbering Stone Whitelist. If I find any other mods that other people made that use this and if I remember to I'll add the names of them here.
beau099 3月22日 9時29分 
What are mods need this mod to function?
ENDGAME 3月10日 21時24分 
░███████ ]▄▄▄▄▄▄▄▄ - - - FIGHT AGAINST BOB AND DOGE AND SAVE STEAM!
▂▄▅████████▅▄▃▂ COPY AND PASTE TANK TO JOIN WAR!
I███████████████████]
◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤
Deigo Monsarino 3月9日 5時33分 
░░░░▐▀█▀▌░░░░▀█▄░░░
░░░░░▐█▄█▌░░░░░░▀█▄░░
░░░░░░▀▄▀░░░▄▄▄▄▄▀▀░░
░░░░▄▄▄██▀▀▀▀░░░░░░░
░░░█▀▄▄▄█░▀▀░░
░░░▌░▄▄▄▐▌▀▀▀░░ THIS IS BOB
▄░▐░░░▄▄░█░▀▀ ░░
▀█▌░░░▄░▀█▀░▀ ░░ COPY AND PASTE HIM,
░░░░░░░▄▄▐▌▄▄░░░ SO HE CAN TAKE
░░░░░░░▀███▀█░▄░░ OVER THE
░░░░░░▐▌▀▄▀▄▀▐▄░░ WORKSHOP
░░░░░░▐▀░░░░░░▐▌░░
░░░░░░█░░░░░░░░█░░░
░░░░░▐▌░░░░░░░░░█░░
Potato Destruction 1月25日 14時15分 
░███████ ]▄▄▄▄▄▄▄▄ - - - FIGHT AGAINST BOB AND DOGE AND SAVE STEAM!
▂▄▅████████▅▄▃▂ COPY AND PASTE TANK TO JOIN WAR!
I███████████████████]
◥⊙▲⊙▲⊙▲⊙▲⊙▲⊙▲⊙◤
3footall 2024年12月12日 10時09分 
░░░░▐▀█▀▌░░░░▀█▄░░░
░░░░░▐█▄█▌░░░░░░▀█▄░░
░░░░░░▀▄▀░░░▄▄▄▄▄▀▀░░
░░░░▄▄▄██▀▀▀▀░░░░░░░
░░░█▀▄▄▄█░▀▀░░
░░░▌░▄▄▄▐▌▀▀▀░░ THIS IS BOB
▄░▐░░░▄▄░█░▀▀ ░░
▀█▌░░░▄░▀█▀░▀ ░░ COPY AND PASTE HIM,
░░░░░░░▄▄▐▌▄▄░░░ SO HE CAN TAKE
░░░░░░░▀███▀█░▄░░ OVER THE
░░░░░░▐▌▀▄▀▄▀▐▄░░ WORKSHOP
░░░░░░▐▀░░░░░░▐▌░░
░░░░░░█░░░░░░░░█░░░
░░░░░▐▌░░░░░░░░░█░░
3footall 2024年12月12日 10時09分 
░░░░▐▀█▀▌░░░░▀█▄░░░
░░░░░▐█▄█▌░░░░░░▀█▄░░
░░░░░░▀▄▀░░░▄▄▄▄▄▀▀░░
░░░░▄▄▄██▀▀▀▀░░░░░░░
░░░█▀▄▄▄█░▀▀░░
░░░▌░▄▄▄▐▌▀▀▀░░ THIS IS BOB
▄░▐░░░▄▄░█░▀▀ ░░
▀█▌░░░▄░▀█▀░▀ ░░ COPY AND PASTE HIM,
░░░░░░░▄▄▐▌▄▄░░░ SO HE CAN TAKE
░░░░░░░▀███▀█░▄░░ OVER THE
░░░░░░▐▌▀▄▀▄▀▐▄░░ WORKSHOP
░░░░░░▐▀░░░░░░▐▌░░
░░░░░░█░░░░░░░░█░░░
░░░░░▐▌░░░░░░░░░█░░