summaryrefslogtreecommitdiff
path: root/src/main/java/net/justlearning/arslaan3102/arslaansmagichax/modules/Module.java
blob: 9334a5348079f7789c463d3ccafa57b5ad2d6092 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
package net.justlearning.arslaan3102.arslaansmagichax.modules;

import net.minecraft.client.MinecraftClient;

public abstract class Module {
    private final String name;
    private final String description;
    private final Category category;
    public MinecraftClient mc;
    private final int glfwKeybinding;

    private boolean enabled = false;

    public Module(String name, String description, int glfwKeybinding, Category category) {
        this.name = name;
        this.description = description;
        this.mc = MinecraftClient.getInstance();
        this.glfwKeybinding = glfwKeybinding;
        this.category = category;
    }

    public String getName() {
        return name;
    }

    public String getDescription() {
        return description;
    }

    public int getGlfwKeybinding() {
        return glfwKeybinding;
    }

    public Category getCategory() {
        return category;
    }

    public boolean isEnabled() {
        return enabled;
    }

    public void toggle() {
        enabled = !enabled;
        if (enabled) onEnable();
        else onDisable();
    }

    public void setEnabled(boolean state) {
        if (enabled != state) toggle();
    }

    protected void onEnable() {}
    protected void onDisable() {}

    public void tick() {}
}