resent-1.8/src/main/java/dev/resent/module/base/Mod.java

81 lines
2.0 KiB
Java
Raw Normal View History

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
import dev.resent.module.Theme;
2023-01-20 13:15:54 -08:00
import dev.resent.module.setting.Setting;
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-01-19 18:43:42 -08:00
import net.minecraft.client.gui.Gui;
2023-01-12 14:10:43 -08:00
public class Mod {
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<>();
public Mod(String name, Category cat) {
this.name = name;
this.category = cat;
}
public Mod(String name, Category cat, boolean hasSetting) {
this.name = name;
this.category = cat;
this.hasSetting = hasSetting;
}
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-01-30 12:26:42 -08:00
if(Theme.getRounded()){
RenderUtils.drawRoundedRect(left, top, right, bottom, 4, color);
}else {
Gui.drawRect(left, top, right, bottom, color);
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-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
}