Made annotation based module system.

This commit is contained in:
ThisIsALegitUsername 2023-02-01 04:40:17 +00:00
parent bd8c41de18
commit e8ce550cae
7 changed files with 29556 additions and 29492 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -4,6 +4,8 @@ import dev.resent.module.base.ModManager;
public class Resent {
public static boolean hasInit = false;
static {
INSTANCE = new Resent();
}
@ -14,5 +16,6 @@ public class Resent {
public void init() {
Resent.INSTANCE.modManager = new ModManager();
hasInit = true;
}
}

View File

@ -0,0 +1,16 @@
package dev.resent.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import dev.resent.module.base.Category;
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface Module {
String name() default "placeholder";
Category category() default Category.MISC;
boolean hasSetting() default false;
}

View File

@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import dev.resent.annotation.Module;
import dev.resent.module.Theme;
import dev.resent.module.setting.Setting;
import dev.resent.util.render.RenderUtils;
@ -22,6 +23,16 @@ public class Mod {
public List<Setting> settings = new ArrayList<>();
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();
}
}
public Mod(String name, Category cat) {
this.name = name;
this.category = cat;

View File

@ -34,6 +34,7 @@ import dev.resent.module.impl.misc.NoRain;
import dev.resent.module.impl.misc.NoSwingDelay;
import dev.resent.module.impl.misc.Scoreboard;
import dev.resent.module.impl.misc.SelfNametag;
import dev.resent.module.impl.misc.Test;
import dev.resent.module.impl.misc.Tooltips;
import dev.resent.module.impl.movement.Sprint;
import net.minecraft.client.Minecraft;
@ -43,6 +44,7 @@ public class ModManager {
public List<Mod> modules = new ArrayList<>();
public Minecraft mc = Minecraft.getMinecraft();
public static Test test;
public static Cosmetics cosmetics = new Cosmetics();
public static Sprint sprint;
public static CPS cps;
@ -81,6 +83,7 @@ public class ModManager {
public ModManager() {
//Hud
register(test = new Test());
register(cosmetics);
register(hotbar);
register(crystalOptimizer);

View File

@ -0,0 +1,8 @@
package dev.resent.module.impl.misc;
import dev.resent.annotation.Module;
import dev.resent.module.base.Category;
import dev.resent.module.base.Mod;
@Module(name = "Test", category = Category.MISC, hasSetting = false)
public class Test extends Mod{ }