Смотрите видео ниже, чтобы узнать, как установить наш сайт в качестве веб-приложения на домашнем экране.
Примечание: Эта возможность может быть недоступна в некоторых браузерах.
очень красиво вот только на скид так себе а так годнокрч сделал недо скид нурика ( клик гуи ) не судите строго 2 тема ( сделал за 30 минут + - )
Пожалуйста, авторизуйтесь для просмотра ссылки.
( изменено ) если что я хотел зделать скид нурика но выйшло вот это
Panel.java:package sweetie.evaware.client.ui.clickgui; import lombok.Getter; import lombok.Setter; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.util.math.MatrixStack; import org.joml.Vector4f; import sweetie.evaware.api.event.Listener; import sweetie.evaware.api.event.events.other.WindowResizeEvent; import sweetie.evaware.api.module.Category; import sweetie.evaware.api.module.Module; import sweetie.evaware.api.module.ModuleManager; import sweetie.evaware.api.utils.color.UIColors; import sweetie.evaware.api.utils.animation.AnimationUtil; import sweetie.evaware.api.utils.animation.Easing; import sweetie.evaware.api.utils.math.MouseUtil; import sweetie.evaware.api.utils.render.RenderUtil; import sweetie.evaware.api.utils.render.ScissorUtil; import sweetie.evaware.api.utils.render.fonts.Fonts; import sweetie.evaware.client.ui.UIComponent; import sweetie.evaware.client.ui.clickgui.module.ModuleComponent; import sweetie.evaware.client.ui.clickgui.module.SettingComponent; import java.util.ArrayList; import java.util.List; @Getter public class Panel extends UIComponent { private final Category category; private final List<ModuleComponent> moduleComponents = new ArrayList<>(); @Setter private int categoryIndex; private double scrollTarget = 0f; private final AnimationUtil scrollAnimation = new AnimationUtil(); public Panel(Category category) { this.category = category; for (Module module : ModuleManager.getInstance().getModules()) { if (module.getCategory() == category) { ModuleComponent moduleComponent = new ModuleComponent(module); moduleComponent.setRound(getRound() * 2f); moduleComponents.add(moduleComponent); } } if (!moduleComponents.isEmpty()) { moduleComponents.getLast().setLast(true); } int index = categoryIndex; for (ModuleComponent module : moduleComponents) { module.setIndex(index); index += 45; } WindowResizeEvent.getInstance().subscribe(new Listener<>(-1, event -> { })); } @Override public void render(DrawContext context, int mouseX, int mouseY, float delta) { updateThings(); renderThings(context, mouseX, mouseY, delta); } @Override public void keyPressed(int keyCode, int scanCode, int modifiers) { moduleComponents.forEach(m -> m.keyPressed(keyCode, scanCode, modifiers)); } @Override public void mouseClicked(double mouseX, double mouseY, int button) { if (!inPanel(mouseX, mouseY)) return; for (ModuleComponent module : moduleComponents) { if (!MouseUtil.isHovered(mouseX, mouseY, module.getX(), module.getY(), module.getWidth(), module.getHeight())) continue; module.mouseClicked(mouseX, mouseY, button); } } @Override public void mouseReleased(double mouseX, double mouseY, int button) { if (!inPanel(mouseX, mouseY)) return; for (ModuleComponent module : moduleComponents) { if (!MouseUtil.isHovered(mouseX, mouseY, module.getX(), module.getY(), module.getWidth(), module.getHeight())) continue; module.mouseReleased(mouseX, mouseY, button); } } @Override public void mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) { if (!isMouseOver(mouseX, mouseY)) return; scrollTarget += verticalAmount * 20.0; clampScroll(); } private void clampScroll() { double maxScroll = 0; double contentHeight = calcTotalContentHeight(); double visibleHeight = getFixedHeight() - getHeaderHeight(); double minScroll = Math.min(0, visibleHeight - contentHeight); scrollTarget = Math.max(minScroll, Math.min(maxScroll, scrollTarget)); } private void updateThings() { scrollAnimation.update(); scrollAnimation.run(scrollTarget, 600, Easing.EXPO_OUT); clampScroll(); setWidth(scaled(99f)); setHeight(getFixedHeight()); moduleComponents.forEach(m -> m.setRound(getRound() * 2f)); } private void renderThings(DrawContext context, int mouseX, int mouseY, float delta) { MatrixStack matrixStack = context.getMatrices(); float fontSize = getHeaderHeight() * 0.475f; int fullAlpha = (int) (getAlpha() * 255f); RenderUtil.BLUR_RECT.draw(matrixStack, getX(), getY(), getWidth(), getFixedHeight(), new Vector4f(getRound(), getRound(), getRound(), getRound()), UIColors.blur(fullAlpha)); RenderUtil.BLUR_RECT.draw(matrixStack, getX(), getY(), getWidth(), getHeaderHeight(), new Vector4f(getRound(), getRound(), 0f, 0f), UIColors.blur(fullAlpha)); Fonts.PS_BOLD.drawCenteredText(matrixStack, category.getLabel(), getX() + getWidth() / 2f, getY() + getHeaderHeight() / 2f - fontSize / 2f, fontSize, UIColors.textColor(fullAlpha)); calcModules(); float scissorY = getY() + getHeaderHeight(); float scissorH = getFixedHeight() - getHeaderHeight(); ScissorUtil.start(matrixStack, getX(), scissorY, getWidth(), scissorH); for (ModuleComponent module : moduleComponents) { if (module.getY() + module.getHeight() < scissorY) continue; if (module.getY() > scissorY + scissorH) continue; module.setAlpha(getAlpha()); module.render(context, mouseX, mouseY, delta); } ScissorUtil.stop(matrixStack); } private void calcModules() { float moduleY = 0f; double scroll = scrollAnimation.getValue(); for (ModuleComponent module : moduleComponents) { float openAnim = module.getAnim(); if (openAnim > 0f) { float settingOffset = 0f; for (SettingComponent setting : module.getSettings()) { float visibleAnim = (float) setting.getVisibleAnimation().getValue(); if (visibleAnim > 0f) { settingOffset += (setting.getHeight() + gap()) * visibleAnim; } } settingOffset *= openAnim; module.setHeight(module.getDefaultHeight() + (settingOffset + gap()) * openAnim); } else { module.setHeight(module.getDefaultHeight()); } module.setWidth(getWidth()); module.setRound(getRound() / 2f); module.setX(getX()); module.setY((float) (getY() + getHeaderHeight() + scroll + moduleY)); moduleY += module.getHeight(); } } private float calcTotalContentHeight() { float total = 0f; for (ModuleComponent module : moduleComponents) { total += module.getHeight(); } return total; } public float getHeaderHeight() { return scaled(18f); } public float getFixedHeight() { return scaled(240f); } public float getRound() { return getHeaderHeight() / 2.2f; } public boolean inPanel(double mouseX, double mouseY) { return MouseUtil.isHovered(mouseX, mouseY, getX(), getY() + getHeaderHeight(), getWidth(), getFixedHeight() - getHeaderHeight()); } public boolean isMouseOver(double mouseX, double mouseY) { return MouseUtil.isHovered(mouseX, mouseY, getX(), getY(), getWidth(), getFixedHeight()); } }
ну как помне чуть пофиксить код будет нормально в пасту пойдёт
ScreenClickGUI.java:package sweetie.evaware.client.ui.clickgui; import lombok.Getter; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.text.Text; import org.lwjgl.glfw.GLFW; import sweetie.evaware.api.module.Category; import sweetie.evaware.api.system.interfaces.QuickImports; import sweetie.evaware.api.utils.animation.AnimationUtil; import sweetie.evaware.api.utils.animation.Easing; import sweetie.evaware.client.services.RenderService; import sweetie.evaware.client.ui.theme.ThemeEditor; import java.util.ArrayList; import java.util.List; @Getter public class ScreenClickGUI extends Screen implements QuickImports { @Getter private static final ScreenClickGUI instance = new ScreenClickGUI(); private float scroll; private final AnimationUtil scrollAnimation = new AnimationUtil(); private boolean open; private final AnimationUtil openAnimation = new AnimationUtil(); private final List<Panel> panels = new ArrayList<>(); private final ThemeEditor themeEditor = ThemeEditor.getInstance(); public ScreenClickGUI() { super(Text.of("")); for (int i = 0; i < Category.values().length; i++) { Category category = Category.values()[i]; Panel panel = new Panel(category); panel.setCategoryIndex(i * 45); panels.add(panel); } } @Override public void close() { ThemeEditor.getInstance().save(false); open = false; super.close(); } @Override protected void init() { ThemeEditor.getInstance().init(); open = true; super.init(); } @Override public void render(DrawContext context, int mouseX, int mouseY, float delta) { super.render(context, mouseX, mouseY, delta); scrollAnimation.update(); scrollAnimation.run(scroll, 600, Easing.EXPO_OUT); openAnimation.update(); openAnimation.run(open ? 1.0 : 0.0, 500, Easing.EXPO_OUT); float openAnim = (float) openAnimation.getValue(); if (!open && openAnim < 0.1) close(); float windowHeight = mc.getWindow().getScaledHeight(); float windowWidth = mc.getWindow().getScaledWidth(); float off = RenderService.getInstance().scaled(12f); float totalWidth = panels.stream().map(Panel::getWidth).reduce(0f, Float::sum) + (panels.size() - 1) * (off / 2f); float sex = !open ? 1f - openAnim : (-1f + openAnim); float panelY = (float) (windowHeight / 6f + scrollAnimation.getValue()) * openAnim + (windowHeight * sex); float firstX = (windowWidth - totalWidth) / 2f; if (themeEditor.isOpen()) { themeEditor.setAnim(openAnim); themeEditor.setX(windowWidth - themeEditor.getWidth() * themeEditor.getAnim()); themeEditor.setY(windowHeight / 2f - themeEditor.getHeight() / 2f); } for (Panel panel : panels) { panel.setAlpha(openAnim); panel.setY(panelY); panel.setX((firstX + panels.indexOf(panel) * (panel.getWidth() + (off / 2f)))); panel.render(context, mouseX, mouseY, delta); } themeEditor.render(context, mouseX, mouseY, delta); } @Override public boolean keyPressed(int keyCode, int scanCode, int modifiers) { if (keyCode == GLFW.GLFW_KEY_ESCAPE) { open = false; mc.mouse.lockCursor(); return true; } panels.forEach(panel -> panel.keyPressed(keyCode, scanCode, modifiers)); themeEditor.keyPressed(keyCode, scanCode, modifiers); return super.keyPressed(keyCode, scanCode, modifiers); } @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { panels.forEach(panel -> panel.mouseClicked(mouseX, mouseY, button)); themeEditor.mouseClicked(mouseX, mouseY, button); return super.mouseClicked(mouseX, mouseY, button); } @Override public boolean mouseReleased(double mouseX, double mouseY, int button) { panels.forEach(panel -> panel.mouseReleased(mouseX, mouseY, button)); themeEditor.mouseReleased(mouseX, mouseY, button); return super.mouseReleased(mouseX, mouseY, button); } @Override public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) { for (Panel panel : panels) { if (panel.isMouseOver(mouseX, mouseY)) { panel.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); break; } } return super.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); } @Override public boolean charTyped(char chr, int modifiers) { return themeEditor.charTyped(chr, modifiers); } @Override public void blur() {} @Override public boolean shouldCloseOnEsc() { return false; } @Override public void renderBackground(DrawContext context, int mouseX, int mouseY, float delta) {} @Override public boolean shouldPause() { return false; } @Override protected void applyBlur() {} }
что тут годного? типок взял и изуродовал гуи евыочень красиво вот только на скид так себе а так годно
а где тут нурланкрч сделал недо скид нурика ( клик гуи ) не судите строго 2 тема ( сделал за 30 минут + - )
Пожалуйста, авторизуйтесь для просмотра ссылки.
( изменено ) если что я хотел зделать скид нурика но выйшло вот это
Panel.java:package sweetie.evaware.client.ui.clickgui; import lombok.Getter; import lombok.Setter; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.util.math.MatrixStack; import org.joml.Vector4f; import sweetie.evaware.api.event.Listener; import sweetie.evaware.api.event.events.other.WindowResizeEvent; import sweetie.evaware.api.module.Category; import sweetie.evaware.api.module.Module; import sweetie.evaware.api.module.ModuleManager; import sweetie.evaware.api.utils.color.UIColors; import sweetie.evaware.api.utils.animation.AnimationUtil; import sweetie.evaware.api.utils.animation.Easing; import sweetie.evaware.api.utils.math.MouseUtil; import sweetie.evaware.api.utils.render.RenderUtil; import sweetie.evaware.api.utils.render.ScissorUtil; import sweetie.evaware.api.utils.render.fonts.Fonts; import sweetie.evaware.client.ui.UIComponent; import sweetie.evaware.client.ui.clickgui.module.ModuleComponent; import sweetie.evaware.client.ui.clickgui.module.SettingComponent; import java.util.ArrayList; import java.util.List; @Getter public class Panel extends UIComponent { private final Category category; private final List<ModuleComponent> moduleComponents = new ArrayList<>(); @Setter private int categoryIndex; private double scrollTarget = 0f; private final AnimationUtil scrollAnimation = new AnimationUtil(); public Panel(Category category) { this.category = category; for (Module module : ModuleManager.getInstance().getModules()) { if (module.getCategory() == category) { ModuleComponent moduleComponent = new ModuleComponent(module); moduleComponent.setRound(getRound() * 2f); moduleComponents.add(moduleComponent); } } if (!moduleComponents.isEmpty()) { moduleComponents.getLast().setLast(true); } int index = categoryIndex; for (ModuleComponent module : moduleComponents) { module.setIndex(index); index += 45; } WindowResizeEvent.getInstance().subscribe(new Listener<>(-1, event -> { })); } @Override public void render(DrawContext context, int mouseX, int mouseY, float delta) { updateThings(); renderThings(context, mouseX, mouseY, delta); } @Override public void keyPressed(int keyCode, int scanCode, int modifiers) { moduleComponents.forEach(m -> m.keyPressed(keyCode, scanCode, modifiers)); } @Override public void mouseClicked(double mouseX, double mouseY, int button) { if (!inPanel(mouseX, mouseY)) return; for (ModuleComponent module : moduleComponents) { if (!MouseUtil.isHovered(mouseX, mouseY, module.getX(), module.getY(), module.getWidth(), module.getHeight())) continue; module.mouseClicked(mouseX, mouseY, button); } } @Override public void mouseReleased(double mouseX, double mouseY, int button) { if (!inPanel(mouseX, mouseY)) return; for (ModuleComponent module : moduleComponents) { if (!MouseUtil.isHovered(mouseX, mouseY, module.getX(), module.getY(), module.getWidth(), module.getHeight())) continue; module.mouseReleased(mouseX, mouseY, button); } } @Override public void mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) { if (!isMouseOver(mouseX, mouseY)) return; scrollTarget += verticalAmount * 20.0; clampScroll(); } private void clampScroll() { double maxScroll = 0; double contentHeight = calcTotalContentHeight(); double visibleHeight = getFixedHeight() - getHeaderHeight(); double minScroll = Math.min(0, visibleHeight - contentHeight); scrollTarget = Math.max(minScroll, Math.min(maxScroll, scrollTarget)); } private void updateThings() { scrollAnimation.update(); scrollAnimation.run(scrollTarget, 600, Easing.EXPO_OUT); clampScroll(); setWidth(scaled(99f)); setHeight(getFixedHeight()); moduleComponents.forEach(m -> m.setRound(getRound() * 2f)); } private void renderThings(DrawContext context, int mouseX, int mouseY, float delta) { MatrixStack matrixStack = context.getMatrices(); float fontSize = getHeaderHeight() * 0.475f; int fullAlpha = (int) (getAlpha() * 255f); RenderUtil.BLUR_RECT.draw(matrixStack, getX(), getY(), getWidth(), getFixedHeight(), new Vector4f(getRound(), getRound(), getRound(), getRound()), UIColors.blur(fullAlpha)); RenderUtil.BLUR_RECT.draw(matrixStack, getX(), getY(), getWidth(), getHeaderHeight(), new Vector4f(getRound(), getRound(), 0f, 0f), UIColors.blur(fullAlpha)); Fonts.PS_BOLD.drawCenteredText(matrixStack, category.getLabel(), getX() + getWidth() / 2f, getY() + getHeaderHeight() / 2f - fontSize / 2f, fontSize, UIColors.textColor(fullAlpha)); calcModules(); float scissorY = getY() + getHeaderHeight(); float scissorH = getFixedHeight() - getHeaderHeight(); ScissorUtil.start(matrixStack, getX(), scissorY, getWidth(), scissorH); for (ModuleComponent module : moduleComponents) { if (module.getY() + module.getHeight() < scissorY) continue; if (module.getY() > scissorY + scissorH) continue; module.setAlpha(getAlpha()); module.render(context, mouseX, mouseY, delta); } ScissorUtil.stop(matrixStack); } private void calcModules() { float moduleY = 0f; double scroll = scrollAnimation.getValue(); for (ModuleComponent module : moduleComponents) { float openAnim = module.getAnim(); if (openAnim > 0f) { float settingOffset = 0f; for (SettingComponent setting : module.getSettings()) { float visibleAnim = (float) setting.getVisibleAnimation().getValue(); if (visibleAnim > 0f) { settingOffset += (setting.getHeight() + gap()) * visibleAnim; } } settingOffset *= openAnim; module.setHeight(module.getDefaultHeight() + (settingOffset + gap()) * openAnim); } else { module.setHeight(module.getDefaultHeight()); } module.setWidth(getWidth()); module.setRound(getRound() / 2f); module.setX(getX()); module.setY((float) (getY() + getHeaderHeight() + scroll + moduleY)); moduleY += module.getHeight(); } } private float calcTotalContentHeight() { float total = 0f; for (ModuleComponent module : moduleComponents) { total += module.getHeight(); } return total; } public float getHeaderHeight() { return scaled(18f); } public float getFixedHeight() { return scaled(240f); } public float getRound() { return getHeaderHeight() / 2.2f; } public boolean inPanel(double mouseX, double mouseY) { return MouseUtil.isHovered(mouseX, mouseY, getX(), getY() + getHeaderHeight(), getWidth(), getFixedHeight() - getHeaderHeight()); } public boolean isMouseOver(double mouseX, double mouseY) { return MouseUtil.isHovered(mouseX, mouseY, getX(), getY(), getWidth(), getFixedHeight()); } }
ну как помне чуть пофиксить код будет нормально в пасту пойдёт
ScreenClickGUI.java:package sweetie.evaware.client.ui.clickgui; import lombok.Getter; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.text.Text; import org.lwjgl.glfw.GLFW; import sweetie.evaware.api.module.Category; import sweetie.evaware.api.system.interfaces.QuickImports; import sweetie.evaware.api.utils.animation.AnimationUtil; import sweetie.evaware.api.utils.animation.Easing; import sweetie.evaware.client.services.RenderService; import sweetie.evaware.client.ui.theme.ThemeEditor; import java.util.ArrayList; import java.util.List; @Getter public class ScreenClickGUI extends Screen implements QuickImports { @Getter private static final ScreenClickGUI instance = new ScreenClickGUI(); private float scroll; private final AnimationUtil scrollAnimation = new AnimationUtil(); private boolean open; private final AnimationUtil openAnimation = new AnimationUtil(); private final List<Panel> panels = new ArrayList<>(); private final ThemeEditor themeEditor = ThemeEditor.getInstance(); public ScreenClickGUI() { super(Text.of("")); for (int i = 0; i < Category.values().length; i++) { Category category = Category.values()[i]; Panel panel = new Panel(category); panel.setCategoryIndex(i * 45); panels.add(panel); } } @Override public void close() { ThemeEditor.getInstance().save(false); open = false; super.close(); } @Override protected void init() { ThemeEditor.getInstance().init(); open = true; super.init(); } @Override public void render(DrawContext context, int mouseX, int mouseY, float delta) { super.render(context, mouseX, mouseY, delta); scrollAnimation.update(); scrollAnimation.run(scroll, 600, Easing.EXPO_OUT); openAnimation.update(); openAnimation.run(open ? 1.0 : 0.0, 500, Easing.EXPO_OUT); float openAnim = (float) openAnimation.getValue(); if (!open && openAnim < 0.1) close(); float windowHeight = mc.getWindow().getScaledHeight(); float windowWidth = mc.getWindow().getScaledWidth(); float off = RenderService.getInstance().scaled(12f); float totalWidth = panels.stream().map(Panel::getWidth).reduce(0f, Float::sum) + (panels.size() - 1) * (off / 2f); float sex = !open ? 1f - openAnim : (-1f + openAnim); float panelY = (float) (windowHeight / 6f + scrollAnimation.getValue()) * openAnim + (windowHeight * sex); float firstX = (windowWidth - totalWidth) / 2f; if (themeEditor.isOpen()) { themeEditor.setAnim(openAnim); themeEditor.setX(windowWidth - themeEditor.getWidth() * themeEditor.getAnim()); themeEditor.setY(windowHeight / 2f - themeEditor.getHeight() / 2f); } for (Panel panel : panels) { panel.setAlpha(openAnim); panel.setY(panelY); panel.setX((firstX + panels.indexOf(panel) * (panel.getWidth() + (off / 2f)))); panel.render(context, mouseX, mouseY, delta); } themeEditor.render(context, mouseX, mouseY, delta); } @Override public boolean keyPressed(int keyCode, int scanCode, int modifiers) { if (keyCode == GLFW.GLFW_KEY_ESCAPE) { open = false; mc.mouse.lockCursor(); return true; } panels.forEach(panel -> panel.keyPressed(keyCode, scanCode, modifiers)); themeEditor.keyPressed(keyCode, scanCode, modifiers); return super.keyPressed(keyCode, scanCode, modifiers); } @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { panels.forEach(panel -> panel.mouseClicked(mouseX, mouseY, button)); themeEditor.mouseClicked(mouseX, mouseY, button); return super.mouseClicked(mouseX, mouseY, button); } @Override public boolean mouseReleased(double mouseX, double mouseY, int button) { panels.forEach(panel -> panel.mouseReleased(mouseX, mouseY, button)); themeEditor.mouseReleased(mouseX, mouseY, button); return super.mouseReleased(mouseX, mouseY, button); } @Override public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) { for (Panel panel : panels) { if (panel.isMouseOver(mouseX, mouseY)) { panel.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); break; } } return super.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); } @Override public boolean charTyped(char chr, int modifiers) { return themeEditor.charTyped(chr, modifiers); } @Override public void blur() {} @Override public boolean shouldCloseOnEsc() { return false; } @Override public void renderBackground(DrawContext context, int mouseX, int mouseY, float delta) {} @Override public boolean shouldPause() { return false; } @Override protected void applyBlur() {} }
мне нравитсякрч сделал недо скид нурика ( клик гуи ) не судите строго 2 тема ( сделал за 30 минут + - )
Пожалуйста, авторизуйтесь для просмотра ссылки.
( изменено ) если что я хотел зделать скид нурика но выйшло вот это
Panel.java:package sweetie.evaware.client.ui.clickgui; import lombok.Getter; import lombok.Setter; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.util.math.MatrixStack; import org.joml.Vector4f; import sweetie.evaware.api.event.Listener; import sweetie.evaware.api.event.events.other.WindowResizeEvent; import sweetie.evaware.api.module.Category; import sweetie.evaware.api.module.Module; import sweetie.evaware.api.module.ModuleManager; import sweetie.evaware.api.utils.color.UIColors; import sweetie.evaware.api.utils.animation.AnimationUtil; import sweetie.evaware.api.utils.animation.Easing; import sweetie.evaware.api.utils.math.MouseUtil; import sweetie.evaware.api.utils.render.RenderUtil; import sweetie.evaware.api.utils.render.ScissorUtil; import sweetie.evaware.api.utils.render.fonts.Fonts; import sweetie.evaware.client.ui.UIComponent; import sweetie.evaware.client.ui.clickgui.module.ModuleComponent; import sweetie.evaware.client.ui.clickgui.module.SettingComponent; import java.util.ArrayList; import java.util.List; @Getter public class Panel extends UIComponent { private final Category category; private final List<ModuleComponent> moduleComponents = new ArrayList<>(); @Setter private int categoryIndex; private double scrollTarget = 0f; private final AnimationUtil scrollAnimation = new AnimationUtil(); public Panel(Category category) { this.category = category; for (Module module : ModuleManager.getInstance().getModules()) { if (module.getCategory() == category) { ModuleComponent moduleComponent = new ModuleComponent(module); moduleComponent.setRound(getRound() * 2f); moduleComponents.add(moduleComponent); } } if (!moduleComponents.isEmpty()) { moduleComponents.getLast().setLast(true); } int index = categoryIndex; for (ModuleComponent module : moduleComponents) { module.setIndex(index); index += 45; } WindowResizeEvent.getInstance().subscribe(new Listener<>(-1, event -> { })); } @Override public void render(DrawContext context, int mouseX, int mouseY, float delta) { updateThings(); renderThings(context, mouseX, mouseY, delta); } @Override public void keyPressed(int keyCode, int scanCode, int modifiers) { moduleComponents.forEach(m -> m.keyPressed(keyCode, scanCode, modifiers)); } @Override public void mouseClicked(double mouseX, double mouseY, int button) { if (!inPanel(mouseX, mouseY)) return; for (ModuleComponent module : moduleComponents) { if (!MouseUtil.isHovered(mouseX, mouseY, module.getX(), module.getY(), module.getWidth(), module.getHeight())) continue; module.mouseClicked(mouseX, mouseY, button); } } @Override public void mouseReleased(double mouseX, double mouseY, int button) { if (!inPanel(mouseX, mouseY)) return; for (ModuleComponent module : moduleComponents) { if (!MouseUtil.isHovered(mouseX, mouseY, module.getX(), module.getY(), module.getWidth(), module.getHeight())) continue; module.mouseReleased(mouseX, mouseY, button); } } @Override public void mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) { if (!isMouseOver(mouseX, mouseY)) return; scrollTarget += verticalAmount * 20.0; clampScroll(); } private void clampScroll() { double maxScroll = 0; double contentHeight = calcTotalContentHeight(); double visibleHeight = getFixedHeight() - getHeaderHeight(); double minScroll = Math.min(0, visibleHeight - contentHeight); scrollTarget = Math.max(minScroll, Math.min(maxScroll, scrollTarget)); } private void updateThings() { scrollAnimation.update(); scrollAnimation.run(scrollTarget, 600, Easing.EXPO_OUT); clampScroll(); setWidth(scaled(99f)); setHeight(getFixedHeight()); moduleComponents.forEach(m -> m.setRound(getRound() * 2f)); } private void renderThings(DrawContext context, int mouseX, int mouseY, float delta) { MatrixStack matrixStack = context.getMatrices(); float fontSize = getHeaderHeight() * 0.475f; int fullAlpha = (int) (getAlpha() * 255f); RenderUtil.BLUR_RECT.draw(matrixStack, getX(), getY(), getWidth(), getFixedHeight(), new Vector4f(getRound(), getRound(), getRound(), getRound()), UIColors.blur(fullAlpha)); RenderUtil.BLUR_RECT.draw(matrixStack, getX(), getY(), getWidth(), getHeaderHeight(), new Vector4f(getRound(), getRound(), 0f, 0f), UIColors.blur(fullAlpha)); Fonts.PS_BOLD.drawCenteredText(matrixStack, category.getLabel(), getX() + getWidth() / 2f, getY() + getHeaderHeight() / 2f - fontSize / 2f, fontSize, UIColors.textColor(fullAlpha)); calcModules(); float scissorY = getY() + getHeaderHeight(); float scissorH = getFixedHeight() - getHeaderHeight(); ScissorUtil.start(matrixStack, getX(), scissorY, getWidth(), scissorH); for (ModuleComponent module : moduleComponents) { if (module.getY() + module.getHeight() < scissorY) continue; if (module.getY() > scissorY + scissorH) continue; module.setAlpha(getAlpha()); module.render(context, mouseX, mouseY, delta); } ScissorUtil.stop(matrixStack); } private void calcModules() { float moduleY = 0f; double scroll = scrollAnimation.getValue(); for (ModuleComponent module : moduleComponents) { float openAnim = module.getAnim(); if (openAnim > 0f) { float settingOffset = 0f; for (SettingComponent setting : module.getSettings()) { float visibleAnim = (float) setting.getVisibleAnimation().getValue(); if (visibleAnim > 0f) { settingOffset += (setting.getHeight() + gap()) * visibleAnim; } } settingOffset *= openAnim; module.setHeight(module.getDefaultHeight() + (settingOffset + gap()) * openAnim); } else { module.setHeight(module.getDefaultHeight()); } module.setWidth(getWidth()); module.setRound(getRound() / 2f); module.setX(getX()); module.setY((float) (getY() + getHeaderHeight() + scroll + moduleY)); moduleY += module.getHeight(); } } private float calcTotalContentHeight() { float total = 0f; for (ModuleComponent module : moduleComponents) { total += module.getHeight(); } return total; } public float getHeaderHeight() { return scaled(18f); } public float getFixedHeight() { return scaled(240f); } public float getRound() { return getHeaderHeight() / 2.2f; } public boolean inPanel(double mouseX, double mouseY) { return MouseUtil.isHovered(mouseX, mouseY, getX(), getY() + getHeaderHeight(), getWidth(), getFixedHeight() - getHeaderHeight()); } public boolean isMouseOver(double mouseX, double mouseY) { return MouseUtil.isHovered(mouseX, mouseY, getX(), getY(), getWidth(), getFixedHeight()); } }
ну как помне чуть пофиксить код будет нормально в пасту пойдёт
ScreenClickGUI.java:package sweetie.evaware.client.ui.clickgui; import lombok.Getter; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; import net.minecraft.text.Text; import org.lwjgl.glfw.GLFW; import sweetie.evaware.api.module.Category; import sweetie.evaware.api.system.interfaces.QuickImports; import sweetie.evaware.api.utils.animation.AnimationUtil; import sweetie.evaware.api.utils.animation.Easing; import sweetie.evaware.client.services.RenderService; import sweetie.evaware.client.ui.theme.ThemeEditor; import java.util.ArrayList; import java.util.List; @Getter public class ScreenClickGUI extends Screen implements QuickImports { @Getter private static final ScreenClickGUI instance = new ScreenClickGUI(); private float scroll; private final AnimationUtil scrollAnimation = new AnimationUtil(); private boolean open; private final AnimationUtil openAnimation = new AnimationUtil(); private final List<Panel> panels = new ArrayList<>(); private final ThemeEditor themeEditor = ThemeEditor.getInstance(); public ScreenClickGUI() { super(Text.of("")); for (int i = 0; i < Category.values().length; i++) { Category category = Category.values()[i]; Panel panel = new Panel(category); panel.setCategoryIndex(i * 45); panels.add(panel); } } @Override public void close() { ThemeEditor.getInstance().save(false); open = false; super.close(); } @Override protected void init() { ThemeEditor.getInstance().init(); open = true; super.init(); } @Override public void render(DrawContext context, int mouseX, int mouseY, float delta) { super.render(context, mouseX, mouseY, delta); scrollAnimation.update(); scrollAnimation.run(scroll, 600, Easing.EXPO_OUT); openAnimation.update(); openAnimation.run(open ? 1.0 : 0.0, 500, Easing.EXPO_OUT); float openAnim = (float) openAnimation.getValue(); if (!open && openAnim < 0.1) close(); float windowHeight = mc.getWindow().getScaledHeight(); float windowWidth = mc.getWindow().getScaledWidth(); float off = RenderService.getInstance().scaled(12f); float totalWidth = panels.stream().map(Panel::getWidth).reduce(0f, Float::sum) + (panels.size() - 1) * (off / 2f); float sex = !open ? 1f - openAnim : (-1f + openAnim); float panelY = (float) (windowHeight / 6f + scrollAnimation.getValue()) * openAnim + (windowHeight * sex); float firstX = (windowWidth - totalWidth) / 2f; if (themeEditor.isOpen()) { themeEditor.setAnim(openAnim); themeEditor.setX(windowWidth - themeEditor.getWidth() * themeEditor.getAnim()); themeEditor.setY(windowHeight / 2f - themeEditor.getHeight() / 2f); } for (Panel panel : panels) { panel.setAlpha(openAnim); panel.setY(panelY); panel.setX((firstX + panels.indexOf(panel) * (panel.getWidth() + (off / 2f)))); panel.render(context, mouseX, mouseY, delta); } themeEditor.render(context, mouseX, mouseY, delta); } @Override public boolean keyPressed(int keyCode, int scanCode, int modifiers) { if (keyCode == GLFW.GLFW_KEY_ESCAPE) { open = false; mc.mouse.lockCursor(); return true; } panels.forEach(panel -> panel.keyPressed(keyCode, scanCode, modifiers)); themeEditor.keyPressed(keyCode, scanCode, modifiers); return super.keyPressed(keyCode, scanCode, modifiers); } @Override public boolean mouseClicked(double mouseX, double mouseY, int button) { panels.forEach(panel -> panel.mouseClicked(mouseX, mouseY, button)); themeEditor.mouseClicked(mouseX, mouseY, button); return super.mouseClicked(mouseX, mouseY, button); } @Override public boolean mouseReleased(double mouseX, double mouseY, int button) { panels.forEach(panel -> panel.mouseReleased(mouseX, mouseY, button)); themeEditor.mouseReleased(mouseX, mouseY, button); return super.mouseReleased(mouseX, mouseY, button); } @Override public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) { for (Panel panel : panels) { if (panel.isMouseOver(mouseX, mouseY)) { panel.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); break; } } return super.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); } @Override public boolean charTyped(char chr, int modifiers) { return themeEditor.charTyped(chr, modifiers); } @Override public void blur() {} @Override public boolean shouldCloseOnEsc() { return false; } @Override public void renderBackground(DrawContext context, int mouseX, int mouseY, float delta) {} @Override public boolean shouldPause() { return false; } @Override protected void applyBlur() {} }
Проект предоставляет различный материал, относящийся к сфере киберспорта, программирования, ПО для игр, а также позволяет его участникам общаться на многие другие темы. Почта для жалоб: admin@yougame.biz