Help with a sentry turret

Started by Puglord123 on

Topic category: Help with Minecraft modding (Java Edition)

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?

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.