zabi94 / ExtraAlchemy

Extra Alchemy: a Minecraft mod that expands on potions
Other
38 stars 16 forks source link

The behavior of the Potion Ring does not follow its tooltip #156

Closed lonefelidae16 closed 1 year ago

lonefelidae16 commented 1 year ago

Describe the bug

As you know, we can change key bindings to different ones.

https://github.com/zabi94/ExtraAlchemy/blob/7b31ca9be38ffc55f15bfe431ec9385653e4a703/src/main/resources/assets/extraalchemy/lang/en_us.json#L15-L16

When I follow this tooltip to activate the Potion Ring with Shift + Right Click, it doesn’t. After examining the code, I was able to figure out why it doesn’t.

https://github.com/zabi94/ExtraAlchemy/blob/7b31ca9be38ffc55f15bfe431ec9385653e4a703/src/main/java/zabi/minecraft/extraalchemy/items/PotionRingItem.java#L76-L84

That’s because my Shift key is assigned to Sprint and the Potion Ring checks for Sneaking at line 79.

To Reproduce

Steps to reproduce the behavior:

  1. Set the Sneak key from Shift to another on the key bind setting screen.
  2. Get the Potion Ring in the Hotbar.
  3. Shift + Right Click and it doesn’t activate.

Expected behavior

If it needs to sneak, I think the tooltip should to be changed to Right click while sneaking to enable/disable. If not, it would be more awesome if it could determine if the Shift key is really being pressed.

I tried to implement this, but I found that it requires interaction between server and client using the packet behavior.

It works for me, but the statements get more complex, so I think it’s just enough to determine if the player is sneaking or not. Maybe there is another way or useful library to do this, but I could not find it, perhaps my search skills are not good enough.

Environment (please complete the following information):

zabi94 commented 1 year ago

Changing the tooltip will be more than enough, no need to implement all of that. Thanks for the feedback