How do I make it so a ranged entity (an entity that uses ranged items) doesn't shoot itself on accident

Started by The_Big_Monke_Guy on

Topic category: Help with modding (Java Edition)

Last seen on 17:02, 15. Apr 2024
Joined Aug 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make it so a ranged entity (an entity that uses ranged items) doesn't shoot itself on accident
Thu, 02/15/2024 - 21:35 (edited)

I tried making an entity  that uses ranged attacks, but if i put more than one it accidentally shoots the others i put on, can i make it so the ranged item just passes through (ignores) every entity but damages ones i choose (for example: It passes through every mob but zombies and slimes).

Any help is appreciated

Edited by The_Big_Monke_Guy on Thu, 02/15/2024 - 21:35
Last seen on 03:15, 26. Apr 2024
Joined Aug 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
im not sure, however i can…
Sun, 02/18/2024 - 01:02

im not sure, however i can make it not hurt itself.

before entity gets hurt

check if the entity is the right one

if so, check if the source entity is event/target entity

if so, set health for target entity to plus one.

it wont take damage