How to affect Tamed Mobs

Started by DestrudoFates on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to affect Tamed Mobs

I've just started messing with MCreator for my mod and was wondering how to make it so items in the players inventory (specifically a GUI inventory) affect a tamed mobs attributes/stats such as health, damage and even movement speed.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It's difficult (that is,…
Sun, 10/08/2023 - 19:24

It's difficult (that is, nearly impossible), to modify the base attributes of an entity without lots of annoying procedures and messing with velocity code. ...However, if you just want to change these sorts of attributes, you could use invisible status effects instead.

For your item's 'when in inventory' trigger, you could make an entity iterator that checks all the entities in your desired radius around the player. If it finds they're tamed by the player, (the event/target entity), you could give them a couple seconds of the desired effect, making sure to turn 'particles' to false. (Unless you want potion particles to be visible.) You can effectively use various levels of absorption to increase max health, strength to increase damage, and speed to increase movement speed.