Strike a lighting as an effect (without damage and fire)

Hey. As the title says, I need to spawn a lightning without causing any damage. Something like World#strikeLightningEffect() in bukkit. Thx

Location<World> loc;
Lightning lightning = (Lightning) loc.createEntity(EntityTypes.LIGHTNING);

Not tested it

Tested. Unfortunately, doesn’t work. My code (is similar, but why not):

        Lightning lightning = (Lightning) player.getWorld().createEntity(EntityTypes.LIGHTNING, player.getPosition());

Could you explain “doesn’t work”? Sorry i dont have a working computer to test

Sorry, should have mentioned that better. It still does damage and fire.

Maybe its a bug in sponge. I would report it on the github issue page.

You maybe able to do a work around by cancelling the damage event if the cause contains a lightning every at that position. Didnt know you also wanted fire disabled too, again would probably be best to cancel the event if the cause is from lightning at the position

Thanks for that. I wan’t to believe that the issue page is not created because of my own stupidity :slight_smile:

It may not be. Lightning has very few use cases so my guess is it didnt get tested reasently.

Sponge is huge with the internal Mixens (the code that allows the modification of MC code) is constantly changing that can break some api calls. And some stuff just outright never worked, im mainly refering to some events that were just never implemented, my guess is lightning effect was the former but it also could be the latter.

Yeah, well NMS is always a solution - but not good, we don’t want to bring that Bukkit era xD. Sorry for offtop, though. Let’s say this has a solution for now.