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.Resent;
|
|
|
|
import dev.resent.event.impl.Event;
|
|
|
|
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){
|
|
|
|
switch(Theme.getId()){
|
|
|
|
case 1:
|
|
|
|
RenderUtils.drawRect(left, top, right, bottom, color);
|
2023-01-19 18:43:42 -08:00
|
|
|
case 50:
|
2023-01-20 06:14:42 -08:00
|
|
|
Gui.drawRect(left, top, right, bottom, color);
|
2023-01-19 11:36:49 -08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-01-14 07:56:36 -08:00
|
|
|
public void onEvent(Event e) {
|
|
|
|
for (int i = 0; i < Resent.INSTANCE.modManager.modules.size(); i++) {
|
|
|
|
if (!Resent.INSTANCE.modManager.modules.get(i).isEnabled()) continue;
|
|
|
|
Resent.INSTANCE.modManager.modules.get(i).onEvent(e);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setEnabled(boolean state) {
|
|
|
|
this.enabled = state;
|
|
|
|
if (this.enabled) onEnable(); else onDisable();
|
|
|
|
}
|
|
|
|
|
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
|
|
|
}
|