How can I make a projectile not collide or damage certain entities

Started by Classic- on

Topic category: Help with Minecraft modding (Java Edition)

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can I make a projectile not collide or damage certain entities

Tryna make a Pea for a Peashooter though, I can't figure out how to make the Pea not hit any other plants. Is there any way to make projectiles ignore certain entities or go through them? Like shoot past them and hit the actual target instead of killing other plants. I looked through some code and found stuff about Projectile impact events but I don't really know how to use those and I tried looking everywhere for a way to code it into the projectile but I turned up nothing I'm looking for.

Any help is appreciated thanks!

Joined Apr 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
My thought would be to give…
Tue, 07/15/2025 - 19:03

My thought would be to give the projectile a really high pierce value but deal no damage on a hit. Instead run a procedure when it hits an entity, and check if the entity is not in a tag, and if it is not, then deal damage to the entity from the source entity with direct cause immediate source entity, and also despawn immediate source entity (the projectile) so it doesn't keep going after it hits an enemy. This may still cause a red flash/minor knockback when it passes through a plant though, I'm not quite sure as I haven't tested this exact case yet.

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
thanks for answering I'll…
Tue, 07/15/2025 - 21:53

thanks for answering I'll try this when I get time.

Joined Jun 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
what i did is made a…
Wed, 07/16/2025 - 00:00

what i did is made a procedure with global trigger when entityy takes damage, then check if the sourceentity is a plant if so cancel event.