add meta as own field

This commit is contained in:
Daniella / Tove 2024-06-15 12:06:27 +02:00
parent ba04f54db6
commit 523fe78c25
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
13 changed files with 32 additions and 58 deletions

View file

@ -35,7 +35,6 @@ public abstract class Feature extends ToggleButton implements SetCommand {
public static final int M_ENABLED = MARKER_PREFIX + 1;
protected de.com.baseband.client.Setup Setup;
protected Minecraft mc;
public Category category;
@ -43,6 +42,8 @@ public abstract class Feature extends ToggleButton implements SetCommand {
@Marker(M_ENABLED)
public boolean enabled = defaultEnable();
public String meta = null;
public Feature() {
super("Uninit", null, "Enabled");
this.setLambda(this::updateEnabled);
@ -296,4 +297,8 @@ public abstract class Feature extends ToggleButton implements SetCommand {
public boolean renderInHUD() {
return true;
}
public String getHUDText() {
return text + (meta != null ? " §7[" + meta + "]" : "");
}
}

View file

@ -71,7 +71,6 @@ public class PvpInfo extends Feature {
@Override
public void onDisable() {
text = "PvpInfo";
names.clear();
newnames.clear();
popList.clear();

View file

@ -32,7 +32,7 @@ public class Baritone extends Feature {
public void onTick() {
IBaritoneProcess baritoneProcess = BaritoneManager.getBaritone().getPathingControlManager().mostRecentInControl().orElse(null);
text = "Baritone §7[" + (baritoneProcess == null ? "Idle" : baritoneProcess.displayName()) + "]";
meta = (baritoneProcess == null ? "Idle" : baritoneProcess.displayName());
}
public void onSelect(SelectEvent event) {

View file

@ -36,9 +36,10 @@ public class Spotify extends Feature {
}
if (api.isConnected() && api.hasPosition() && api.hasTrack() && enabled && renderInHUD) {
text = this + "§7 [" + api.getTrack().getName() + " - " + api.getTrack().getArtist() + " (" + new SimpleDateFormat("mm:ss").format(new Date(api.getPosition())) + "/" + new SimpleDateFormat("mm:ss").format(new Date(api.getTrack().getLength())) + ")]";
} else {
text = toString();
meta = api.getTrack().getName() + " - " + api.getTrack().getArtist() + " (" + new SimpleDateFormat("mm:ss").format(new Date(api.getPosition())) + "/" + new SimpleDateFormat("mm:ss").format(new Date(api.getTrack().getLength())) + ")";
}
else {
meta = null;
}
}

View file

@ -59,7 +59,7 @@ public class Timer extends Feature {
@Override
public void onDisable() {
setGameTimer(20);
text = "Timer";
meta = null;
multiplierLock = null;
}
@ -102,7 +102,7 @@ public class Timer extends Feature {
private void tickTimer() {
if (timerLock) {
text = "Timer" + (enabled ? " §7[LOCKED]" : "");
meta = (enabled ? "LOCKED" : null);
if(multiplierLock != null) {
setGameTimer(multiplierLock);
}
@ -116,7 +116,7 @@ public class Timer extends Feature {
}
float t = (adjust ? tps : 20) * m;
setGameTimer(t);
text = "Timer" + (enabled ? "§7 [TPS: " + (Math.round(t * 100f) / 100f) + "]" : "");
meta = (enabled ? "TPS: " + (Math.round(t * 100f) / 100f) : null);
}
}

View file

@ -140,9 +140,9 @@ public class AutoTotem extends Feature {
//Hot
if(enabled && renderTotemCountModuleList && !notIngame()) {
text = this + "§7 [" + getTotemCount() + "]";
meta = String.valueOf(getTotemCount());
} else {
text = toString();
meta = null;
}
switch (mode) {

View file

@ -115,9 +115,9 @@ public class ElytraFly extends Feature {
@Override
public void onEveryTick() {
if (blockMovement) {
text = this + "§7 [Locked]";
meta = "Locked";
} else {
text = toString();
meta = null;
}
}

View file

@ -21,17 +21,9 @@ public class Bright extends Feature {
Gamma,
}
@Override
public void onEveryTick() {
if (enabled && !notIngame()) {
text = this + "§7 [" + mode.toString() + "]";
} else {
text = toString();
}
}
@Override
public void onTick() {
meta = mode.toString();
switch (mode) {
case Gamma:
mc.gameSettings.gammaSetting = 100f;

View file

@ -227,7 +227,7 @@ public class HUD extends Feature {
int maxWidth = TextSplitter.getStringWidth(initString);
Feature[] renderFeatures = Arrays.stream(Features.features).filter(m -> m.enabled && m.category != Category.COMMAND && m.getClass() != Client.class && m != this && m.renderInHUD()).sorted(Comparator.comparingDouble(value -> -Minecraft.getMinecraft().fontRenderer.getStringWidth(includeStatus ? value.text : value.toString()))).toArray(Feature[]::new);
for (Feature f : renderFeatures) {
maxWidth = Math.max(mc.fontRenderer.getStringWidth(f.text), maxWidth);
maxWidth = Math.max(mc.fontRenderer.getStringWidth(f.getHUDText()), maxWidth);
}
if(background) {
@ -237,7 +237,7 @@ public class HUD extends Feature {
TextSplitter.drawString(initString, 3,3, theme.getGreenColor(), textShadow, false);
int y = 3 + TextSplitter.getStringHeight(initString);
for (Feature f : renderFeatures) {
mc.fontRenderer.drawString(f.text, 3, y, hashColor ? f.getHashColor() : theme.getGreenColor(), textShadow);
mc.fontRenderer.drawString(f.getHUDText(), 3, y, hashColor ? f.getHashColor() : theme.getGreenColor(), textShadow);
y = y + mc.fontRenderer.FONT_HEIGHT;
}
@ -333,14 +333,9 @@ public class HUD extends Feature {
return false;
}
@Override
public void onDisable() {
text = toString();
}
@Override
public void onTick() {
text = "ShowTPS" + (enabled ? " §7[TPS: " + (Math.round(ServerDataManager.tps * 100f) / 100f) + "]" : "");
meta = "TPS: " + (Math.round(ServerDataManager.tps * 100f) / 100f);
}
@Override

View file

@ -33,17 +33,9 @@ public class AutoEat extends Feature {
return "AutoEat";
}
@Override
public void onEveryTick() {
if(enabled) {
text = this + "§7 [" + (eating ? "Eating" : "Idle") + "]";
} else {
text = toString();
}
}
@Override
public void onTick() {
meta = (eating ? "Eating" : "Idle");
if (eating && !mc.player.isHandActive()) {
if (lastSlot != -1) {
mc.player.inventory.currentItem = lastSlot;

View file

@ -31,19 +31,15 @@ public class FastBreak extends Feature {
}
@Override
public void onEveryTick() {
//Hot
if (enabled && !notIngame()) {
if(noBreakDelay) {
((IPlayerControllerMP) (mc.playerController)).setBlockHitDelay(0);
}
text = this + "§7 [" + mode.toString() + "]";
} else {
text = toString();
public void onTick() {
if(notIngame())
return;
if(noBreakDelay) {
((IPlayerControllerMP) (mc.playerController)).setBlockHitDelay(0);
}
meta = mode.toString();
}
public void damageBlock(DamageBlockEvent event) {
if(noBreakDelay) {
((IPlayerControllerMP) (mc.playerController)).setBlockHitDelay(0);

View file

@ -28,7 +28,7 @@ public class Ping extends Feature {
@Override
public void onEveryTick() {
text = "Ping" + (enabled ? " §7[" + seconds + "s: " + totalRecieved + (holder == null ? "" : "§cH§7") + "]" : "");
meta = seconds + "s: " + totalRecieved + (holder == null ? "" : "§cH§7");
}
@Override
@ -40,7 +40,6 @@ public class Ping extends Feature {
}
public void onDisable() {
text = "Ping";
totalRecieved = 0;
}

View file

@ -36,14 +36,9 @@ public class Select extends Feature {
@Override
public void onTick() {
if(selection != null)
text = this + "§7 [" + selection.area() + " Blocks]";
meta = selection.area() + " Blocks";
else
text = this + "§7 [0 Blocks]";
}
@Override
public void onDisable() {
text = this.toString();
meta = "0 Blocks";
}
@Override