add hiding in active modules

This commit is contained in:
Bella 2019-12-13 12:14:21 -05:00
parent 0f054328ae
commit 6348490a78
4 changed files with 29 additions and 14 deletions

View File

@ -58,18 +58,20 @@ public class KamiActiveModulesUI extends AbstractComponentUI<ActiveModules> {
}
mods.stream().forEach(module -> {
int rgb = Color.HSBtoRGB(hue[0], 1, 1);
String s = module.getHudInfo();
String text = module.getName() + (s == null ? "" : " " + Command.SECTIONSIGN() + "7" + s);
int textwidth = renderer.getStringWidth(text);
int textheight = renderer.getFontHeight() + 1;
int red = (rgb >> 16) & 0xFF;
int green = (rgb >> 8) & 0xFF;
int blue = rgb & 0xFF;
if (module.showOnArray) {
int rgb = Color.HSBtoRGB(hue[0], 1, 1);
String s = module.getHudInfo();
String text = module.getName() + (s == null ? "" : " " + Command.SECTIONSIGN() + "7" + s);
int textwidth = renderer.getStringWidth(text);
int textheight = renderer.getFontHeight() + 1;
int red = (rgb >> 16) & 0xFF;
int green = (rgb >> 8) & 0xFF;
int blue = rgb & 0xFF;
renderer.drawStringWithShadow(xFunc.apply(textwidth), y[0], red, green, blue, text);
hue[0] += .02f;
y[0] += textheight;
renderer.drawStringWithShadow(xFunc.apply(textwidth), y[0], red, green, blue, text);
hue[0] += .02f;
y[0] += textheight;
}
});
component.setHeight(y[0]);

View File

@ -19,7 +19,7 @@ import java.util.List;
/**
* Created by 086 on 23/08/2017.
* Updated and fixed by cookiedragon234 on 27/10/19
* Updated by S-B99 on 13/12/19
*/
public class Module {
@ -30,6 +30,7 @@ public class Module {
private Setting<Bind> bind = register(Settings.custom("Bind", Bind.none(), new BindConverter()).build());
private Setting<Boolean> enabled = register(Settings.booleanBuilder("Enabled").withVisibility(aBoolean -> false).withValue(false).build());
public boolean alwaysListening;
public boolean showOnArray = getAnnotation().showOnArray();
protected static final Minecraft mc = Minecraft.getMinecraft();
public List<Setting> settingList = new ArrayList<>();
@ -109,6 +110,8 @@ public class Module {
Module.Category category();
boolean alwaysListening() default false;
boolean showOnArray() default true;
}
public String getName() {

View File

@ -4,7 +4,11 @@ import me.zeroeightsix.kami.module.Module;
import me.zeroeightsix.kami.setting.Setting;
import me.zeroeightsix.kami.setting.Settings;
@Module.Info(name = "GUI Scale", category = Module.Category.GUI, description = "Configures size of GUI")
/***
* @author S-B99
* Created by S-B99 on 09/12/19
*/
@Module.Info(name = "GUI Scale", category = Module.Category.GUI, description = "Configures size of GUI", showOnArray = false)
public class GUIScale extends Module {
private Setting<Integer> scaleGlobal = this.register(Settings.integerBuilder("Scale").withMinimum(1).withValue(2).withMaximum(3).build());

View File

@ -9,8 +9,14 @@ import me.zeroeightsix.kami.setting.Settings;
* Created by S-B99 on 04/12/19
*/
@Module.Info(name = "InfoOverlay", category = Module.Category.GUI, description = "Configures game information overlay")
@Module.Info(
name = "InfoOverlay",
category = Module.Category.GUI,
description = "Configures game information overlay",
showOnArray = false
)
public class InfoOverlay extends Module {
public Setting<Boolean> globalInfoNam = register(Settings.b("Username", true));
public Setting<Boolean> globalInfoTps = register(Settings.b("TPS", true));
public Setting<Boolean> globalInfoFps = register(Settings.b("FPS", true));