Files
src
build.gradle
gradle.properties
manifest.kod
settings.gradle
Code
14 413
src/client/java/com/practiceassist/PracticeAssist.java
package com.practiceassist;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.util.Identifier;
import org.lwjgl.glfw.GLFW;
public final class PracticeAssist implements ClientModInitializer {
public static Config config;
public static AimAssistModule aim;
public static TriggerBotModule trigger;
private KeyBinding aimKey, triggerKey, settingsKey;
public static boolean allowed(MinecraftClient client) {
return client.player != null && client.world != null;
}
@Override public void onInitializeClient() {
config = Config.load();
aim = new AimAssistModule(config);
trigger = new TriggerBotModule(config);
KeyBinding.Category category = KeyBinding.Category.create(Identifier.of("practiceassist", "controls"));
aimKey = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.practiceassist.aim", GLFW.GLFW_KEY_G, category));
triggerKey = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.practiceassist.trigger", GLFW.GLFW_KEY_R, category));
settingsKey = KeyBindingHelper.registerKeyBinding(new KeyBinding("key.practiceassist.settings", GLFW.GLFW_KEY_RIGHT_SHIFT, category));
HudOverlay.register();
ClientTickEvents.END_CLIENT_TICK.register(this::tick);
}
private void tick(MinecraftClient client) {
boolean allowed = allowed(client);
boolean aimPressed = false, triggerPressed = false, settingsPressed = false;
while (aimKey.wasPressed()) aimPressed = !aimPressed;
while (triggerKey.wasPressed()) triggerPressed = !triggerPressed;
while (settingsKey.wasPressed()) settingsPressed = true;
if (allowed && client.currentScreen == null) {
if (aimPressed) config.aimEnabled = !config.aimEnabled;
if (triggerPressed) config.triggerEnabled = !config.triggerEnabled;
if (aimPressed || triggerPressed) config.save();
if (settingsPressed) client.setScreen(ConfigScreen.create(null, config));
}
aim.onTick(client);
trigger.onTick(client);
}
}