make hovers for toggles actually render, add module descriptions, move @Description to util

This commit is contained in:
Daniella / Tove 2024-05-27 10:30:41 +02:00
parent 8e9a7715de
commit 454b467577
11 changed files with 16 additions and 13 deletions

View file

@ -7,7 +7,7 @@ import com.baseband.client.BaseBand;
import com.baseband.client.configuration.ConfigHandle;
import com.baseband.client.configuration.Configuration;
import com.baseband.client.module.category.Command;
import com.baseband.client.module.render.HUD;
import com.baseband.client.util.misc.Description;
import com.baseband.client.util.misc.FieldFinder;
import com.baseband.client.util.config.KeyBind;
import com.baseband.client.util.misc.Marker;
@ -121,7 +121,7 @@ public abstract class Feature extends ToggleButton implements SetCommand {
}
BaseBand.registerUpdater(settings.linkWith(this, f).name(config.value()));
if (f.getType() == boolean.class) {
subComponents.add(new ToggleButton(config.value(), settings, config.value()).gate(gate));
subComponents.add(new ToggleButton(config.value(), settings, config.value()).gate(gate).hover(description));
}
if (f.getType() == int.class) {
Range range = f.getDeclaredAnnotation(Range.class);
@ -165,6 +165,10 @@ public abstract class Feature extends ToggleButton implements SetCommand {
handle = settings;
BaseBand.registerUpdater(settings.linkWith(this, FieldFinder.findMarked(Feature.class, 1)).name("Enabled")).populate();
Description description = getClass().getDeclaredAnnotation(Description.class);
if(description != null)
hover(description.value());
setup();
updateEnabled();
}

View file

@ -1,7 +1,7 @@
package com.baseband.client.module.chat;
import com.baseband.client.configuration.annotation.Config;
import com.baseband.client.configuration.annotation.Description;
import com.baseband.client.util.misc.Description;
import com.baseband.client.configuration.annotation.Gate;
import com.baseband.client.event.events.PacketEvent;
import com.baseband.client.gui.lib.component.Button;

View file

@ -1,7 +1,7 @@
package com.baseband.client.module.client;
import com.baseband.client.configuration.annotation.Config;
import com.baseband.client.configuration.annotation.Description;
import com.baseband.client.util.misc.Description;
import com.baseband.client.event.events.PacketEvent;
import com.baseband.client.event.events.PlayerDestroyEvent;
import com.baseband.client.gui.GuiTheme;

View file

@ -1,7 +1,7 @@
package com.baseband.client.module.client;
import com.baseband.client.configuration.annotation.Config;
import com.baseband.client.configuration.annotation.Description;
import com.baseband.client.util.misc.Description;
import com.baseband.client.configuration.annotation.Gate;
import com.baseband.client.configuration.annotation.Range;
import com.baseband.client.event.events.PlayerDestroyEvent;

View file

@ -5,6 +5,7 @@ import com.baseband.client.gui.GuiBBIngame;
import com.baseband.client.module.Feature;
import com.baseband.client.module.category.Combat;
import com.baseband.client.util.ingame.ChatUtil;
import com.baseband.client.util.misc.Description;
import com.baseband.client.util.misc.Marker;
import com.baseband.client.util.ingame.InventoryUtils;
import de.tudbut.tools.Lock;

View file

@ -2,7 +2,7 @@ package com.baseband.client.module.movement;
import com.baseband.client.BaseBand;
import com.baseband.client.configuration.annotation.Config;
import com.baseband.client.configuration.annotation.Description;
import com.baseband.client.util.misc.Description;
import com.baseband.client.configuration.annotation.Gate;
import com.baseband.client.configuration.annotation.Range;
import com.baseband.client.module.Feature;

View file

@ -1,11 +1,11 @@
package com.baseband.client.module.movement;
import com.baseband.client.Setup;
import com.baseband.client.configuration.annotation.*;
import com.baseband.client.event.events.MoveEvent;
import com.baseband.client.event.events.PacketEvent;
import com.baseband.client.module.Feature;
import com.baseband.client.module.category.Movement;
import com.baseband.client.util.misc.Description;
import com.baseband.client.util.misc.Marker;
import com.baseband.client.util.ingame.MotionUtil;
import de.tudbut.tools.Lock;

View file

@ -1,7 +1,7 @@
package com.baseband.client.module.render;
import com.baseband.client.configuration.annotation.Config;
import com.baseband.client.configuration.annotation.Description;
import com.baseband.client.util.misc.Description;
import com.baseband.client.configuration.annotation.Gate;
import com.baseband.client.gui.GuiRewrite;
import com.baseband.client.module.Feature;

View file

@ -7,6 +7,7 @@ import com.baseband.client.module.Category;
import com.baseband.client.module.Feature;
import com.baseband.client.module.category.Render;
import com.baseband.client.module.client.Client;
import com.baseband.client.util.misc.Description;
import com.baseband.client.util.misc.Marker;
import com.baseband.client.util.render.TextSplitter;
import net.minecraft.client.Minecraft;

View file

@ -1,7 +1,7 @@
package com.baseband.client.module.world;
import com.baseband.client.configuration.annotation.Config;
import com.baseband.client.configuration.annotation.Description;
import com.baseband.client.util.misc.Description;
import com.baseband.client.configuration.annotation.Range;
import com.baseband.client.event.events.PacketEvent;
import com.baseband.client.module.Feature;

View file

@ -1,12 +1,9 @@
package com.baseband.client.configuration.annotation;
package com.baseband.client.util.misc;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface Description {
String value();
}