Only spectral arrows should deal damage

Started by rgpmc on

Topic category: Help with MCreator software

Joined Mar 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Only spectral arrows should deal damage

I am creating a boss and I want it so that only spectral arrows deal damage to it

I tried to use the following code

        if (damagesource.getDirectEntity() instanceof Arrow)

return false;
if (damagesource.getDirectEntity() instanceof TippedArrow)
return false;
if (damagesource.getDirectEntity() instanceof SpectralArrow)
return true;

but it did not work

Can someone help me resolve this?

Joined Mar 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nvm guys I found itfor thoseā€¦
Mon, 03/24/2025 - 17:24

Nvm guys I found it
for those who have issues with it you need these two lines of code
import net.minecraft.world.entity.projectile.SpectralArrow;
 

and

 

if (!(damagesource.getDirectEntity() instanceof SpectralArrow)) {
   return false; // Block all non-spectral arrow damage
}