generated from FabricMC/fabric-example-mod
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added ability to rebind shift in inventory (QUICK_MOVE)
- Loading branch information
Showing
4 changed files
with
38 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
src/main/java/com/minenash/rebind_all_the_keys/mixin/HandledScreenMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package com.minenash.rebind_all_the_keys.mixin; | ||
|
||
import com.minenash.rebind_all_the_keys.RebindAllTheKeys; | ||
import net.minecraft.client.gui.screen.ingame.HandledScreen; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Redirect; | ||
|
||
@Mixin(HandledScreen.class) | ||
public class HandledScreenMixin { | ||
|
||
@Redirect(method = "mouseReleased", at = @At(value = "INVOKE",target = "Lnet/minecraft/client/gui/screen/ingame/HandledScreen;hasShiftDown()Z")) | ||
public boolean rebindShift() { | ||
return RebindAllTheKeys.QUICK_MOVE.isDefault() ? HandledScreen.hasShiftDown() : RebindAllTheKeys.isKeybindPressed(RebindAllTheKeys.QUICK_MOVE); | ||
} | ||
|
||
@Redirect(method = "mouseReleased", at = @At(value = "INVOKE",target = "Lnet/minecraft/client/util/InputUtil;isKeyPressed(JI)Z")) | ||
public boolean rebindShift2(long _handle, int _code) { | ||
return RebindAllTheKeys.QUICK_MOVE.isDefault() ? HandledScreen.hasShiftDown() : RebindAllTheKeys.isKeybindPressed(RebindAllTheKeys.QUICK_MOVE); | ||
} | ||
|
||
@Redirect(method = "mouseClicked", at = @At(value = "INVOKE",target = "Lnet/minecraft/client/util/InputUtil;isKeyPressed(JI)Z")) | ||
public boolean rebindShift3(long _handle, int _code) { | ||
return RebindAllTheKeys.QUICK_MOVE.isDefault() ? HandledScreen.hasShiftDown() : RebindAllTheKeys.isKeybindPressed(RebindAllTheKeys.QUICK_MOVE); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,5 +22,8 @@ | |
], | ||
"injectors": { | ||
"defaultRequire": 1 | ||
} | ||
}, | ||
"mixins": [ | ||
"HandledScreenMixin" | ||
] | ||
} |