Battle Buddy
ModMIT

Battle Buddy

Battle Buddy creates a loyal companion that follows, fights hostiles, uses gear smartly, and stores your items.

59
Downloads
2
Followers
3 months ago
Updated
📦
2
Versions

📖About Battle Buddy

This mod adds a custom humanoid companion entity called a BattleBuddy that you can spawn and manage with /battlebuddy commands.

The buddy:

Can be created with /battlebuddy create (name)

Belongs to a specific player, (and stores the owner’s UUID)

Follows you around, and (teleports back if it gets far away)

Fights hostile mobs depending on its mode (passive/defender/aggressive)

Can wear armor + hold a shield, and can be given melee + ranged weapons

Can also carry items for you (with a “10 unique item types” limit)

The entity’s behavior
Stats / basics

30 HP, 4 attack damage, 0.35 base move speed, 40 follow range

Marked as persistent (setPersistenceRequired()), so it won’t despawn normally

Immune to fall damage

Explosion knockback is reduced (velocity scaled down)

Combat modes

Mode can be:

PASSIVE: won’t attack Piglins or Endermen at all

DEFENDER (default): only attacks Piglins/Endermen if they’re already “aggro’d” on something

AGGRESSIVE: attacks hostile mobs freely

It also has a “combat focus” timer:

Defender focus lasts ~5 seconds

Aggressive focus lasts ~10 seconds

While focused, it prioritizes threats near the owner and may stop following to fight.

Following you

Tries to stay about 4 blocks behind you

If it’s too far, it pathfinds faster to catch up

If it gets very far (~50 blocks+), it will teleport near you to a “safe-ish” spot

Weapons + ranged logic

It has stored melee and stored ranged weapon slots internally, and it swaps what it holds based on distance:

Close: equips melee

Far: equips ranged

Ranged attacks:

If target is a Blaze → it always throws snowballs

If target is in water → it throws a real trident projectile (“harpoon”)

Otherwise, if it has a bow/crossbow stored and is holding it → it fires arrows

Defensive/survival “smart” behavior

If it has a shield, it has a 90% chance to block mob/arrow-type attacks (and deletes incoming arrows when it blocks)

If it gets negative potion effects for ~3 seconds, it clears them and plays a drinking sound (like “auto-milk”)

Regenerates 1 HP every ~2 seconds if not full

If it’s on fire / in lava, it gives itself Fire Resistance (like auto-drinking a fire res potion)

Has special creeper avoidance: if it can’t one-shot a creeper, it will “poke and retreat” / kite to avoid explosions

Loot/kill credit to the owner

When it damages a mob, it tries to set the mob’s “last hurt by player” to the owner, so the player gets credit (useful for loot/XP rules).

Death behavior

On death it:

Strips the “unbreakable” flag off anything it drops

Drops stored weapons + carried items

On death, Broadcasts a death message to all players (like a player death message)

and gets removed from the owner’s tracked list (freeing the slot)

Player interaction: giving gear/items to the buddy

Right-click your buddy (owner only):

Give armor → it equips it

Give shield → equips offhand

Give melee weapon → stores as its melee weapon

Give bow/crossbow → stores as ranged weapon

Give any other item → stores it in an internal carry map (one stack per item type)

Important constraints:

It enforces a 10 unique item-types total across:

equipped gear

stored melee/ranged weapons

carried item types

Items it equips/stores are made Unbreakable while the buddy has them.

Shift + empty hand on the buddy dumps everything back to you (and removes Unbreakable before returning).

All commands are under /battlebuddy and require permission level 2 (OP).

/battlebuddy create
Spawns a buddy at your position, assigns owner/name, tracks it in your persistent data.

/battlebuddy call
Teleports your loaded buddy near you.

/battlebuddy delete
Deletes the buddy from your tracked list and discards the entity if it’s loaded.

/battlebuddy delete all
Two-step confirmation (type twice within 30 seconds), deletes all tracked buddies.

/battlebuddy list
Lists your buddies and shows stored settings like follow/mode.

/battlebuddy follow <yes|no>
Saves a follow flag + optional “anchor” position in your player persistent data. (not working yet will be future update maybe)

/battlebuddy mode passive|defender|aggressive
Stores the mode, and if the buddy is loaded it applies it immediately.

/battlebuddy save
Saves a full NBT snapshot of the buddy (up to 5 saves total).

/battlebuddy load
Restores the saved snapshot (spawns a new buddy if needed), then teleports it to you.

/battlebuddy clearsave / clearsave all
Deletes saved snapshots.

Also:

Your buddy list + saved states are stored in your player persistent NBT, and copied on death (PlayerEvent.Clone) so it survives respawns.

You can have up to 5 buddies and 5 saved states.