Skip to content

Conversation

@madebytwentyfive
Copy link
Contributor

The existing does so if the game rule this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) is true, then the whole condition is true, which is why blocks still get destroyed even when the config is set to false.

The fix is to check if the source is a fireball, it will check the purpur config in this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING, this.purpurConfig.fireballsMobGriefingOverride).

Else it will use the default one this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING).

This is tested with every value and it works.

Fixes #1722

@BillyGalbreath
Copy link
Contributor

BillyGalbreath commented Nov 20, 2025

This doesn't change anything. They're the same thing. nvm. see below

@madebytwentyfive
Copy link
Contributor Author

Mind if you explain ?

@madebytwentyfive
Copy link
Contributor Author

- case MOB -> (source instanceof net.minecraft.world.entity.projectile.LargeFireball && this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING, this.purpurConfig.fireballsMobGriefingOverride)) || this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING) // Purpur - Add mobGriefing override to everything affected
+ case MOB -> ((source instanceof net.minecraft.world.entity.projectile.LargeFireball) ? this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING, this.purpurConfig.fireballsMobGriefingOverride) : this.getGameRules().getBoolean(GameRules.RULE_MOBGRIEFING)) // Purpur - Add mobGriefing override to everything affected
  • Let's take the gamerule set to true and in config it's set to false. source is also a LargeFireball:
  1. Old version:
  • (true && false) || true -> true, means it can grief (Which is not correct, because the override is false).
  1. New version:
  • true ? false : true -> false, means it can't grief blocks which respects the config.

Note that getBoolean(key, value) doesn't override the gamerule.
Looking at the code, it just checks if the value is not null: If it's not null, it will return the value, else it will return the key's value.

@BillyGalbreath
Copy link
Contributor

Mind if you explain ?

my bad. as i was writing it out to explain myself, i caught the subtle difference lol

don't mind me ^_^

@granny
Copy link
Member

granny commented Nov 21, 2025

Thank you for the PR!

@granny granny merged commit 95a466c into PurpurMC:ver/1.21.10 Nov 21, 2025
1 check passed
@madebytwentyfive madebytwentyfive deleted the fix/fireballs-mobgriefing-override branch November 24, 2025 21:17
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.

'fireballs-mob-griefing-override' is not working.

3 participants