Help with a sentry turret

Started by Puglord123 on

Topic category: Help with modding (Java Edition)

Last seen on 15:12, 29. Sep 2024
Joined Dec 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Help with a sentry turret

I'm currently working on a Portal mod, and i'm trying to make a sentry turret that just sits in place, doesn't look around and just shoots you. The problem i have is that whenever a turret sees you it turns around to shoot you, is there any way to make it not look at you at all?

Last seen on 14:25, 13. Oct 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes, but you'll need to code…
Sat, 10/07/2023 - 18:17

Yes, but you'll need to code in custom projectile behavior, since the built in ranged attack system automatically forces mobs to look at their target for aiming purposes. There are code blocks to manage projectiles firing; essentially, you would disable the mob's AI, and instead make an update tick procedure that causes projectiles to fire from the entity if there's a player in a certain radius whose position is in line with its look angle vectors.