mob using items

Started by Baryorex on

Topic category: Help with Minecraft modding (Java Edition)

Joined Feb 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
mob using items
Fri, 04/11/2025 - 00:55 (edited)

how to make a mob (in my case a velociraptor) be able to throw things from the player's hands and use them in battle (like a fox, if you give it a sword it will use it) and i want he will use only vannila items or from my mod

Edited by Baryorex on Fri, 04/11/2025 - 00:55
Joined Feb 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
The theory behind making…
Fri, 04/11/2025 - 07:39

The theory behind making this work, is to give the mob an inventory and a gui with slots for the weapons or armor. Unless you know how to code, you would need to make a model of the mob holding the item for each one of the ones you want to use, and create an entity for each one of them as well. 

So, when you put the item in the slot, you replace the mob with the model without the item for one that has the item, and stats that reflect that they have that item (a sword increase attack, a helmet increases defense, etc.) Remember to make the new mob inherit the inventory, health, and who they are tamed by to the new one. 

As I said, I'm also trying to make something like that, so I still don't have all the details, but I hope this helps.