tModLoader imkSushi's Data Packs Mod - Change item names and textures! Compatible with other mods!

imkSushi

Eater of Worlds
This mod lets you change the names and textures of other items!

I will be making it much easier to put old texture packs into this on Monday. So if you've got a vanilla texture pack, don't start changing over all the item names.

Examples at https://github.com/imkSushi/ExampleNameAndTexturePack

To start, have an empty mod skeleton, from here: http://javid.ddns.net/tModLoader/generator/ModSkeletonGenerator.html, and place the folder inside the zip file in your mod sources file (see the tModLoader thread for more details). Then, delete the Items folder.

Next, open the build.txt file.
Add the following line to it:
Code:
modReferences = imkSushisDataPacksMod

in build.txt, add:
Code:
weakreferences = 'modname1', 'modname2', 'modname3', ...

Next, in the 'insertModNameHere'.cs file (stay in this file until I specifically say to leave it), place the following underneath 'using Terraria.ModLoader;':
Code:
using System;
using System.IO;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using 'insertModNameHere';
using imkSushisDataPacksMod;
Note, there are extra, just to be safe.

Next, place a PostSetupContent() method inside the 'insertModNameHere' class, but not in the method in it. Your file should now look like this:
Code:
using System;
using System.IO;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Terraria;
using Terraria.ModLoader;
using Terraria.ID;
using imkSushisDataPacksMod;
using imkSushisNamePack;

namespace 'insertModNameHere'
{
    class 'insertModNameHere' : Mod
    {
        public 'insertModNameHere'()
        {
            Properties = new ModProperties()
            {
                Autoload = true,
                AutoloadGores = true,
                AutoloadSounds = true
            };
        }

        public override void PostSetupContent()
        {

        }
    }
}

Inside PostSetupContent(), write:
Code:
imkSushisDataPacksMod.imkSushisDataPacksMod.ChangeItemName(ItemID.'itemName', "'name you want to change it to'");
Note that the 'name you want to change it to' is a normal display name (i.e. with spaces), and it is surrounded with "s on either side.

To find item names, look here for the relevant short string:
https://github.com/blushiemagic/tModLoader/wiki/Vanilla-Item-IDs
e.g. the Gold ore has an itemName of 'GoldOre'

Do this for each item you wish to change the name of.

Inside PostSetupContent(), write:
Code:
            if (ModLoader.GetLoadedMods().Contains("'modName'"))
            {
                imkSushisDataPacksMod.imkSushisDataPacksMod.ChangeItemName(ModLoader.GetMod("'modName'").ItemType("'itemName'"), "'name you want to change it to'");
            }
Note that the 'name you want to change it to' is a normal display name (i.e. with spaces), and it is surrounded with "s on either side.
Also, note that the 'modName' is not a normal display name, but is still surrounded with "s on either side.

Do this for each item you wish to change the name of.

Remember, that any mod you change a name of, must be mentioned in the weakreferences in the build.txt (see above)

Inside PostSetupContent(), write:
Code:
            imkSushisDataPacksMod.imkSushisDataPacksMod.ChangeItemTexture(ItemID.'itemName', ModLoader.GetTexture("'insertModNameHere'/'itemName'"));

Inside your mod folder, place a sprite 'itemName'.png (itemName being the relevant item). Make sure that this sprite has the same dimensions as the normal sprite.

To find item names, look here for the relevant short string:
https://github.com/blushiemagic/tModLoader/wiki/Vanilla-Item-IDs
e.g. the Gold ore has an itemName of 'GoldOre'

Do this for each item you wish to change the texture of.

Inside PostSetupContent(), write:
Code:
            if (ModLoader.GetLoadedMods().Contains("'modName'"))
            {
            imkSushisDataPacksMod.imkSushisDataPacksMod.ChangeItemTexture(ModLoader.GetMod("'modName'").ItemType("'itemName'"), ModLoader.GetTexture("'insertModNameHere'/'itemName"));
            }
Inside your mod folder, place a sprite 'itemName'.png (itemName being the relevant item). Make sure that this sprite has the same dimensions as the normal sprite.

Also, note that the 'modName' and 'itemName is not a normal display name, but is still surrounded with "s on either side.

Do this for each item you wish to change the texture of.

Remember, that any mod you change a texture of, must be mentioned in the weakreferences in the build.txt (see above)

And I think that is all. Then save and close the 'insertModNameHere'.cs file, update the version number and the authors in the build.txt file, write something appropriate in the description.txt file, and then press build and reload for your mod in tModLoader, with this mod enabled as well. If all goes well, you can now publish your data pack to the mod browser!
 
Last edited:
Also, I would appreciate if a moderator or admin posted a redirect to this in the texture packs forum
 
  • Like
Reactions: 000
Update 1.0.1 is out!
Fixed a bug where textures would load in alphabetical order, even if the texture pack was weakreferencing a mod later in the alphabet. zzz's not required anymore

Also updated examples to reflect this.
 
I will be making it much easier to put old texture packs into this tonight. So if you've got a vanilla texture pack, don't start changing over all the item names.

Also, could anyone who has a texture pack give me permission to turn it into a mod?
 
I haven't had time to finish the code, so I'll put in old texture pack support nex week, preferably on Monday, as I'm going up North over a long weekend.
 
This doesn't seem to work for me. It says that the name 'imkSushisDataPacksMod' does not exist in the current context. Even though I putted it in Build.txt and at top of the ModName.cs File. It even says about the reference that it could not be found. I'm definitely forgetting a using directive or an assembly reference, but I don't find any errors.
 
Back
Top Bottom