Skip to content

Commit fbe45ca

Browse files
committed
Updated AltGUI, AltManager, PlayerESP, SpearAssist and AutoFly
1 parent fc0a052 commit fbe45ca

7 files changed

Lines changed: 573 additions & 66 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,8 @@ Examples:
10231023
- Added toggle for unique colors for each player (shared with Breadcrumbs)
10241024
- Added box fill with transparency slider
10251025
- Added static color option
1026+
- Added rainbow color option
1027+
- Added much thicker tracer lines (max 10px)
10261028
- Added glow outlines as an option
10271029
- Added Line of Sight Detection (LOS)
10281030
- When you're spotted ESP and tracer will turn a bold red regardless of distance or color settings

src/main/java/net/wurstclient/altgui/AltGuiScreen.java

Lines changed: 105 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -200,12 +200,12 @@ private int getSearchHeight()
200200

201201
private float getRightSettingsWidthScale()
202202
{
203-
return Math.max(0.2F, cfg().getSettingsWidth());
203+
return Math.max(0.05F, cfg().getSettingsWidth());
204204
}
205205

206206
private float getRightSettingsHeightScale()
207207
{
208-
return Math.max(0.2F, cfg().getSettingsHeight());
208+
return Math.max(0.05F, cfg().getSettingsHeight());
209209
}
210210

211211
private int scaleRightSettingWidth(int value)
@@ -218,6 +218,13 @@ private int scaleRightSettingHeight(int value)
218218
return Math.max(1, Math.round(value * getRightSettingsHeightScale()));
219219
}
220220

