| 1 | package com.pendonym;
|
| 2 |
|
| 3 | import com.mojang.blaze3d.platform.InputConstants;
|
| 4 | import com.pendonym.module.misc.DiscordRPC;
|
| 5 | import net.fabricmc.api.ModInitializer;
|
| 6 |
|
| 7 | import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
|
| 8 | import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper;
|
| 9 | import net.minecraft.client.KeyMapping;
|
| 10 | import net.minecraft.client.Minecraft;
|
| 11 | import net.minecraft.network.chat.Component;
|
| 12 | import net.minecraft.resources.Identifier;
|
| 13 |
|
| 14 | import org.slf4j.Logger;
|
| 15 | import org.slf4j.LoggerFactory;
|
| 16 | import com.pendonym.event.EventManager;
|
| 17 | import com.pendonym.gui.ClickGui;
|
| 18 | import com.pendonym.keybind.KeybindManager;
|
| 19 | import com.pendonym.module.Module;
|
| 20 | import com.pendonym.module.ModuleManager;
|
| 21 |
|
| 22 | public class GoonClient implements ModInitializer {
|
| 23 | public static final String MOD_ID = "goon";
|
| 24 | public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);
|
| 25 | public static Minecraft mc;
|
| 26 |
|
| 27 | public static final EventManager EVENT_MANAGER = new EventManager();
|
| 28 |
|
| 29 | @Override
|
| 30 | public void onInitialize() {
|
| 31 | mc = Minecraft.getInstance();
|
| 32 |
|
| 33 | EVENT_MANAGER.register(new KeybindManager());
|
| 34 |
|
| 35 | KeyMapping.Category CATEGORY = KeyMapping.Category.register(
|
| 36 | Identifier.fromNamespaceAndPath(MOD_ID, "goon_client")
|
| 37 | );
|
| 38 |
|
| 39 | KeyMapping openKey = KeyMappingHelper.registerKeyMapping(
|
| 40 | new KeyMapping(
|
| 41 | "key.goon.open_client",
|
| 42 | InputConstants.Type.KEYSYM,
|
| 43 | InputConstants.KEY_J,
|
| 44 | CATEGORY
|
| 45 | )
|
| 46 | );
|
| 47 |
|
| 48 | ClientTickEvents.END_CLIENT_TICK.register(client -> {
|
| 49 | while (openKey.consumeClick()) {
|
| 50 | Minecraft.getInstance().gui.setScreen(
|
| 51 | new ClickGui(Component.empty())
|
| 52 | );
|
| 53 | }
|
| 54 |
|
| 55 | for (Module module : ModuleManager.getModules()) {
|
| 56 | if (module.isEnabled()) {
|
| 57 | module.onTick();
|
| 58 | }
|
| 59 | }
|
| 60 | });
|
| 61 |
|
| 62 | DiscordRPC.INSTANCE.setEnabled(true);
|
| 63 | }
|
| 64 |
|
| 65 | public static Identifier id(String path) {
|
| 66 | return Identifier.fromNamespaceAndPath(MOD_ID, path);
|
| 67 | }
|
| 68 | }
|
| 69 |
|