MinecraftFreecam / Freecam

A highly customizable freecam mod for Minecraft. [Maintiners: @hashalite @MattSturgeon]
https://curseforge.com/minecraft/mc-mods/free-cam
MIT License
75 stars 30 forks source link

Animations still play even when "interact" is disabled #23

Closed MattSturgeon closed 2 years ago

MattSturgeon commented 2 years ago

When "Allow Interaction" is disabled, you can still attempt to interact. E.g. when left-clicking, a use hand animation will play as if the client is going through the motions of trying to attack/mine but then decides not to (when it eventually hits your mixin).

https://user-images.githubusercontent.com/5046562/167724703-0992da00-6cde-4791-b1be-2c0485579919.mov

IMO it'd make more sense if absolutely nothing happens when left-clicking, unless "Allow Interaction" is enabled.

Perhaps a MinecraftClientMixin should inject into doAttack, doItemUse, doItemPick, and handleBlockBreaking and return early if ModConfig.allowInteract is false. Since these are the methods run by MinecraftClient.handleInputEvents and therefore are the earliest opportunity to cancel any attempted interaction, short of injecting directly somewhere into handleInputEvents itself.