tModLoader GlowMaskAPI - A library to help you easily add a glowMask to your items

Thought I'd let you know, but for some reason your mod takes out the color of the slimes.

EDIT: Oh, Lithium beat me to the punch.
 
Thought I'd let you know, but for some reason your mod takes out the color of the slimes.

EDIT: Oh, Lithium beat me to the punch.
That reminds me- did you check to ensure it was GlowMaskAPI causing the colorless slimes? I'd have checked myself, but my Terraria is currently occupied with the upload, and I'm extremely tired.
And, to Zephaniah- sorry that I ended up removing your mod from mine. It's really neat, but there have been too many issues to use it at the moment, much as I wanted to.
 
The slimes were pretty colorful before I added the Glow Mask API, which was a requirement for Litho's Armory to work after its update. It was the only recent addition as I actually disabled some other mods to ease on my PC a few days prior.

Knowing your mod, Lithium, I'm 100% sure that it had nothing to do with the colorless slimes.
 
Actually, it does in fact seem like my mod is causing the colorless slimes... I might have a hunch as to why.
Edit: Yep. Had to do with the color changing function some new debuffs had, which was removed to fix this. The updated version is on the forum download, and currently uploading to the browser. I think I'll still wait on using GlowMaskAPI, though.
 
Last edited:
Hey, I was wondering if this works with armor/general wearable items?
If not, I would like to see that be implemented in the near future.
Side note: I've actually tried this and it only draws the glowmask of the item when dropped, I know it's not gonna be that simple, so if it is supported, how would I go around getting it to work that way?
Thanks.
By the way, you have no idea how happy I am about this mod's existence, it makes glowmasks SOOO much easier!
Seriously, why can't glowmasks be this easy normally?
 
Ah, apparently this doesn't work very well in multiplayer, perhaps it might have been because it is loading textures manually, would you be willing to look into that?
 
Has there been any progress on fixing the multiplayer bug with this. I've been desperately looking for glowmask tutorials and methods and this is the only one thats worked
 
I updated GlowMaskAPI. v1.6 should work on servers now. Just make sure you update your code. In my example there should be one more line of code that you will need.
Code:
if (Main.netMode != NetmodeID.Server)
EDIT: I also looked into the issue of GlowMaskAPI causing slimes losing their color. I can't seem to recreate the issue. Maybe TML 0.11 fixed it? No idea...
 
I just wanted to stop by and say thank you for this tutorial and API file. I've been wanting to do something like this with my own armor and weapons for awhile now, and this is exactly what I was looking for! Awesome stuff, indeed.

Thank you!
 
EDIT: I need to learn to read ;-)



Let us know when you get this working for armor pieces! There's a few sets that I've made that I'd love to turn into glow effect sets :)
 
Last edited:
Does this work with weapons marked as staves yet?
As I recall, the glowmask would not work correctly if applied to items that had this in their SetStaticDefaults class:
Code:
Item.staff[item.type] = true; //this makes the useStyle animate as a staff instead of as a gun
 
I just wanted to know if there was a reason why the current version on the Mod Browser is v1.5. I'm still struggling with the multiplayer bugs.
 
According to this guide, showing how a glowmask is applied to dropped items, it is not easy to add a glowmask to "weapons being held" in the current version of tModLoader. However, this library makes it easy for developers to add a glow mask to their items. Simply add the GlowMaskAPI.dll file to your references. And add modReferences = GlowMaskAPI to your build.txt...

Below is an example of how you would use GlowMaskAPI to add a glow mask to a sword.
Code:
namespace ExampleMod.Items
{
    public class ExampleSword : ModItem
    {

        public static short glowMask;

        public override void SetStaticDefaults()
        {
            DisplayName.SetDefault("Example Sword");
            if (Main.netMode != NetmodeID.Server)
                glowMask=GlowMaskAPI.Tools.instance.AddGlowMask(mod.GetTexture("Items/ExampleSwordGlow"));
        }

        public override void SetDefaults()
        {
            item.damage=20;
            item.melee=true;
            item.width=64;
            item.height=64;
            item.useTime=30;
            item.useAnimation=30;
            item.useStyle=1;
            item.glowMask=glowMask;
        }
    }
}
ExampleSwordGlow.png would be your glowmask.

Note that AddGlowMask is happening inside SetStaticDefaults. We are not doing this in SetDefaults because it runs several times while the game is running. We only need to load the texture once.
Also, regarding the guide I mentioned at the beginning, there is no need to use the PostDrawInWorld hook they suggest to add a glowmask to dropped items. This library will add a glowmask to your item regardless of where it is.

Anyone playing your mod will also need to download and enable GlowMaskAPI from the mod browser.

GlowMaskAPI may be incompatible with other mods that use hacky methods to apply glowmasks.

In the future I would like to improve GlowMaskAPI allowing users to apply a glowmask with only one line of code instead of three.

Latest version: 1.6
Linux: GlowMaskAPI.dll (Works for Mac? Please let me know)
Windows: GlowMaskAPI.dll

Is there a way to add glow masks to certain enemies from my mod?
 
Uhhh.... Help?
1613741124947.png

It's talking about this line:
1613741196859.png

I added the reference in VSCode.
 
Back
Top Bottom