DasHomi / preventer

A mod that prevents you from doing dumb things
https://modrinth.com/mod/preventer
MIT License
8 stars 4 forks source link

Gamemode interaction #59

Open Joboblock opened 4 months ago

Joboblock commented 4 months ago

Problem: If for example prevent hitting villagers is on, you are not able to interact with them in spectator mode (View the world from their eyes). I’m aware of the override button, but this seems unintended.

Solution: A solution to this would be, to check, if the player is in spectator, before canceling the AttackEntityEvent.

An additional solution would be, to only prevent the player from certain actions in a specific gamemode (And a config option to configure the affected gamemodes), or to have an option, to toggle preventer with the override button (not holding).

Opinion: The second solution is my favorite, because I do not like being affected my this mod in spectator or creative mode and toggle to override is in my opinion more useful, to quickly override not being able to for example attack zombified piglins, if you accidentally shoot one of them or if you want to create a path, you do not have to either hold the override button all the time or change the corresponding config option.

DasHomi commented 4 months ago

Yeah, I think the mod already checks for gamemode on some modules, but I'll add spectator mode as well (and maybe a config to change which gamemodes automatically override all modules). For the piglins, in the past it tried to make the module dynamically turn off if the piglins are agro, but that sadly isn't possible with a client-side mod (at least to my knowledge). But the idea of an override toggle sounds good; I think I'll add it as an option to change between toggle and hold.