Начинающий
- Статус
- Оффлайн
- Регистрация
- 12 Июн 2025
- Сообщения
- 119
- Реакции
- 0
ебанный щитпост /delПосмотреть вложение 320535
Вот такая меню для exp 3.1
DropDown:package Kotuk.kit.ui.dropdown; import Kotuk.kit.Kit; import Kotuk.kit.functions.api.Category; import Kotuk.kit.utils.client.ClientUtil; import Kotuk.kit.utils.client.IMinecraft; import Kotuk.kit.utils.client.Vec2i; import Kotuk.kit.utils.math.MathUtil; import Kotuk.kit.utils.render.*; import Kotuk.kit.utils.render.font.Fonts; import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; import lombok.Getter; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.Screen; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.ITextComponent; import org.lwjgl.glfw.GLFW; import ru.hogoshi.Animation; import ru.hogoshi.util.Easings; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class DropDown extends Screen implements IMinecraft { private static final int MAIN_WIDTH = 520; private static final int MAIN_HEIGHT = 340; private static final int HEADER_HEIGHT = 50; private static final int CATEGORY_WIDTH = 120; private static final int CATEGORY_HEIGHT = 32; private static final int CATEGORY_SPACING = 4; private static final int CONTENT_PADDING = 15; private static final int BORDER_RADIUS = 12; private final List<Panel> panels = new ArrayList<>(); @Getter private static Animation animation = new Animation(); private int currentCategoryIndex = 0; private final String windowsUsername; private final String clientName = "Shadow"; private final ResourceLocation logoTexture = new ResourceLocation("death/images/logoa.png"); private final Map<Category, String> categoryIcons = new HashMap<>(); private final Map<Category, String> categoryDisplayNames = new HashMap<>(); public DropDown(ITextComponent titleIn) { super(titleIn); initializeCategoryData(); windowsUsername = getWindowsUsername(); SigmaIm_Kit(); } private void initializeCategoryData() { categoryIcons.put(Category.Combat, "⚔"); categoryIcons.put(Category.Movement, "🏃"); categoryIcons.put(Category.Render, "👁"); categoryIcons.put(Category.Player, "👤"); categoryIcons.put(Category.Utils, "🛠"); categoryDisplayNames.put(Category.Combat, "COMBAT"); categoryDisplayNames.put(Category.Movement, "MOVEMENT"); categoryDisplayNames.put(Category.Render, "VISUALS"); categoryDisplayNames.put(Category.Player, "PLAYER"); categoryDisplayNames.put(Category.Utils, "UTILITIES"); } private String getWindowsUsername() { try { return System.getProperty("user.name", "User"); } catch (SecurityException e) { return "User"; } } private void SigmaIm_Kit() { for (Category category : Category.values()) { if (category == Category.Theme) continue; panels.add(new Panel(category)); } } @Override public boolean isPauseScreen() { return false; } @Override protected void init() { animation = animation.animate(1, 0.3f, Easings.EXPO_OUT); super.init(); } @Override public void closeScreen() { super.closeScreen(); GLFW.glfwSetCursor(Minecraft.getInstance().getMainWindow().getHandle(), Cursors.ARROW); } @Override public boolean mouseScrolled(double mouseX, double mouseY, double delta) { Vec2i fixedMouse = getFixedMouseCoordinates(mouseX, mouseY); double fixedX = fixedMouse.getX(); double fixedY = fixedMouse.getY(); if (Screen.hasShiftDown()) { if (delta > 0) previousCategory(); else if (delta < 0) nextCategory(); return true; } Panel currentPanel = panels.get(currentCategoryIndex); if (isMouseOverPanel(currentPanel, fixedX, fixedY)) { currentPanel.setScroll((float) (currentPanel.getScroll() + (delta * 20))); return true; } return super.mouseScrolled(fixedX, fixedY, delta); } private boolean isMouseOverPanel(Panel panel, double mouseX, double mouseY) { return MathUtil.isHovered((float) mouseX, (float) mouseY, panel.getX(), panel.getY(), panel.getWidth(), panel.getHeight()); } @Override public boolean charTyped(char codePoint, int modifiers) { panels.get(currentCategoryIndex).charTyped(codePoint, modifiers); return super.charTyped(codePoint, modifiers); } @Override public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { renderDarkOverlay(); mc.gameRenderer.setupOverlayRendering(); animation.update(); if (animation.getValue() < 0.1) { closeScreen(); return; } Vec2i fixedMouse = getFixedMouseCoordinates(mouseX, mouseY); int fixedMouseX = fixedMouse.getX(); int fixedMouseY = fixedMouse.getY(); int windowWidth = ClientUtil.calc(mc.getMainWindow().getScaledWidth()); int windowHeight = ClientUtil.calc(mc.getMainWindow().getScaledHeight()); GlStateManager.pushMatrix(); applyScaleTransformation(windowWidth, windowHeight); renderMainUI(matrixStack, windowWidth, windowHeight, fixedMouseX, fixedMouseY); GlStateManager.popMatrix(); } private void renderDarkOverlay() { DisplayUtils.drawRect(0, 0, mc.getMainWindow().getScaledWidth(), mc.getMainWindow().getScaledHeight(), ColorUtils.rgba(0, 0, 0, 150)); } private void applyScaleTransformation(int windowWidth, int windowHeight) { GlStateManager.translatef(windowWidth / 2f, windowHeight / 2f, 0); GlStateManager.scaled(animation.getValue(), animation.getValue(), 1); GlStateManager.translatef(-windowWidth / 2f, -windowHeight / 2f, 0); } private void renderMainUI(MatrixStack matrixStack, int windowWidth, int windowHeight, int mouseX, int mouseY) { drawMainBackground(windowWidth, windowHeight); renderHeaderPanel(matrixStack, windowWidth, windowHeight); renderCategoryButtons(matrixStack, mouseX, mouseY, windowWidth, windowHeight); renderCurrentPanel(matrixStack, mouseX, mouseY, windowWidth, windowHeight); } private void drawMainBackground(int windowWidth, int windowHeight) { float x = windowWidth / 2f - MAIN_WIDTH / 2f; float y = windowHeight / 2f - MAIN_HEIGHT / 2f; DisplayUtils.drawRoundedRect(x, y, MAIN_WIDTH, MAIN_HEIGHT, BORDER_RADIUS, ColorUtils.rgba(20, 20, 25, 240)); DisplayUtils.drawRoundedOutline(x, y, MAIN_WIDTH, MAIN_HEIGHT, BORDER_RADIUS, 2f, ColorUtils.rgba(120, 80, 255, 255)); DisplayUtils.drawRoundedOutline(x + 1, y + 1, MAIN_WIDTH - 2, MAIN_HEIGHT - 2, BORDER_RADIUS - 1, 1f, ColorUtils.rgba(60, 60, 70, 150)); } private void renderHeaderPanel(MatrixStack matrixStack, int windowWidth, int windowHeight) { float x = windowWidth / 2f - MAIN_WIDTH / 2f; float y = windowHeight / 2f - MAIN_HEIGHT / 2f; renderHeaderBackground(x, y); renderLogo(matrixStack, x + 20, y + 15); renderUserInfo(matrixStack, x, y); } private void renderHeaderBackground(float x, float y) { DisplayUtils.drawRoundedRect(x, y, MAIN_WIDTH, HEADER_HEIGHT, BORDER_RADIUS, ColorUtils.rgba(30, 30, 35, 255)); DisplayUtils.drawGradientRect(x, y + HEADER_HEIGHT - 2, MAIN_WIDTH, 2, ColorUtils.rgba(120, 80, 255, 200), ColorUtils.rgba(120, 80, 255, 50)); } private void renderLogo(MatrixStack matrixStack, float x, float y) { try { mc.getTextureManager().bindTexture(logoTexture); GlStateManager.enableBlend(); GlStateManager.color4f(1.0f, 1.0f, 1.0f, 1.0f); blit(matrixStack, (int) x, (int) y, 0, 0, 24, 24, 24, 24); } catch (Exception e) { Fonts.sfui.drawText(matrixStack, "⚡", x, y, ColorUtils.rgb(120, 80, 255), 14.0f); } Fonts.sfui.drawText(matrixStack, clientName, x + 30, y + 8, ColorUtils.rgb(240, 240, 255), 11.0f); Fonts.sfui.drawText(matrixStack, "CLIENT", x + 30, y + 20, ColorUtils.rgb(180, 180, 200), 7.0f); } private void renderUserInfo(MatrixStack matrixStack, float headerX, float headerY) { Fonts.sfui.drawText(matrixStack, "👤", headerX + MAIN_WIDTH - 140, headerY + 15, ColorUtils.rgb(180, 200, 240), 12.0f); Fonts.sfui.drawText(matrixStack, windowsUsername, headerX + MAIN_WIDTH - 120, headerY + 15, ColorUtils.rgb(220, 220, 240), 9.0f); Fonts.sfui.drawText(matrixStack, "● ONLINE", headerX + MAIN_WIDTH - 120, headerY + 28, ColorUtils.rgb(100, 220, 100), 7.0f); } private void renderCategoryButtons(MatrixStack matrixStack, int mouseX, int mouseY, int windowWidth, int windowHeight) { float startX = windowWidth / 2f - MAIN_WIDTH / 2f + CONTENT_PADDING; float startY = windowHeight / 2f - MAIN_HEIGHT / 2f + HEADER_HEIGHT + CONTENT_PADDING; for (int i = 0; i < panels.size(); i++) { renderCategoryButton(matrixStack, mouseX, mouseY, startX, startY, i); } } private void renderCategoryButton(MatrixStack matrixStack, int mouseX, int mouseY, float startX, float startY, int index) { Panel panel = panels.get(index); float yPos = startY + index * (CATEGORY_HEIGHT + CATEGORY_SPACING); boolean isCurrent = index == currentCategoryIndex; boolean isHovered = MathUtil.isHovered(mouseX, mouseY, startX, yPos, CATEGORY_WIDTH, CATEGORY_HEIGHT); int bgColor = isCurrent ? ColorUtils.rgba(120, 80, 255, 120) : (isHovered ? ColorUtils.rgba(60, 60, 70, 120) : ColorUtils.rgba(40, 40, 45, 100)); DisplayUtils.drawRoundedRect(startX, yPos, CATEGORY_WIDTH, CATEGORY_HEIGHT, 8, bgColor); if (isCurrent) { DisplayUtils.drawRoundedOutline(startX, yPos, CATEGORY_WIDTH, CATEGORY_HEIGHT, 8, 2, ColorUtils.rgba(120, 80, 255, 255)); DisplayUtils.drawGradientRect(startX + 2, yPos + CATEGORY_HEIGHT - 3, CATEGORY_WIDTH - 4, 2, ColorUtils.rgba(120, 80, 255, 200), ColorUtils.rgba(120, 80, 255, 100)); } renderCategoryContent(matrixStack, panel.getCategory(), startX, yPos, isCurrent, isHovered); } private void renderCategoryContent(MatrixStack matrixStack, Category category, float x, float y, boolean isCurrent, boolean isHovered) { String icon = categoryIcons.getOrDefault(category, "•"); String name = categoryDisplayNames.getOrDefault(category, category.name()); int iconColor = isCurrent ? ColorUtils.rgb(200, 180, 255) : (isHovered ? ColorUtils.rgb(180, 160, 220) : ColorUtils.rgb(150, 150, 170)); int textColor = isCurrent ? ColorUtils.rgb(255, 255, 255) : (isHovered ? ColorUtils.rgb(220, 220, 240) : ColorUtils.rgb(180, 180, 200)); Fonts.sfui.drawText(matrixStack, icon, x + 15, y + CATEGORY_HEIGHT / 2f - 6, iconColor, 10.0f); Fonts.sfui.drawText(matrixStack, name, x + 40, y + CATEGORY_HEIGHT / 2f - 5, textColor, 8.0f); } private void renderCurrentPanel(MatrixStack matrixStack, int mouseX, int mouseY, int windowWidth, int windowHeight) { Panel currentPanel = panels.get(currentCategoryIndex); currentPanel.setX(windowWidth / 2f - MAIN_WIDTH / 2f + CATEGORY_WIDTH + CONTENT_PADDING * 2); currentPanel.setY(windowHeight / 2f - MAIN_HEIGHT / 2f + HEADER_HEIGHT + CONTENT_PADDING); currentPanel.setWidth(MAIN_WIDTH - CATEGORY_WIDTH - CONTENT_PADDING * 3); currentPanel.setHeight(MAIN_HEIGHT - HEADER_HEIGHT - CONTENT_PADDING * 2); currentPanel.render(matrixStack, mouseX, mouseY); } @Override public boolean keyPressed(int keyCode, int scanCode, int modifiers) { panels.get(currentCategoryIndex).keyPressed(keyCode, scanCode, modifiers); if (keyCode == GLFW.GLFW_KEY_ESCAPE) { animation = animation.animate(0, 0.4f, Easings.EXPO_BOTH); return false; } switch (keyCode) { case GLFW.GLFW_KEY_DOWN: nextCategory(); break; case GLFW.GLFW_KEY_UP: previousCategory(); break; case GLFW.GLFW_KEY_RIGHT: nextCategory(); break; case GLFW.GLFW_KEY_LEFT: previousCategory(); break; } return super.keyPressed(keyCode, scanCode, modifiers); } private void nextCategory() { currentCategoryIndex = (currentCategoryIndex + 1) % panels.size(); } private void previousCategory() { currentCategoryIndex = (currentCategoryIndex - 1 + panels.size()) % panels.size(); } private Vec2i getFixedMouseCoordinates(double mouseX, double mouseY) { int windowWidth = mc.getMainWindow().getScaledWidth(); int windowHeight = mc.getMainWindow().getScaledHeight(); float adjustedMouseX = (float) ((mouseX - windowWidth / 2f) / scale + windowWidth / 2f); float adjustedMouseY = (float) ((mouseY - windowHeight / 2f) / scale + windowHeight / 2f); return new Vec2i((int) adjustedMouseX, (int) adjustedMouseY); } @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { Vec2i fixedMouse = getFixedMouseCoordinates(mouseX, mouseY); double fixedX = fixedMouse.getX(); double fixedY = fixedMouse.getY(); if (handleCategoraLOl(fixedX, fixedY)) { return true; } if (handlePipiska(fixedX, fixedY, button)) { return true; } return super.mouseClicked(fixedX, fixedY, button); } private boolean handleCategoraLOl(double mouseX, double mouseY) { int windowWidth = ClientUtil.calc(mc.getMainWindow().getScaledWidth()); int windowHeight = ClientUtil.calc(mc.getMainWindow().getScaledHeight()); float startX = windowWidth / 2f - MAIN_WIDTH / 2f + CONTENT_PADDING; float startY = windowHeight / 2f - MAIN_HEIGHT / 2f + HEADER_HEIGHT + CONTENT_PADDING; for (int i = 0; i < panels.size(); i++) { float yPos = startY + i * (CATEGORY_HEIGHT + CATEGORY_SPACING); if (MathUtil.isHovered((float) mouseX, (float) mouseY, startX, yPos, CATEGORY_WIDTH, CATEGORY_HEIGHT)) { currentCategoryIndex = i; return true; } } return false; } private boolean handlePipiska(double mouseX, double mouseY, int button) { Panel currentPanel = panels.get(currentCategoryIndex); if (isMouseOverPanel(currentPanel, mouseX, mouseY)) { currentPanel.mouseClick((float) mouseX, (float) mouseY, button); return true; } return false; } @Override public boolean mouseReleased(double mouseX, double mouseY, int button) { Vec2i fixedMouse = getFixedMouseCoordinates(mouseX, mouseY); double fixedX = fixedMouse.getX(); double fixedY = fixedMouse.getY(); panels.get(currentCategoryIndex).mouseRelease((float) fixedX, (float) fixedY, button); return super.mouseReleased(fixedX, fixedY, button); } public static float scale = 1.0f; }
Для тех кто не знает чтобы были другие кнопки(например как у меня этот код не поможет )можно взять с других клик гуи вроде бы красивая эта моя первая клик гуи
оцените пожалуйста
