Only spectral arrows should deal damage

Started by rgpmc on

Topic category: Help with MCreator software

Active 4 days ago
Joined Mar 2025
Points:
6

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 1
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?

Active 4 days ago
Joined Mar 2025
Points:
6

User statistics:

  • Modifications: 0
  • Forum topics: 1
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 1
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
}