Skip to content

Conversation

chaitu0461
Copy link

This PR preserves the mob state like health, armour after lightining strike

@chaitu0461 chaitu0461 changed the title Preserve Entity State After Lightining Strike Preserve Mob State After Lightining Strike Oct 4, 2025
Copy link
Member

@YouHaveTrouble YouHaveTrouble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be worth adding this as an optional config entry like settings.lightning-transforms-entities.preserve-entity-state: true. The default should probably be false since I don't believe this is what happens when vanilla lightning entity conversion takes place.

@jacklollz2
Copy link

Might be worth adding this as an optional config entry like settings.lightning-transforms-entities.preserve-entity-state: true. The default should probably be false since I don't believe this is what happens when vanilla lightning entity conversion takes place.

That's because in Vanilla, the small built in list of transformations don't have anything to preserve, if anything I should report this to Mojang, let's say you have a pig that's frozen for NPC purposes, the lightning strike now clearing that flag exploits that mechanic

@chaitu0461
Copy link
Author

chaitu0461 commented Oct 6, 2025

Might be worth adding this as an optional config entry like settings.lightning-transforms-entities.preserve-entity-state: true. The default should probably be false since I don't believe this is what happens when vanilla lightning entity conversion takes place.

I have added a flag to the logic. The mob state would be preserved only if settings.lightning-transforms-entities.preserve-entity-state is true. Can you please review once again

@YouHaveTrouble
Copy link
Member

I will once I get my new setup working. Please be patient!

Copy link
Member

@YouHaveTrouble YouHaveTrouble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added

zombie: "skeleton"

to the entities section. Spawned a zombie with iron helmet and iron sword in, summoned lightning on it. Equipment was not retained. The option preserve-entity-state is true.

I think you're missing the methods to retain data in onLightningStrike(EntityDamageByEntityEvent event) method. I noticed you only added those in EntityZapEvent which only triggers for mobs that are transformed with lightning in vanilla game.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants