I need help making a mob that shoots projectiles.

Started by BMAgamer on

Topic category: Help with modding (Java Edition)

Last seen on 21:57, 1. Apr 2024
Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I need help making a mob that shoots projectiles.

I want to make a simple entity that shoots hostile mobs. I am using procedures for this since I want to sync it with geckolib.

Right now, I have made the entity shoot an invisible projectile that deals no damage at the mob, in order to target and look at them. Then, I have it so that if the entity is targetting a mob, it will shoot my custom projectile every 60 ticks. Only issue, is that it keeps shooting the projectile in the same direction the mob was originally at, and it doesn't follow the mob.

How can I fix this, in other words, how can I make it so the entity shoots hostile mobs using projectile procedures.

Last seen on 13:38, 16. Apr 2024
Joined Sep 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
just make an entity tickā€¦
Mon, 04/15/2024 - 19:30

just make an entity tick procedure for that entity, and if their attack target is no equal to null entity, then make them look at the coordinates of the attack target, and then make their projectiles go in the direction the entity is facing by setting the projectile's yaw and pitch to that of the entity.

P.S, just make sure to put this procedure in the "living tick" trigger of the entity.