Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // The content API isn't technically public yet, so this is how you use it.
- // It will be much cleaner once SMAPI 2.0 is released.
- var editors = ((IList<IAssetEditor>)helper.Content.GetType().GetProperty("AssetEditors", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance).GetValue(Helper.Content));
- editors.Add(new ContentInjector());
- public class ContentInjector : IAssetEditor
- {
- public bool CanEdit<T>(IAssetInfo asset)
- {
- if (asset.AssetNameEquals("Data\\ObjectInformation"))
- return true;
- return false;
- }
- public void Edit<T>(IAssetData asset)
- {
- if (asset.AssetNameEquals("Data\\ObjectInformation"))
- {
- var data = asset.AsDictionary<int, string>().Data;
- // your changes here
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment