-
Автор темы
- #1
Что не так с кодом? Вызываю по клику колесика мыши, но биндиться не хочет гуи КС ГО
Код:
package src.main.modules;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.KeyBinding;
import org.lwjgl.input.Mouse;
import java.util.ArrayList;
public class MouseBind {
private static Minecraft mc = Minecraft.getMinecraft();
private static ArrayList<Integer> mouseButtons = new ArrayList<Integer>();
public static void init() {
mouseButtons.add(0);
mouseButtons.add(1);
mouseButtons.add(2);
mouseButtons.add(3);
mouseButtons.add(4);
mouseButtons.add(5);
mouseButtons.add(6);
mouseButtons.add(7);
}
public static void onTick() {
if (mc.currentScreen == null) {
int dWheel = Mouse.getDWheel();
if (dWheel != 0) {
KeyBinding[] keyBindings = mc.gameSettings.keyBindings;
for (int i = 0; i < keyBindings.length; i++) {
KeyBinding kb = keyBindings[i];
if (kb.getKeyDescription().equals("Use Item")) {
if (dWheel > 0) {
KeyBinding.setKeyBindState(kb.getKeyCode(), true);
KeyBinding.onTick(kb.getKeyCode());
KeyBinding.setKeyBindState(kb.getKeyCode(), false);
} else if (dWheel < 0) {
KeyBinding.setKeyBindState(kb.getKeyCode(), true);
KeyBinding.onTick(kb.getKeyCode());
KeyBinding.setKeyBindState(kb.getKeyCode(), false);
}
}
}
}
}
}
}