221+
private int getMinimumReadableUiRowHeight()
222+
{
223+
Font font = minecraft != null ? minecraft.font : null;
224+
int textH = font == null ? 9 : Math.max(1, scaledFontHeight(font));
225+
return Math.max(10, textH + 2);
226+
}
227+
221228
private int getSettingsValueColumnWidth(int rowX1, int rowX2)
222229
{
223230
int min = scaleRightSettingWidth(120);
@@ -348,7 +355,7 @@ public void render(GuiGraphics context, int mouseX, int mouseY,
348355
hoverTooltip = "";
349356
syncFontManager();
350357
int bg =
351-
withAlpha(cfg().getBackgroundColor(), cfg().getUiOpacity() * 0.86F);
358+
withAlpha(cfg().getBackgroundColor(), cfg().getBackgroundOpacity());
352359
int panel = withAlpha(cfg().getPanelColor(), cfg().getUiOpacity());
353360

354361
context.fill(0, 0, width, height, bg);
@@ -362,13 +369,49 @@ public void render(GuiGraphics context, int mouseX, int mouseY,
362369

363370
if(searchBox != null)
364371
{
365-
searchBox.setTextColor(cfg().getTextColor());
366-
searchBox.render(context, mouseX, mouseY, partialTicks);
372+
renderSearchBoxText(context);
367373
}
368374

369375
renderTooltip(context);
370376
}
371377

378+
private void renderSearchBoxText(GuiGraphics context)
379+
{
380+
if(searchBox == null)
381+
return;
382+
383+
Font font = minecraft.font;
384+
int x1 = searchBox.getX();
385+
int y1 = searchBox.getY();
386+
int x2 = x1 + searchBox.getWidth();
387+
int y2 = y1 + searchBox.getHeight();
388+
int padX =
389+
Math.max(6, Math.round(4F * Math.max(0.25F, cfg().getFontScale())));
390+
int textY = centeredTextY(font, y1, y2);
391+
int maxTextW = Math.max(1, (x2 - x1) - padX * 2);
392+
393+
String value = searchBox.getValue();
394+
boolean focused = searchBox.isFocused();
395+
boolean empty = value == null || value.isBlank();
396+
String baseText =
397+
empty && !focused ? "search" : (value == null ? "" : value);
398+
String drawText = trimToWidth(font, baseText, maxTextW);
399+
int textColor = empty && !focused ? cfg().getMutedTextColor()
400+
: cfg().getTextColor();
401+
402+
drawStringScaled(context, font, drawText, x1 + padX, textY, textColor,
403+
false);
404+
405+
if(focused && (minecraft.gui.getGuiTicks() / 6) % 2 == 0)
406+
{
407+
int caretX = x1 + padX + scaledFontWidth(font, drawText);
408+
int caretTop = textY;
409+
int caretBottom = textY + Math.max(1, scaledFontHeight(font));
410+
context.fill(caretX, caretTop, caretX + 1, caretBottom,
411+
withAlpha(cfg().getTextColor(), cfg().getUiOpacity()));
412+
}
413+
}
414+
372415
private void renderHeader(GuiGraphics context)
373416
{
374417
Font font = minecraft.font;
@@ -668,7 +711,6 @@ private void renderSettingRow(GuiGraphics context, Font font, int mouseX,
668711

669712
if(!valueText.isEmpty())
670713
{
671-
valueText = trimToWidth(font, valueText, valueBoxW - valuePad * 2);
672714
int valuePadY = getPillPadding(font, y2 - y1);
673715
int valueY1 = y1 + valuePadY;
674716
int valueY2 = y2 - valuePadY;
@@ -705,8 +747,8 @@ && cfg().isFillColorValuesEnabled())
705747
context.fill(valueX1, valueY1, valueX2, valueY2,
706748
getValueBadgeColor(row.setting(), valueText));
707749
}
708-
drawCenteredStringScaledInBox(context, font, valueText, valueX1,
709-
valueY1, valueX2, valueY2, valueTextColor);
750+
drawMarqueeStringScaledInBox(context, font, valueText, valueX1,
751+
valueY1, valueX2, valueY2, valueTextColor, valuePad);
710752

711753
if(row.setting() instanceof ColorSetting color
712754
&& !cfg().isFillColorValuesEnabled())
@@ -743,6 +785,8 @@ private void renderUiSettingsPanel(GuiGraphics context, int mouseX,
743785
int y = uiMenuY + 24;
744786
y = renderUiSlider(context, font, "UI opacity",
745787
cfg().getUiOpacitySetting(), y, mouseX, mouseY);
788+
y = renderUiSlider(context, font, "Background opacity",
789+
cfg().getBackgroundOpacitySetting(), y, mouseX, mouseY);
746790
y = renderUiSlider(context, font, "Settings width",
747791
cfg().getSettingsWidthSetting(), y, mouseX, mouseY);
748792
y = renderUiSlider(context, font, "Settings height",
@@ -796,7 +840,8 @@ private void renderUiSettingsPanel(GuiGraphics context, int mouseX,
796840
private int renderUiSlider(GuiGraphics context, Font font, String label,
797841
SliderSetting slider, int y, int mouseX, int mouseY)
798842
{
799-
int rowH = scaleRightSettingHeight(14);
843+
int rowH = Math.max(getMinimumReadableUiRowHeight(),
844+
scaleRightSettingHeight(14));
800845
int x1 = uiMenuX + 8;
801846
int x2 = uiMenuX + uiMenuW - 8;
802847
int trackX1 = uiMenuX + scaleRightSettingWidth(144);
@@ -820,7 +865,8 @@ private int renderUiSlider(GuiGraphics context, Font font, String label,
820865
private int renderUiToggle(GuiGraphics context, Font font, String label,
821866
CheckboxSetting setting, int y, int mouseX, int mouseY)
822867
{
823-
int rowH = scaleRightSettingHeight(14);
868+
int rowH = Math.max(getMinimumReadableUiRowHeight(),
869+
scaleRightSettingHeight(14));
824870
int x1 = uiMenuX + 8;
825871
int x2 = uiMenuX + uiMenuW - 8;
826872
boolean hovered = isInside(mouseX, mouseY, x1, y, x2, y + rowH);
@@ -846,7 +892,8 @@ private int renderUiToggle(GuiGraphics context, Font font, String label,
846892
private int renderUiColor(GuiGraphics context, Font font, String label,
847893
ColorSetting color, int y, int mouseX, int mouseY)
848894
{
849-
int rowH = scaleRightSettingHeight(13);
895+
int rowH = Math.max(getMinimumReadableUiRowHeight(),
896+
scaleRightSettingHeight(13));
850897
int x1 = uiMenuX + 8;
851898
int x2 = uiMenuX + uiMenuW - 8;
852899
boolean hovered = isInside(mouseX, mouseY, x1, y, x2, y + rowH);
@@ -874,6 +921,8 @@ private boolean handleUiSettingsClick(double mouseX, double mouseY,
874921
int y = uiMenuY + 24;
875922
y = handleUiSliderClick(cfg().getUiOpacitySetting(), mouseX, mouseY, y,
876923
button);
924+
y = handleUiSliderClick(cfg().getBackgroundOpacitySetting(), mouseX,
925+
mouseY, y, button);
877926
y = handleUiSliderClick(cfg().getSettingsWidthSetting(), mouseX, mouseY,
878927
y, button);
879928
y = handleUiSliderClick(cfg().getSettingsHeightSetting(), mouseX,
@@ -927,7 +976,8 @@ private boolean handleUiSettingsClick(double mouseX, double mouseY,
927976
private int handleUiSliderClick(SliderSetting slider, double mouseX,
928977
double mouseY, int y, int button)
929978
{
930-
int rowH = scaleRightSettingHeight(14);
979+
int rowH = Math.max(getMinimumReadableUiRowHeight(),
980+
scaleRightSettingHeight(14));
931981
int x1 = uiMenuX + 8;
932982
int x2 = uiMenuX + uiMenuW - 8;
933983
int trackX1 = uiMenuX + scaleRightSettingWidth(144);
@@ -950,7 +1000,8 @@ private int handleUiSliderClick(SliderSetting slider, double mouseX,
9501000
private int handleUiColorClick(ColorSetting setting, double mouseX,
9511001
double mouseY, int y)
9521002
{
953-
int rowH = scaleRightSettingHeight(13);
1003+
int rowH = Math.max(getMinimumReadableUiRowHeight(),
1004+
scaleRightSettingHeight(13));
9541005
int x1 = uiMenuX + 8;
9551006
int x2 = uiMenuX + uiMenuW - 8;
9561007
if(isInside(mouseX, mouseY, x1, y, x2, y + rowH))
@@ -961,7 +1012,8 @@ private int handleUiColorClick(ColorSetting setting, double mouseX,
9611012
private int handleUiToggleClick(CheckboxSetting setting, double mouseX,
9621013
double mouseY, int y)
9631014
{
964-
int rowH = scaleRightSettingHeight(14);
1015+
int rowH = Math.max(getMinimumReadableUiRowHeight(),
1016+
scaleRightSettingHeight(14));
9651017
int x1 = uiMenuX + 8;
9661018
int x2 = uiMenuX + uiMenuW - 8;
9671019
if(isInside(mouseX, mouseY, x1, y, x2, y + rowH))
@@ -1620,7 +1672,7 @@ private void appendSettingRows(List<SettingRow> rows, Feature owner,
16201672
? Math.max(4,
16211673
Math.round(cfg().getRowHeight()
16221674
* getRightSettingsHeightScale() / 2F))
1623-
: Math.max(12, Math.round(
1675+
: Math.max(cfg().getMinimumRowHeight(), Math.round(
16241676
cfg().getRowHeight() * getRightSettingsHeightScale()));
16251677
rows.add(new SettingRow(owner, setting, depth, h));
16261678

@@ -1805,6 +1857,7 @@ private String normalizeDisplayValue(String value)
18051857
private boolean isStyleSlider(SliderSetting slider)
18061858
{
18071859
return slider == cfg().getUiOpacitySetting()
1860+
|| slider == cfg().getBackgroundOpacitySetting()
18081861
|| slider == cfg().getTooltipOpacitySetting()
18091862
|| slider == cfg().getSettingsWidthSetting()
18101863
|| slider == cfg().getSettingsHeightSetting()
@@ -2006,6 +2059,43 @@ private void drawCenteredStringScaledInBox(GuiGraphics context, Font font,
20062059
drawStringScaled(context, font, text, x, y, color, false);
20072060
}
20082061

2062+
private void drawMarqueeStringScaledInBox(GuiGraphics context, Font font,
2063+
String text, int x1, int y1, int x2, int y2, int color, int padX)
2064+
{
2065+
if(text == null || text.isEmpty())
2066+
return;
2067+
2068+
int innerX1 = x1 + Math.max(0, padX);
2069+
int innerX2 = x2 - Math.max(0, padX);
2070+
if(innerX2 <= innerX1)
2071+
return;
2072+
2073+
int innerW = innerX2 - innerX1;
2074+
int textW = Math.max(1, scaledFontWidth(font, text));
2075+
int textH = Math.max(1, scaledFontHeight(font));
2076+
int y = Math.round((y1 + y2) * 0.5F - textH * 0.5F);
2077+
2078+
if(textW <= innerW)
2079+
{
2080+
int x = Math.round((x1 + x2) * 0.5F - textW * 0.5F);
2081+
drawStringScaled(context, font, text, x, y, color, false);
2082+
return;
2083+
}
2084+
2085+
int overflow = textW - innerW;
2086+
int ticks = minecraft != null && minecraft.gui != null
2087+
? minecraft.gui.getGuiTicks()
2088+
: (int)(System.currentTimeMillis() / 50L);
2089+
float cycle = 220F;
2090+
float phase = (ticks % (int)cycle) / cycle;
2091+
float pingPong = phase <= 0.5F ? phase * 2F : (1F - phase) * 2F;
2092+
int x = innerX1 - Math.round(overflow * pingPong);
2093+
2094+
context.enableScissor(innerX1, y1, innerX2, y2);
2095+
drawStringScaled(context, font, text, x, y, color, false);
2096+
context.disableScissor();
2097+
}
2098+
20092099
@Override
20102100
public void renderBackground(GuiGraphics context, int mouseX, int mouseY,
20112101
float deltaTicks)

0 commit comments

Comments
 (0)