Started by
Ro...
on
Topic category: Help with Minecraft modding (Java Edition)
Hi, i want to release the version 8 of my mod. this version add a boss (kinda hard to kill). this boss is immune of everything exept Melee Damage, so if u shoot an arrow, the arrow will just bounce. but if u use a custom arrow, example. my mod is a magic mod with staff and all, and one of the 12 spell is shooting Magic orb. for that. i just created a ranged weapon that shoot a thing. but when i shoot with that staff on the boss. he lose health. i need help or i wont be able to finish my mod.
I would call LivingDamageEvent. Then use event.getSource to check if the DamageSource is an instance of your custom arrow. If the damage source is because of your arrow. We can cancel it.
Here is what it should look like (TEST THIS FOR YOURSELF, I JUST MADE THIS CODE SO THERE MAY BE ERRORS),
Ok thx, but in my mod there is around 48 staff that use the same projectile so it should work. and what is the instanceof. is that ID or something like that?
I will provide you with a link about instanceof below. For your question,
Yes if they use the same projectile it will work
https://www.javatpoint.com/downcasting-with-instanceof-operator
Riku, did you ever solve this problem?
nope, i didnt test it either, so i don't know if it works.