Hey, i tried different ways to force player to hold down left click but i couldn't acquire what i wanted, here are the ways i tried to do:
I put that code on scheduled timer (Did not work):
package com.example.examplemod;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import java.util.TimerTask;
public class LeftClick extends TimerTask {
@Override
public void run() {
long oldTime = System.currentTimeMillis();
while (System.currentTimeMillis() - oldTime < 33000) {
KeyBinding.onTick(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode());
}
try {
Thread.sleep(0);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
Tried that and did not work either:
KeyBinding.setKeyBindState(keyCodes[0], true);
Tried to loop that and the game just crashed right away:
KeyBinding.onTick(Minecraft.getMinecraft().gameSettings.keyBindAttack.getKeyCode());
and few other things :/.