How do I teach a mob to use a crossbow?

Started by Quintex on

Topic category: Help with Minecraft modding (Java Edition)

Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I teach a mob to use a crossbow?

Okay, how do I make it so that a mob can use a crossbow in mcreator?

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Not totally sure. Might be…
Sun, 04/07/2024 - 17:45

Not totally sure. Might be worth taking a look at the illager code? It's easy enough to make a mob hold a crossbow and shoot arrows, but I assume you also want it to have the charge behavior.

Joined Apr 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I tried, but nothing has…
Wed, 04/10/2024 - 18:25

I tried, but nothing has changed, there is a chance that I just did something wrong.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Well, to make the mob shoot…
Wed, 04/10/2024 - 20:03

Well, to make the mob shoot arrows, you'll want to enable a ranged attack in its AI, and set the projectile to arrows. (You could also make a procedure that causes it to fire arrows at set intervals.) 

One method might be to use the Geckolib plugin to add a custom attack animation. You could have your entity perform said animation when firing to make it look like they're wielding a crossbow.