How can I prevent custom entity from targeting the farthest entity and ignore entities behind blocks?(SOLVED)

Started by Classic- on

Topic category: Help with Minecraft modding (Java Edition)

Active 2 weeks ago
Joined Apr 2020
Points:
641

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 7
How can I prevent custom entity from targeting the farthest entity and ignore entities behind blocks?(SOLVED)
Tue, 04/01/2025 - 10:55 (edited)

I'm trying to make a system that will allow my entity to target Monster Entities withing a certain radius. Shown Here

https://imgur.com/a/5feGuf2

Does anyone know how to make it not check for entities behind blocks and not target the farthest entity and target the nearest?

Edited by Classic- on Tue, 04/01/2025 - 10:55
Active 1 day ago
Joined Dec 2014
Points:
1084

User statistics:

  • Modifications: 0
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 673
Making it not target the…
Mon, 03/31/2025 - 10:55

Making it not target the last entity it finds should be easily solved by breaking out of the loop when the first entity is found.

I didn't look at your procedure that closely so forgive me if you are already doing this.

Active 2 weeks ago
Joined Apr 2020
Points:
641

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 7
OH MY GOD THANKS SO MUCH IT…
Mon, 03/31/2025 - 14:06

OH MY GOD THANKS SO MUCH IT WORKS!! I didn't know about the whole break out thing very well thanks for the help!

Active 1 day ago
Joined Dec 2014
Points:
1084

User statistics:

  • Modifications: 0
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 673
No problem :)
Mon, 03/31/2025 - 14:07

No problem :)

Active 2 weeks ago
Joined Apr 2020
Points:
641

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 7
https://imgur.com/a…
Mon, 03/31/2025 - 14:21

https://imgur.com/a/ei7EFTh

For anyone else who comes across this this procedure works and also stops attacking when the Entity Iterator goes behind something. Yeah it will still look at it still if no other target is nearby but, it will lock onto something else if its the same Entity Iterator that isn't behind something after.

Active 1 day ago
Joined Dec 2014
Points:
1084

User statistics:

  • Modifications: 0
  • Forum topics: 6
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 673
Is that line of sight block…
Mon, 03/31/2025 - 14:24

Is that line of sight block a plugin?

Active 2 weeks ago
Joined Apr 2020
Points:
641

User statistics:

  • Modifications: 0
  • Forum topics: 2
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 7
it probably is. I couldn't…
Tue, 04/01/2025 - 10:54

it probably is. I couldn't tell ya I had plugins in MCreator for months now I forgot what the default blocks are.