So I thought, why don't you make a spell cast using the swing weapon button and force the remaining free activate center object button to activate its usual action, which is used by default when the sword is taken out? That is, it will also be possible to talk to villagers with spells in your hands.
I started to create the mod called "Magic Right Cast", and almost immediately faced big problems, which consisted of the fact that I needed to somehow change some private fields and functions in the source code using a script. So there's part of the code that is responsible for casting spells in the EntityEffectsManager Update function:
Code: Select all
246| // Cast spell
247| if (InputManager.Instance.ActionStarted(InputManager.Actions.ActivateCenterObject) && readySpell != null)
248| {
249| CastReadySpell();
250| return;
251| }
There is also logic for talking to villagers in the PlayerActivate class that needs to be changed the same way.
I have read some advice from the forum about using a dll, but I don't know how to change source code that way at all. Maybe you could know some ways to solve the problem and tell me. I will be grateful.