Started by
Gavydog
on
Topic category: Help with Minecraft modding (Java Edition)
Yeah, so I have this axe which summons lightning when you attack a mob, but the lightning damages the player also. Any way to stop the player from being damaged?
Also if this is possible I would like the lightning bolt to not cause fire. Thx!
Edited by Gavydog on Wed, 06/24/2020 - 11:57
do something like this:
the 1st text field text is: "LivingAttackEvent event = (LivingAttackEvent)dependencies.get("event");"
the 2nd text field is: "if (event.getSource() != null && event.getSource() == DamageSource.LIGHTNING_BOLT) "
also replace the wooden axe with your custom axe.
this makes all players immune to lightning if he has that axe in main hand.
Where am I supposed to put this? Because after I put this code I was followed by infinite lightning :/
Wait actually now it doesnt but i still take lightning damage.
Ahznb, wow nice, with this, you will be able to make a plugins about making player immune to many kinds of damages?
create a new procedure element and put that in. also note in the top green block, the global trigger is "Entity attacked"
yes. but note that this is for 1.12.2. i don't know if 1.15.x changed it or not
Oh maybe thats why im using 1.15.2
But here's my scipts
https://imgur.com/a/okijbEH
No, I tried 1.15.2 and it's still working tho
Then is my scripts wrong
ahznb Does it matter if the current entity is replaced by source entity is it the same. Cuz Idk what's wrong
You only use Source Entity when you hit other entities, but in this case, the lighting damages the entities not you So use Current Entity
are you calling that procedure from somewhere? because you shouldn't call it, just create the procedure and don't call it anywhere.