Totem Defender is a fantastic mod for protecting your structures. You craft them from Totem Wood from Totem Trees. Once you’re ready to craft, they come in four tiers and are vastly upgradable adding projectiles, fire and poison defenses, and the ability to filter certain mobs and enemies.
The tiers range from wood to iron to gold and to diamond. Each successive tier requires the previous one to be crafted first. Once you place them you can start upgrading their abilities. Choose a mode, either Projectile or AoE. Projectile fires and AoE attacks only at close range. Add what mobs you want filtered. And then the type of defenses you’d like. Each tier unlocks more spaces to upgrade. Wood starts at one space and diamond unlocks all four.
Filtering is pretty straightforward. Tell your totem what to enemy to filter and it will track only that mob. Obviously with 4 slots available you can have your diamond totem track 4 mobs simultaneously. And as soon as that mob gets close enough it will start to attack it.