Skip to content

Commit

Permalink
Add an ignore scroll hotkey
Browse files Browse the repository at this point in the history
Some mods do not cancel the scroll event. The ignore scroll key can be
 bound to any key without worry of conflicts and the scrolling handler
 will ignore scroll events while this button is down.

Fix #49
  • Loading branch information
rolandoislas committed Feb 22, 2018
1 parent 66857ae commit 2f57eba
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static void setSentPlayerMessage(boolean sentPlayerMessage) {
* @param event mouse event
*/
public void mouseEvent(MouseEvent event) {
if (!hasCoreMod || getShowDefaultToggle() || event.isCanceled())
if (!hasCoreMod || getShowDefaultToggle() || event.isCanceled() || KeyBindings.scrollIgnore.isKeyDown())
return;
// Scrolled
if (event.getDwheel() != 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,19 @@ public class KeyBindings {
public static KeyBinding previousHotbar;
public static boolean nextHotbarWasPressed;
public static boolean previousHotbarWasPressed;
public static KeyBinding scrollIgnore;

public static void load() {
scrollModifier = new KeyBinding(getDescription("scrollModifier"), Keyboard.KEY_LMENU, CATEGORY_GENERAL);
showDefaultHotbar = new KeyBinding(getDescription("showDefaultHotbar"), Keyboard.KEY_GRAVE, CATEGORY_GENERAL);
nextHotbar = new KeyBinding(getDescription("nextHotbar"), Keyboard.KEY_X, CATEGORY_GENERAL);
previousHotbar = new KeyBinding(getDescription("previousHotbar"), Keyboard.KEY_C, CATEGORY_GENERAL);
scrollIgnore = new KeyBinding(getDescription("scrollIgnore"), Keyboard.KEY_NONE, CATEGORY_GENERAL);
ClientRegistry.registerKeyBinding(scrollModifier);
ClientRegistry.registerKeyBinding(showDefaultHotbar);
ClientRegistry.registerKeyBinding(nextHotbar);
ClientRegistry.registerKeyBinding(previousHotbar);
ClientRegistry.registerKeyBinding(scrollIgnore);

hotbarKeys = new ArrayList<>();
for (int slot = HotbarLogic.VANILLA_HOTBAR_SIZE + 1; slot <= InventoryPlayer.getHotbarSize(); slot++) {
Expand Down
1 change: 1 addition & 0 deletions src/main/resources/assets/multihotbar/lang/en_US.lang
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ key.multihotbar.scrollModifier=Scroll Modifier
key.multihotbar.showDefaultHotbar=Show Default Hotbar
key.multihotbar.nextHotbar=Next Hotbar
key.multihotbar.previousHotbar=Previous Hotbar
key.multihotbar.scrollIgnore=Ignore Scroll
key.multihotbar.hotbarkey.10=Hotbar Slot 10
key.multihotbar.hotbarkey.11=Hotbar Slot 11
key.multihotbar.hotbarkey.12=Hotbar Slot 12
Expand Down

0 comments on commit 2f57eba

Please sign in to comment.