I'm having trouble understanding how to add assets to the game. Using the tutorial snippet as an example... Code: public class ModEntry : Mod, IAssetLoader { /// <summary>Get whether this instance can load the initial version of the given asset.</summary> /// <param name="asset">Basic metadata about the asset being loaded.</param> public bool CanLoad<T>(IAssetInfo asset) { } /// <summary>Load a matched asset.</summary> /// <param name="asset">Basic metadata about the asset being loaded.</param> public T Load<T>(IAssetInfo asset) { return (T)(object)new Dictionary<string, string> // (T)(object) converts a known type to the generic 'T' placeholder { ["Introduction"] = "Hi there! My name is Jonathan." }; } } The main confusion I have is with what I open. should "AssetNameEquals" point to the vanilla xnb files that contain the fruit tree information or do I create my own files with the folder structure MODNAME/Content/Data/NAMEOFITEM in my mod project directory? kind of like: Code: return asset.AssetNameEquals("Data/NAMEOFITEM") And when adding to the item's stats would I make a new Dictionary for each stat (HP, Energy, sell price, etc.)?
@RaineDash CanLoad is called when the game requests an asset from its content folder, and asset.AssetNameEquals("Data/NAMEOFITEM") returns true if that asset is Content/Data/NAMEOFITEM. So you'd specify the original asset you want to replace. That said, IAssetLoader lets you replace the entire file; if you want to add another item to the existing data, you should use IAssetEditor instead. I'm not sure which tutorial you're using, but here's the official docs for the content API. Feel free to ask if anything is unclear!
Another thing, I've been looking through some mods to try and find where the assets get stored. I've found the sprite images, but what kind of file do the dictionary entries get exported to (and what format should they be put in? And what's the object ID limit? Should I make a JSON with the same name as the AssetNameEquals value, then export it to an xnb file? I looked at the decompressed ObjectInformation, but I'm not sure if I write any additional assets to that format or what.
@RaineDash You can add/edit dictionary entries directly in code. See the Data/Crops example in the docs (especially the second example under the big code block).