Hello, I'm working on a mod that implements guns by extending the ItemBow class. I am currently using onItemRightClick as the trigger to fire the gun. In an attempt to make semi-automatic weapons (i.e. clicking mouse fires once, and won't fire again until the mouse is released), I call setItemInUse each time it is triggered, and then set a boolean "hasReleased" that prevents this method from running again until onPlayerStoppedUsing is called. However, onPlayerStoppedUsing does not usually trigger. If I'm correct, this is because it will only trigger if the player releases the mouse button during the time limit of "getMaxItemUseDuration".
Basically, does anyone know of a way to either set the value of "this.getMaxItemUseDuration" to infinity (so that the item can be "used" forever without finishing a cycle) or a way to detect the player releasing the mouse button even after that duration has ended?
(I'm also very open to suggestions if anyone knows of a better way that I should be doing this.)
I think I may have found a solution using player.isUsingItem(), which seems to return true as long as the player is holding down the right mouse button. I am still open to suggestions if there is a better way, but this method works for now.