This commit is contained in:
Jess H 2024-05-27 10:21:39 +01:00
commit 5674d94163
2 changed files with 35 additions and 40 deletions

View file

@ -69,19 +69,16 @@ public class HUD extends Feature {
Left, Center, Right
}
@Config("Notifications")
@Marker(1)
@Gate(Integer.MIN_VALUE)
public boolean notifications = true;
@Config("Include status in length")
@Description("By default, status (greyed out information tucked on the end of module names) is not factored into the sorting. This setting lets you change that.")
public boolean includeStatus = false;
@Config("Notification location")
@Description("Where to display notifications. Left and Right display the most recent at the top, Center displays the most recent at the bottom.")
@Gate(1)
public NotificationLocation nLocation = NotificationLocation.Center;
@Config("Advanced")
@Description("Show rendering controls for notifications.")
@Gate(1)
@Marker(2)
public boolean advancedNotifs = false;
@ -132,47 +129,45 @@ public class HUD extends Feature {
mc.fontRenderer.drawStringWithShadow("§lBaseBand§r - \"" + BaseBand.buildString + "\"", 2,2, BaseBand.getFeature(Client.class).getTheme().getGreenColor());
int y = 11;
for (Feature f : Arrays.stream(features).filter(m -> m.enabled && m.category != Category.COMMAND && m.getClass() != Client.class && m != this).sorted(Comparator.comparingDouble(value -> -Minecraft.getMinecraft().fontRenderer.getStringWidth(value.toString()))).toArray(Feature[]::new)) {
for (Feature f : Arrays.stream(features).filter(m -> m.enabled && m.category != Category.COMMAND && m.getClass() != Client.class && m != this).sorted(Comparator.comparingDouble(value -> -Minecraft.getMinecraft().fontRenderer.getStringWidth(includeStatus ? value.text : value.toString()))).toArray(Feature[]::new)) {
mc.fontRenderer.drawStringWithShadow(f.text, 2, y, BaseBand.getFeature(Client.class).getTheme().getGreenColor());
y = y + mc.fontRenderer.FONT_HEIGHT;
}
if(notifications) {
int dir = (nLocation == NotificationLocation.Center ? -1 : 1);
int isCenter = (nLocation == NotificationLocation.Center ? 1 : 0);
int xSize = this.nSize * 100;
int ySize = this.nVSize * 10;
int textOffset = (ySize / 2 - (mc.fontRenderer.FONT_HEIGHT / 2));
int x = 2;
if(nLocation == NotificationLocation.Center) {
x = sr.getScaledWidth() / 2 - (xSize / 2);
y = sr.getScaledHeight() / 4;
} else {
if(nLocation == NotificationLocation.Right) {
y = -5;
x = sr.getScaledWidth() - x - xSize;
}
y += 5;
y += nVSpace;
int dir = (nLocation == NotificationLocation.Center ? -1 : 1);
int isCenter = (nLocation == NotificationLocation.Center ? 1 : 0);
int xSize = this.nSize * 100;
int ySize = this.nVSize * 10;
int textOffset = (ySize / 2 - (mc.fontRenderer.FONT_HEIGHT / 2));
int x = 2;
if(nLocation == NotificationLocation.Center) {
x = sr.getScaledWidth() / 2 - (xSize / 2);
y = sr.getScaledHeight() / 4;
} else {
if(nLocation == NotificationLocation.Right) {
y = -5;
x = sr.getScaledWidth() - x - xSize;
}
y += 5;
y += nVSpace;
}
Notification[] notifs = HUD.notifs.toArray(new Notification[0]);
for (int i = notifs.length - 1; i >= 0; i--) {
Notification notif = notifs[i];
int localYSize = ySize;
Notification[] notifs = HUD.notifs.toArray(new Notification[0]);
for (int i = notifs.length - 1; i >= 0; i--) {
Notification notif = notifs[i];
int localYSize = ySize;
String text = TextSplitter.breakText(notif.text, xSize - textOffset * 2);
localYSize -= TextSplitter.getStringHeight(text) - mc.fontRenderer.FONT_HEIGHT;
String text = TextSplitter.breakText(notif.text, xSize - textOffset * 2);
localYSize -= TextSplitter.getStringHeight(text) - mc.fontRenderer.FONT_HEIGHT;
int textboxYSize = localYSize;
localYSize = notif.opacity(localYSize, 1);
int textboxYSize = localYSize;
localYSize = notif.opacity(localYSize, 1);
drawSizedBox(x, y, xSize, localYSize, 0x202040 + (notif.opacity(0x80, 1) << 24), isCenter == 1);
GlStateManager.enableBlend();
renderSplit(text, x + textOffset, y + textOffset - isCenter * textboxYSize, 0xffffff + (Math.max(8, notif.opacity(0xff, 2)) << 24), notif.opacity(2) == 1.0);
GlStateManager.disableBlend();
y += (localYSize + nVSpace) * dir;
}
drawSizedBox(x, y, xSize, localYSize, 0x202040 + (notif.opacity(0x80, 1) << 24), isCenter == 1);
GlStateManager.enableBlend();
renderSplit(text, x + textOffset, y + textOffset - isCenter * textboxYSize, 0xffffff + (Math.max(8, notif.opacity(0xff, 2)) << 24), notif.opacity(2) == 1.0);
GlStateManager.disableBlend();
y += (localYSize + nVSpace) * dir;
}
}

View file

@ -17,8 +17,8 @@ public class Ping extends Feature {
@Config("Seconds")
@Description("How many seconds to add to your ping.\n" +
"§lWarning§r: You might get timed out on high settings (Time-out happens at 30 seconds including real ping).")
@Range("0..28")
"§lWarning§r: You might get timed out on high settings (Time-out happens at 15 seconds including real ping).")
@Range("0..14")
public int seconds;
@Override