2023-01-12 14:10:43 -08:00
|
|
|
package dev.resent.module.base;
|
|
|
|
|
2023-01-14 07:56:36 -08:00
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Arrays;
|
|
|
|
import java.util.List;
|
2023-01-19 11:36:49 -08:00
|
|
|
|
2023-01-31 20:40:17 -08:00
|
|
|
import dev.resent.annotation.Module;
|
2023-01-20 13:15:54 -08:00
|
|
|
import dev.resent.module.setting.Setting;
|
2023-02-02 15:03:08 -08:00
|
|
|
import dev.resent.ui.Theme;
|
2023-01-19 11:36:49 -08:00
|
|
|
import dev.resent.util.render.RenderUtils;
|
2023-01-12 14:10:43 -08:00
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
|
2023-02-02 08:07:00 -08:00
|
|
|
public abstract class Mod {
|
2023-01-12 14:10:43 -08:00
|
|
|
|
2023-01-14 07:56:36 -08:00
|
|
|
public Minecraft mc = Minecraft.getMinecraft();
|
|
|
|
public int keyCode;
|
|
|
|
|
|
|
|
public String name;
|
|
|
|
public Category category;
|
|
|
|
public boolean enabled = false;
|
|
|
|
public boolean hasSetting;
|
|
|
|
|
|
|
|
public List<Setting> settings = new ArrayList<>();
|
|
|
|
|
2023-01-31 20:40:17 -08:00
|
|
|
public Mod(){
|
|
|
|
Module modInfo;
|
|
|
|
if(getClass().isAnnotationPresent(Module.class)){
|
|
|
|
modInfo = getClass().getAnnotation(Module.class);
|
|
|
|
this.name = modInfo.name();
|
|
|
|
this.category = modInfo.category();
|
|
|
|
this.hasSetting = modInfo.hasSetting();
|
2023-02-02 08:05:40 -08:00
|
|
|
}
|
2023-01-31 20:40:17 -08:00
|
|
|
}
|
|
|
|
|
2023-01-14 07:56:36 -08:00
|
|
|
public void addSetting(Setting... settings) {
|
|
|
|
this.settings.addAll(Arrays.asList(settings));
|
|
|
|
}
|
|
|
|
|
|
|
|
public void onEnable() {}
|
|
|
|
public void onDisable() {}
|
|
|
|
|
|
|
|
public void toggle() {
|
|
|
|
this.enabled = !this.enabled;
|
|
|
|
if (this.enabled) {
|
|
|
|
onEnable();
|
|
|
|
} else {
|
|
|
|
onDisable();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-19 11:36:49 -08:00
|
|
|
protected void drawRect(int left, int top, int right, int bottom, int color){
|
2023-02-02 08:05:40 -08:00
|
|
|
RenderUtils.drawRoundedRect(left, top, right, bottom, 4, color, Theme.getRounded());
|
2023-01-19 11:36:49 -08:00
|
|
|
}
|
|
|
|
|
2023-01-30 16:41:01 -08:00
|
|
|
protected int drawString(String text, int x, int y, int color, boolean idk){
|
|
|
|
if(color == 6942069){
|
|
|
|
RenderUtils.drawChromaString(text, x, y, idk);
|
|
|
|
}else {
|
|
|
|
Minecraft.getMinecraft().fontRendererObj.drawString(text, x, y, color, idk);
|
|
|
|
}
|
|
|
|
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
2023-01-14 07:56:36 -08:00
|
|
|
public void setEnabled(boolean state) {
|
|
|
|
this.enabled = state;
|
|
|
|
if (this.enabled) onEnable(); else onDisable();
|
|
|
|
}
|
|
|
|
|
2023-02-02 19:18:34 -08:00
|
|
|
public enum Category {
|
|
|
|
HUD("Hud"),
|
|
|
|
MOVEMENT("Movement"),
|
|
|
|
MISC("Misc");
|
|
|
|
|
|
|
|
public final String name;
|
|
|
|
|
|
|
|
Category(String name) {
|
|
|
|
this.name = name;
|
|
|
|
}
|
|
|
|
}
|
2023-01-23 14:45:04 -08:00
|
|
|
|
2023-01-19 11:36:49 -08:00
|
|
|
public boolean isEnabled() { return enabled; }
|
|
|
|
public String getName() { return name; }
|
2023-01-14 07:56:36 -08:00
|
|
|
|
2023-01-12 14:10:43 -08:00
|
|
|
}
|