Начинающий
- Статус
- Оффлайн
- Регистрация
- 7 Мар 2025
- Сообщения
- 96
- Реакции
- 2
- Выберите загрузчик игры
- Vanilla
шрифты калл с норм шрифтами вроде вкусно будет столько много говно кода потомучто сокращение название биндов находятся прям в функции ну хз может даже и +
SS -
Code -
SS -
Code -
сарделька:
package dev.sk3d.display.hud;
import dev.sk3d.Hawen;
import dev.sk3d.common.animation.implement.EaseOut;
import dev.sk3d.common.animation.implement.Decelerate;
import dev.sk3d.features.impl.render.Hud;
import dev.sk3d.features.module.Module;
import dev.sk3d.utils.interactions.interact.PlayerInteractionHelper;
import dev.sk3d.utils.theme.ThemeManager;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.util.math.MatrixStack;
import dev.sk3d.utils.client.managers.api.draggable.AbstractDraggable;
import dev.sk3d.utils.display.render.font.FontRenderer;
import dev.sk3d.utils.display.render.font.Fonts;
import dev.sk3d.utils.display.render.shape.ShapeProperties;
import dev.sk3d.utils.display.color.ColorAssist;
import dev.sk3d.common.animation.Animation;
import org.lwjgl.glfw.GLFW;
import java.util.*;
public class Keybinds extends AbstractDraggable {
private final Animation visibleAnimation = new Decelerate().setMs(200).setValue(0);
public Keybinds() {
super("Keybinds", 300, 40, 140, 100, true);
this.scaleAnimation = new EaseOut().setValue(1).setMs(100);
}
@Override
public boolean visible() {
List<Module> activeModules = getActiveModulesWithBinds();
return !activeModules.isEmpty() || PlayerInteractionHelper.isChat(mc.currentScreen);
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
if (button == 0) {
FontRenderer HAWENFont = Fonts.getSize(14, Fonts.Type.HAWEN);
float pX = getX() + getWidth() - HAWENFont.getStringWidth("p") - 10;
float pY = getY() + 10f;
float pWidth = HAWENFont.getStringWidth("p");
float pHeight = HAWENFont.getStringHeight("p");
if (mouseX >= pX && mouseX <= pX + pWidth && mouseY >= pY && mouseY <= pY + pHeight) {
List<String> selected = new ArrayList<>(Hud.getInstance().interfaceSettings.getSelected());
selected.remove("Keybinds");
Hud.getInstance().interfaceSettings.setSelected(selected);
return true;
}
}
return super.mouseClicked(mouseX, mouseY, button);
}
@Override
public void tick() {
List<Module> activeModules = getActiveModulesWithBinds();
visibleAnimation.setValue(activeModules.isEmpty() && !PlayerInteractionHelper.isChat(mc.currentScreen) ? 0 : 1);
}
private List<Module> getActiveModulesWithBinds() {
List<Module> result = new ArrayList<>();
if (Hawen.getInstance() != null && Hawen.getInstance().getModuleRepository() != null) {
for (Module module : Hawen.getInstance().getModuleRepository().modules()) {
if (module.isState() &&
module.getKey() != GLFW.GLFW_KEY_UNKNOWN &&
!module.getName().equalsIgnoreCase("ClickGui") &&
!module.getName().equalsIgnoreCase("Hud")) {
result.add(module);
}
}
}
return result;
}
private String getKeyName(int keyCode) {
if (keyCode == GLFW.GLFW_KEY_UNKNOWN) {
return "NONE";
}
return switch (keyCode) {
case GLFW.GLFW_KEY_A -> "A";
case GLFW.GLFW_KEY_B -> "B";
case GLFW.GLFW_KEY_C -> "C";
case GLFW.GLFW_KEY_D -> "D";
case GLFW.GLFW_KEY_E -> "E";
case GLFW.GLFW_KEY_F -> "F";
case GLFW.GLFW_KEY_G -> "G";
case GLFW.GLFW_KEY_H -> "H";
case GLFW.GLFW_KEY_I -> "I";
case GLFW.GLFW_KEY_J -> "J";
case GLFW.GLFW_KEY_K -> "K";
case GLFW.GLFW_KEY_L -> "L";
case GLFW.GLFW_KEY_M -> "M";
case GLFW.GLFW_KEY_N -> "N";
case GLFW.GLFW_KEY_O -> "O";
case GLFW.GLFW_KEY_P -> "P";
case GLFW.GLFW_KEY_Q -> "Q";
case GLFW.GLFW_KEY_R -> "R";
case GLFW.GLFW_KEY_S -> "S";
case GLFW.GLFW_KEY_T -> "T";
case GLFW.GLFW_KEY_U -> "U";
case GLFW.GLFW_KEY_V -> "V";
case GLFW.GLFW_KEY_W -> "W";
case GLFW.GLFW_KEY_X -> "X";
case GLFW.GLFW_KEY_Y -> "Y";
case GLFW.GLFW_KEY_Z -> "Z";
case GLFW.GLFW_KEY_0 -> "0";
case GLFW.GLFW_KEY_1 -> "1";
case GLFW.GLFW_KEY_2 -> "2";
case GLFW.GLFW_KEY_3 -> "3";
case GLFW.GLFW_KEY_4 -> "4";
case GLFW.GLFW_KEY_5 -> "5";
case GLFW.GLFW_KEY_6 -> "6";
case GLFW.GLFW_KEY_7 -> "7";
case GLFW.GLFW_KEY_8 -> "8";
case GLFW.GLFW_KEY_9 -> "9";
case GLFW.GLFW_KEY_F1 -> "F1";
case GLFW.GLFW_KEY_F2 -> "F2";
case GLFW.GLFW_KEY_F3 -> "F3";
case GLFW.GLFW_KEY_F4 -> "F4";
case GLFW.GLFW_KEY_F5 -> "F5";
case GLFW.GLFW_KEY_F6 -> "F6";
case GLFW.GLFW_KEY_F7 -> "F7";
case GLFW.GLFW_KEY_F8 -> "F8";
case GLFW.GLFW_KEY_F9 -> "F9";
case GLFW.GLFW_KEY_F10 -> "F10";
case GLFW.GLFW_KEY_F11 -> "F11";
case GLFW.GLFW_KEY_F12 -> "F12";
case GLFW.GLFW_KEY_ESCAPE -> "ESC";
case GLFW.GLFW_KEY_SPACE -> "SPC";
case GLFW.GLFW_KEY_LEFT_SHIFT -> "LSH";
case GLFW.GLFW_KEY_RIGHT_SHIFT -> "RSH";
case GLFW.GLFW_KEY_LEFT_CONTROL -> "LCT";
case GLFW.GLFW_KEY_RIGHT_CONTROL -> "RCT";
case GLFW.GLFW_KEY_LEFT_ALT -> "LAL";
case GLFW.GLFW_KEY_RIGHT_ALT -> "RAL";
case GLFW.GLFW_KEY_ENTER -> "ENT";
case GLFW.GLFW_KEY_TAB -> "TAB";
case GLFW.GLFW_KEY_BACKSPACE -> "BSP";
case GLFW.GLFW_KEY_INSERT -> "INS";
case GLFW.GLFW_KEY_DELETE -> "DEL";
case GLFW.GLFW_KEY_RIGHT -> "→";
case GLFW.GLFW_KEY_LEFT -> "←";
case GLFW.GLFW_KEY_DOWN -> "↓";
case GLFW.GLFW_KEY_UP -> "↑";
case GLFW.GLFW_KEY_PAGE_UP -> "PUP";
case GLFW.GLFW_KEY_PAGE_DOWN -> "PDN";
case GLFW.GLFW_KEY_HOME -> "HOM";
case GLFW.GLFW_KEY_END -> "END";
case GLFW.GLFW_KEY_CAPS_LOCK -> "CAP";
case GLFW.GLFW_KEY_KP_0 -> "N0";
case GLFW.GLFW_KEY_KP_1 -> "N1";
case GLFW.GLFW_KEY_KP_2 -> "N2";
case GLFW.GLFW_KEY_KP_3 -> "N3";
case GLFW.GLFW_KEY_KP_4 -> "N4";
case GLFW.GLFW_KEY_KP_5 -> "N5";
case GLFW.GLFW_KEY_KP_6 -> "N6";
case GLFW.GLFW_KEY_KP_7 -> "N7";
case GLFW.GLFW_KEY_KP_8 -> "N8";
case GLFW.GLFW_KEY_KP_9 -> "N9";
case GLFW.GLFW_KEY_KP_DECIMAL -> "N.";
case GLFW.GLFW_KEY_KP_DIVIDE -> "N/";
case GLFW.GLFW_KEY_KP_MULTIPLY -> "N*";
case GLFW.GLFW_KEY_KP_SUBTRACT -> "N-";
case GLFW.GLFW_KEY_KP_ADD -> "N+";
case GLFW.GLFW_KEY_KP_ENTER -> "NEN";
case GLFW.GLFW_KEY_MINUS -> "-";
case GLFW.GLFW_KEY_EQUAL -> "=";
case GLFW.GLFW_KEY_LEFT_BRACKET -> "[";
case GLFW.GLFW_KEY_RIGHT_BRACKET -> "]";
case GLFW.GLFW_KEY_BACKSLASH -> "\\";
case GLFW.GLFW_KEY_SEMICOLON -> ";";
case GLFW.GLFW_KEY_APOSTROPHE -> "'";
case GLFW.GLFW_KEY_COMMA -> ",";
case GLFW.GLFW_KEY_PERIOD -> ".";
case GLFW.GLFW_KEY_SLASH -> "/";
case GLFW.GLFW_KEY_GRAVE_ACCENT -> "`";
default -> "K" + keyCode;
};
}
@Override
public void drawDraggable(DrawContext context) {
MatrixStack matrix = context.getMatrices();
FontRenderer titleFont = Fonts.getSize(14, Fonts.Type.BOLD);
FontRenderer moduleFont = Fonts.getSize(13, Fonts.Type.BOLD);
FontRenderer keyFont = Fonts.getSize(13, Fonts.Type.BOLD);
float x = getX();
float y = getY();
float panelWidth = 95f;
float titleHeight = 24f;
float playerHeight = 16f;
float spacing = -3.5f;
float titleSpacing = -1.5f;
float statusPanelWidth = 16f;
float mainPanelWidth = panelWidth - statusPanelWidth - 11f;
List<Module> activeModules = getActiveModulesWithBinds();
boolean showExamples = activeModules.isEmpty() && PlayerInteractionHelper.isChat(mc.currentScreen);
int moduleCount = showExamples ? 3 : activeModules.size();
float contentHeight = moduleCount * (playerHeight + spacing) - spacing;
float totalHeight = titleHeight + titleSpacing + 7f + contentHeight;
setWidth((int) panelWidth);
setHeight((int) totalHeight);
float visibleValue = visibleAnimation.getOutput().floatValue();
matrix.push();
matrix.translate(x + panelWidth / 2, y + totalHeight / 2, 0);
matrix.scale(visibleValue, visibleValue, 1);
matrix.translate(-(x + panelWidth / 2), -(y + totalHeight / 2), 0);
rectangle.render(ShapeProperties.create(matrix, x, y, panelWidth, totalHeight)
.round(7f)
.color(ThemeManager.BackgroundGui.getColor())
.build());
rectangle.render(ShapeProperties.create(matrix, x + 4.5f, y + 4.5f, panelWidth - 9, titleHeight - 9)
.round(3.5f)
.color(ThemeManager.BackgroundSettings.getColor())
.build());
titleFont.drawString(matrix, "Binds", x + 10f, y + 10f, ThemeManager.textColor.getColor());
Fonts.getSize(19, Fonts.Type.KEFIREBAL).drawString(matrix, "D", x + panelWidth - 19f, y + 9.5f, ThemeManager.textColor.getColor());
float currentY = y + titleHeight + titleSpacing;
rectangle.render(ShapeProperties.create(matrix, x + 4.5f, currentY, mainPanelWidth, contentHeight)
.round(3.5f)
.color(ThemeManager.BackgroundSettings.getColor())
.build());
float statusPanelX = x + 4.5f + mainPanelWidth + 2.5f;
rectangle.render(ShapeProperties.create(matrix, statusPanelX, currentY, statusPanelWidth, contentHeight)
.round(3.5f)
.color(ThemeManager.BackgroundSettings.getColor())
.build());
if (showExamples) {
String[] exampleModules = {"Aura", "Velocity", "Flight"};
String[] exampleBinds = {"R", "V", "F"};
for (int i = 0; i < 3; i++) {
drawModuleBind(matrix, currentY, x, statusPanelX, statusPanelWidth, playerHeight,
moduleFont, keyFont, exampleModules[i], exampleBinds[i]);
currentY += playerHeight + spacing;
}
} else {
for (Module module : activeModules) {
String moduleName = module.getVisibleName();
String keyName = getKeyName(module.getKey());
drawModuleBind(matrix, currentY, x, statusPanelX, statusPanelWidth, playerHeight,
moduleFont, keyFont, moduleName, keyName);
currentY += playerHeight + spacing;
}
}
matrix.pop();
}
private void drawModuleBind(MatrixStack matrix, float currentY, float x, float statusPanelX,
float statusPanelWidth, float playerHeight,
FontRenderer moduleFont, FontRenderer keyFont,
String moduleName, String keyName) {
float barWidth = 1.3f;
float barHeight = 7f;
float barX = x + 4.5f + 2.8f;
float barY = currentY + 5.5f;
rectangle.render(ShapeProperties.create(matrix, barX, barY, barWidth, barHeight)
.round(0.9f)
.color(ColorAssist.getClientColor(), ColorAssist.getClientColor2(),
ColorAssist.getClientColor(), ColorAssist.getClientColor2())
.build());
float nameX = barX + barWidth + 3.5f;
float nameY = currentY + playerHeight - 9f;
moduleFont.drawString(matrix, moduleName, nameX, nameY, ThemeManager.textColor.getColor());
float keyTextWidth = keyFont.getStringWidth(keyName);
float maxWidth = statusPanelWidth - 2f;
if (keyTextWidth > maxWidth) {
float scale = maxWidth / keyTextWidth;
float keyX = statusPanelX + 1f;
float keyY = currentY + playerHeight - 9f;
matrix.push();
matrix.translate(keyX, keyY, 0);
matrix.scale(scale, scale, 1);
keyFont.drawString(matrix, keyName, 0, 0, ColorAssist.getClientColor());
matrix.pop();
} else {
float keyX = statusPanelX + (statusPanelWidth - keyTextWidth) / 2f;
float keyY = currentY + playerHeight - 9f;
keyFont.drawString(matrix, keyName, keyX, keyY, ColorAssist.getClientColor());
}
}
}