Skip to content

Commit

Permalink
Fixes and bump
Browse files Browse the repository at this point in the history
Hopefully fixed a softlock...
  • Loading branch information
Scribble authored and Scribble committed Oct 24, 2021
1 parent 9a31119 commit f1c29de
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ apply plugin: 'org.spongepowered.mixin'
//Only edit below this line, the above code adds and enables the necessary things for Forge to be setup.


version = "Alpha7-WIP"
version = "Alpha7"
group = "de.scribble.lp.tastools" // http://maven.apache.org/guides/mini/guide-naming-conventions.html
archivesBaseName = "TASmod-1.12.2"

Expand Down
9 changes: 6 additions & 3 deletions src/main/java/de/scribble/lp/tasmod/virtual/VirtualInput.java
Original file line number Diff line number Diff line change
Expand Up @@ -262,15 +262,18 @@ public VirtualMouse getNextMouse() {

public void updateNextMouse(int keycode, boolean keystate, int scrollwheel, int cursorX, int cursorY, boolean filter) {

if (VirtualKeybindings.isKeyCodeAlwaysBlocked(keycode - 100)) {
return;
}
boolean flag = true;
if (filter) {
flag = nextMouse.isSomethingDown() || scrollwheel != 0 || keycode != -1;
}

VirtualKey key = nextMouse.get(keycode - 100);

if (VirtualKeybindings.isKeyCodeAlwaysBlocked(keycode - 100)) {
key.setPressed(false);
return;
}

key.setPressed(keystate);

nextMouse.setScrollWheel(scrollwheel);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
*/
public class VirtualKeybindings {
private static Minecraft mc = Minecraft.getMinecraft();
private static long cooldown = 50*10;
private static long cooldown = 50*5;
private static HashMap<KeyBinding, Long> cooldownHashMap = Maps.<KeyBinding, Long>newHashMap();
private static List<KeyBinding> blockedKeys = new ArrayList<>();
public static boolean focused = false;
Expand All @@ -51,6 +51,10 @@ public static boolean isKeyDown(KeyBinding keybind) {

boolean down = false;

if(mc.currentScreen instanceof GuiControls) {
return false;
}

if (isKeyCodeAlwaysBlocked(keycode)) {
down = keycode >= 0 ? Keyboard.isKeyDown(keycode) : Mouse.isButtonDown(keycode + 100);
} else {
Expand Down Expand Up @@ -79,7 +83,7 @@ public static boolean isKeyDown(KeyBinding keybind) {
* @return
*/
public static boolean isKeyDownExceptTextfield(KeyBinding keybind) {
if (mc.currentScreen instanceof GuiChat || mc.currentScreen instanceof GuiEditSign || (focused && mc.currentScreen != null) || mc.currentScreen instanceof GuiControls) {
if (mc.currentScreen instanceof GuiChat || mc.currentScreen instanceof GuiEditSign || (focused && mc.currentScreen != null)) {
return false;
}
return isKeyDown(keybind);
Expand Down

0 comments on commit f1c29de

Please sign in to comment.