Mod descriptions

Added description var to Module annotation and had it draw on modules in the rewrite.
This commit is contained in:
ThisIsALegitUsername 2023-04-04 11:53:18 -06:00
parent 7e858b3a02
commit 08237c2382
5 changed files with 21 additions and 13 deletions

View File

@ -9,9 +9,8 @@ import java.lang.annotation.Target;
@Target(ElementType.TYPE) @Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface Module { public @interface Module {
String name() default "placeholder"; String name() default "No name set";
String description() default "No description set.";
Category category() default Category.MISC; Category category() default Category.MISC;
boolean hasSetting() default false; boolean hasSetting() default false;
} }

View File

@ -10,7 +10,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface RenderModule { public @interface RenderModule {
String name(); String name();
String description() default "No description set.";
Category category(); Category category();
int x(); int x();

View File

@ -14,7 +14,7 @@ import net.minecraft.client.Minecraft;
public abstract class Mod { public abstract class Mod {
protected Minecraft mc = Minecraft.getMinecraft(); protected Minecraft mc = Minecraft.getMinecraft();
private String name; private String name, description;
private Category category; private Category category;
private boolean enabled; private boolean enabled;
private boolean hasSetting; private boolean hasSetting;
@ -28,6 +28,7 @@ public abstract class Mod {
if (getClass().isAnnotationPresent(Module.class)) { if (getClass().isAnnotationPresent(Module.class)) {
modInfo = getClass().getAnnotation(Module.class); modInfo = getClass().getAnnotation(Module.class);
this.setName(modInfo.name()); this.setName(modInfo.name());
this.setDescription(modInfo.description());
this.setCategory(modInfo.category()); this.setCategory(modInfo.category());
this.setHasSetting(modInfo.hasSetting()); this.setHasSetting(modInfo.hasSetting());
} }
@ -83,8 +84,10 @@ public abstract class Mod {
public boolean isAdmin() { return admin; } public boolean isAdmin() { return admin; }
public boolean doesHaveSetting() { return hasSetting; } public boolean doesHaveSetting() { return hasSetting; }
public String getName() { return name; } public String getName() { return name; }
public String getDescription() { return description; }
public Category getCategory() { return category; } public Category getCategory() { return category; }
public void setDescription(String description) { this.description = description; }
public void setName(String name) { this.name = name; } public void setName(String name) { this.name = name; }
public void setCategory(Category category) { this.category = category; } public void setCategory(Category category) { this.category = category; }
public void setHasSetting(boolean hasSetting) { this.hasSetting = hasSetting; } public void setHasSetting(boolean hasSetting) { this.hasSetting = hasSetting; }

View File

@ -19,6 +19,7 @@ public abstract class RenderMod extends Mod {
this.setName(modInfo.name()); this.setName(modInfo.name());
this.setCategory(modInfo.category()); this.setCategory(modInfo.category());
this.setHasSetting(modInfo.hasSetting()); this.setHasSetting(modInfo.hasSetting());
this.setDescription(modInfo.description());
this.x = modInfo.x(); this.x = modInfo.x();
this.y = modInfo.y(); this.y = modInfo.y();
} }

View File

@ -60,13 +60,13 @@ public class ClickGuiRewrite extends GuiScreen{
//Search //Search
RenderUtils.drawRoundedRect(x+width-300, y+25, x+width-50, y+65, 9, secondaryColor); RenderUtils.drawRoundedRect(x+width-300, y+25, x+width-50, y+65, 9, secondaryColor);
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.translate(x+width-295, y+36, 0); GlStateManager.translate(x+width-290, y+40, 0);
GlStateManager.scale(2, 2, 1); GlStateManager.scale(1.5f, 1.5f, 1);
GlStateManager.translate(-(x+width-295), -(y+36), 0); GlStateManager.translate(-(x+width-290), -(y+40), 0);
if(searchString.length() > 0) { if(searchString.length() > 0) {
fr.drawString(searchString, x+width-290, y+36, secondaryFontColor, false); fr.drawString(searchString, x+width-290, y+40, secondaryFontColor, false);
}else { }else {
fr.drawString("Search", x+width-290, y+36, new Color(97, 97, 97).getRGB(), false); fr.drawString("Search", x+width-290, y+40, new Color(97, 97, 97).getRGB(), false);
} }
GlStateManager.popMatrix(); GlStateManager.popMatrix();
@ -103,15 +103,21 @@ public class ClickGuiRewrite extends GuiScreen{
//Toggle //Toggle
RenderUtils.drawRoundedRect(x+90, y+125+offset, x+140, y+175+offset, 8, new Color(66, 66, 66).getRGB()); RenderUtils.drawRoundedRect(x+90, y+125+offset, x+140, y+175+offset, 8, new Color(66, 66, 66).getRGB());
GlUtils.startScale(x+90, y+140+offset, 2.5f); GlUtils.startScale(x+90, y+140+offset, 2.5f);
fr.drawString(m.getName(), x+120, y+140+offset, -1, false); fr.drawString(m.getName(), x+120, y+140+offset, -1, false);
GlStateManager.popMatrix(); GlStateManager.popMatrix();
if(isMouseInside(mouseX, mouseY, x+80, y+115+offset, x+width-20, y+185+offset)) {
fr.drawString(m.getDescription(), mouseX+8, mouseY, -1, false);
}
offset+= 80; offset+= 80;
} }
} }
GlUtils.stopScale(); GlStateManager.popMatrix();
if(selectedMod != null){ if(selectedMod != null){
for (Comp comp : comps) { for (Comp comp : comps) {
@ -141,7 +147,6 @@ public class ClickGuiRewrite extends GuiScreen{
for(Mod m : Resent.INSTANCE.modManager.modules){ for(Mod m : Resent.INSTANCE.modManager.modules){
if(selectedMod == null && y+170+offset < y+height && !m.isAdmin() && m.getName().toLowerCase().startsWith(searchString.toLowerCase()) || selectedMod == null && y+170+offset < y+height && EntityRenderer.test) { if(selectedMod == null && y+170+offset < y+height && !m.isAdmin() && m.getName().toLowerCase().startsWith(searchString.toLowerCase()) || selectedMod == null && y+170+offset < y+height && EntityRenderer.test) {
if(isMouseInside(mouseX, mouseY, x+width-60, y+140+offset, x+width-40, y+160+offset) && mouseButton == 0 && m.doesHaveSetting()){ if(isMouseInside(mouseX, mouseY, x+width-60, y+140+offset, x+width-40, y+160+offset) && mouseButton == 0 && m.doesHaveSetting()){
System.out.println("uwu");
for(Setting s : m.settings){ for(Setting s : m.settings){
if(s instanceof BooleanSetting){ if(s instanceof BooleanSetting){
comps.add(new CompCheck(4, 4, selectedMod, s)); comps.add(new CompCheck(4, 4, selectedMod, s));
@ -169,7 +174,7 @@ public class ClickGuiRewrite extends GuiScreen{
width = sr.getScaledWidth()/1.25f; width = sr.getScaledWidth()/1.25f;
height = sr.getScaledHeight()/1.25f; height = sr.getScaledHeight()/1.25f;
introAnimation = Theme.getAnimation(500, 1, 3, 3.8f, 1.35f, false); introAnimation = Theme.getAnimation(500, 1, 3, 3.8f, 1.35f, false);
fr = mc.uwuFont; fr = mc.fontRendererObj;
} }
@Override @Override