Read Only
- Статус
- Оффлайн
- Регистрация
- 18 Июл 2022
- Сообщения
- 286
- Реакции
- 2
- Выберите загрузчик игры
- OptiFine
Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:
- бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
- маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
- приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
- обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.
Спасибо!
У гуи были траблы со скроллом он был бесконечный и если немного прокрутить колёсико он сам крутился дальше. Также убрал убогую анимацию скролла гуи.
ClickGui:
package ru.blade.System.InterfaceSystem.ClickGui;
import net.minecraft.client.gui.GuiGraphics;
import net.minecraft.network.chat.Component;
import ru.blade.System.EventSystem.core.Interface.IMinecraft;
import ru.blade.System.InterfaceSystem.ClickGui.impl.ModuleOptionComponent;
import ru.blade.System.ModuleSystem.api.Category;
import ru.blade.System.UtilsSystem.vector.Vector2i;
import ru.blade.System.UtilsSystem.font.Fonts;
import ru.blade.System.UtilsSystem.math.common.MathUtil;
import ru.blade.System.UtilsSystem.math.common.MouseUtil;
import ru.blade.System.UtilsSystem.render.ColorUtils;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.resources.ResourceLocation;
import org.lwjgl.glfw.GLFW;
import ru.blade.System.UtilsSystem.vector.floats.Vector4f;
import ru.hogoshi.Animation;
import ru.hogoshi.util.Easings;
import java.awt.*;
import java.util.ArrayList;
import java.util.List;
public class ClickGui extends Screen implements IMinecraft {
public float x, y, w, h;
public final List<PanelGui> categoryes = new ArrayList<>();
public SearchFieldGui searchFieldGui;
Animation animation = new Animation();
String text = "";
private float globalScroll = 0;
private static final float SCROLL_SPEED = 8.0f;
private static final float MAX_SCROLL = 50.0f;
private static final float MIN_SCROLL = -50.0f;
public ClickGui(Component pTitle) {
super(pTitle);
for (Category category : Category.values()) {
categoryes.add(new PanelGui(category));
}
}
public void setUp(Vector4f info) {
this.x = info.x;
this.y = info.y;
this.w = info.z;
this.h = info.w;
}
@Override
public boolean isPauseScreen() {
return false;
}
@Override
public void init() {
animation.animate(1, 0.15, Easings.SINE_OUT);
float x = (MathUtil.calc(mc.getWindow().getGuiScaledWidth()) / 2f) - (categoryes.size() * 140 / 2f) + 2 * 145 + 27.5f;
float y = (MathUtil.calc(mc.getWindow().getGuiScaledHeight()) / 2f) + (225) / 2f + 30;
searchFieldGui = new SearchFieldGui("Search...", (int) x, (int) y + 60, 100, 19, getAnimation()).addOutline(true);
if (!text.isEmpty()) {
searchFieldGui.setText(text);
}
super.init();
}
@Override
public void onClose() {
text = searchFieldGui.getText().isEmpty() ? "" : searchFieldGui.getText();
GLFW.glfwSetCursor(mc.getWindow().getWindow(),
GLFW.glfwCreateStandardCursor(GLFW.GLFW_ARROW_CURSOR));
super.onClose();
}
public static int light = new Color(129, 134, 153).getRGB();
public static float scale = 1.0f;
@Override
public void render(GuiGraphics graphics, int mouseX, int mouseY, float partialTicks) {
animation.update();
if (animation.getValue() < 0.1) {
onClose();
}
float width = categoryes.size() * 155;
int wW = MathUtil.calc(mc.getWindow().getGuiScaledWidth());
int wH = MathUtil.calc(mc.getWindow().getGuiScaledHeight());
Vector2i mousePos = getCenterPos(mouseX, mouseY);
mouseX = mousePos.getX();
mouseY = mousePos.getY();
boolean needScissor = mc.getWindow().getWidth() > 400 && mc.getWindow().getHeight() > 400;
float panelSpacing = 5;
for (int i = 0; i < categoryes.size(); i++) {
PanelGui panelGui = categoryes.get(i);
float baseY = (wH / 2f) - 150;
panelGui.setY(baseY + globalScroll);
for (ModuleOptionComponent renderer : panelGui.getModules().stream()
.filter(moduleOptionComponent -> !CheckIsSearchNeededText(moduleOptionComponent.getFunction().getName())).toList()) {
if (MouseUtil.isHovered(renderer.getX(), renderer.getY(), mouseX, mouseY, renderer.getWidth(), renderer.getHeight())) {
Fonts.montserrat[16].drawString(renderer.getFunction().getDescription(),
MathUtil.calc(mc.getWindow().getGuiScaledWidth()
- (int) (Fonts.montserrat[16].getWidth(renderer.getFunction().getDescription()))) / 2f, 13,
ColorUtils.rgba(255, 255, 255, 255));
}
}
ResourceLocation backgroundImage = new ResourceLocation("Blade/Icon/world_render/tiger.png");
float val = (float) animation.getValue() * scale;
float halfVal = (1 - val) / 2f;
float scissorX = panelGui.getX() + (panelGui.getWidth() * halfVal) - 2;
float scissorY = panelGui.getY() + (panelGui.getHeight() * halfVal) - 2;
float scissorW = panelGui.getWidth() * val + 4;
if (needScissor)
graphics.enableScissor(scissorX, scissorY, scissorX + scissorW,
(scissorY + (panelGui.getHeight()) + 5 * val));
panelGui.setX((wW / 2f) - ((width) * 0.425f) + (panelGui.getCategory().ordinal() * (134 + panelSpacing)));
panelGui.render(graphics, mouseX, mouseY);
if (needScissor)
graphics.disableScissor();
}
searchFieldGui.render(graphics);
}
@Override
public boolean mouseScrolled(double mouseX, double mouseY, double deltaX, double deltaY) {
Vector2i mousePos = getCenterPos(mouseX, mouseY);
mouseX = mousePos.getX();
mouseY = mousePos.getY();
globalScroll += (float) (deltaY * SCROLL_SPEED);
globalScroll = Math.max(MIN_SCROLL, Math.min(MAX_SCROLL, globalScroll));
return true;
}
@Override
public boolean charTyped(char code, int mod) {
searchFieldGui.charTyped(code);
for (PanelGui panelGui : categoryes) {
panelGui.charTyped(code, mod);
}
return super.charTyped(code, mod);
}
@Override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
searchFieldGui.keyPressed(keyCode);
for (PanelGui panelGui : categoryes) {
panelGui.keyPressed(keyCode, scanCode, modifiers);
}
if (keyCode == GLFW.GLFW_KEY_ESCAPE) {
animation.animate(0, 0.25f, Easings.SINE_OUT);
return false;
}
return super.keyPressed(keyCode, scanCode, modifiers);
}
@Override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
Vector2i mousePos = getCenterPos(mouseX, mouseY);
mouseX = mousePos.getX();
mouseY = mousePos.getY();
if (searchFieldGui.mouseClick(mouseX, mouseY, button)) {
return true;
}
for (PanelGui panelGui : categoryes) {
panelGui.mouseClick((float) mouseX, (float) mouseY, button);
}
return super.mouseClicked(mouseX, mouseY, button);
}
@Override
public boolean mouseReleased(double mouseX, double mouseY, int button) {
Vector2i mousePos = getCenterPos(mouseX, mouseY);
mouseX = mousePos.getX();
mouseY = mousePos.getY();
for (PanelGui panelGui : categoryes) {
panelGui.mouseRelease((float) mouseX, (float) mouseY, button);
}
return super.mouseReleased(mouseX, mouseY, button);
}
public Vector2i getCenterPos(double mX, double mY) {
float x = (float) (mX - mc.getWindow().getGuiScaledWidth() / 2f) / scale
+ mc.getWindow().getGuiScaledWidth() / 2f;
return new Vector2i((int) (x * mc.getWindow().getGuiScale() / 2), (int) mY);
}
public boolean isSearching() {
return !searchFieldGui.getText().isEmpty();
}
public String getSearchText() {
return searchFieldGui.getText();
}
public boolean CheckIsSearchNeededText(String text) {
return isSearching() && !text.replaceAll(" ", "").toLowerCase().contains(getSearchText().replaceAll(" ", "").toLowerCase());
}
public Animation getAnimation() {
return animation;
}
}
PanelGui:
package ru.blade.System.InterfaceSystem.ClickGui;
import net.minecraft.client.gui.GuiGraphics;
import ru.blade.BladeClient;
import ru.blade.System.EventSystem.core.Interface.IMinecraft;
import ru.blade.System.InterfaceSystem.ClickGui.api.component.Component;
import ru.blade.System.InterfaceSystem.ClickGui.api.component.IComponent;
import ru.blade.System.InterfaceSystem.ClickGui.impl.ModuleOptionComponent;
import ru.blade.System.ModuleSystem.api.Category;
import ru.blade.System.ModuleSystem.api.Module;
import ru.blade.System.ModuleSystem.core.render.Hud;
import ru.blade.System.UtilsSystem.font.Fonts;
import ru.blade.System.UtilsSystem.math.common.MathUtil;
import ru.blade.System.UtilsSystem.render.ColorUtils;
import ru.blade.System.UtilsSystem.render.Display;
import java.util.ArrayList;
import java.util.List;
@SuppressWarnings("all")
public class PanelGui implements IComponent, IMinecraft {
private final Category selected;
protected float x, y;
protected final float width = 130f;
protected float height;
public List<ModuleOptionComponent> modules = new ArrayList<>();
private float scroll = 0;
private static final float SCROLL_SPEED = 5.0f;
private static final float MAX_SCROLL_DOWN = 100.0f;
private static final float MAX_SCROLL_UP = 0.0f;
private final float headerHeight = 20;
public PanelGui(Category selected) {
this.selected = selected;
height = headerHeight;
if (BladeClient.instance.getModuleInstance() != null) {
for (Module function : BladeClient.instance.getModuleInstance().getAll()) {
if (function.getCategory() != selected) continue;
ModuleOptionComponent renderer = new ModuleOptionComponent(function);
modules.add(renderer);
}
}
calculateHeight();
}
private void calculateHeight() {
float componentsHeight = 0;
if (BladeClient.instance.getDropGui() != null) {
for (ModuleOptionComponent component : modules) {
if (!BladeClient.instance.getDropGui().CheckIsSearchNeededText(component.getFunction().getName())) {
componentsHeight += component.getHeight() + 3.5f;
}
}
}
height = headerHeight + componentsHeight;
}
@Override
public void render(GuiGraphics graphics, float mouseX, float mouseY) {
// animatedScroll = MathUtil.fast(animatedScroll, scroll, 20);
Display.drawTwoColorGradientRound(x - 1, y - 1, width + 2, height + 2, 6, Hud.getTheme(7), Hud.getTheme(7));
Display.drawRoundedRect(x, y, width, height, 6, ColorUtils.rgba(9, 9, 9, 255));
float length = Fonts.sf_semibold[18].getWidth(selected.name());
Fonts.sf_semibold[18].drawString(selected.name(), x + (width / 2f) - (length / 2f), y + 24.5f / 2f - 2.75f, Hud.getTheme(5));
renderIComponents(graphics, mouseX, mouseY);
}
float max = 0;
public void renderIComponents(GuiGraphics graphics, float mouseX, float mouseY) {
float value = (float) BladeClient.instance.getDropGui().getAnimation().getValue();
float offSet = 0;
for (ModuleOptionComponent renderer : modules) {
if (BladeClient.instance.getDropGui().CheckIsSearchNeededText(renderer.getFunction().getName())) {
continue;
}
renderer.x = (getX() + 5);
renderer.y = (getY() + headerHeight + offSet + scroll);
renderer.width = getWidth() - 10;
renderer.height = 20;
renderer.alphaAnimation.update();
if (renderer.alphaAnimation.getValue() > 0) {
float compOff = 0;
for (Component render : renderer.getComponents()) {
if (render.isShown()) {
compOff += render.getHeight();
}
}
compOff *= renderer.getAnimation().getValue();
renderer.height = renderer.getHeight() + compOff;
}
renderer.render(graphics, mouseX, mouseY);
offSet += renderer.height + 3.5f;
}
max = offSet;
calculateHeight();
}
@Override
public void keyPressed(int key, int scanCode, int modifiers) {
for (ModuleOptionComponent component : modules) {
component.keyPressed(key, scanCode, modifiers);
}
}
@Override
public void mouseClick(float mouseX, float mouseY, int button) {
for (ModuleOptionComponent component : modules) {
if (BladeClient.instance.getDropGui().CheckIsSearchNeededText(component.getFunction().getName())) {
continue;
}
if (mouseX >= getX() && mouseX <= getX() + getWidth() && mouseY >= getY() && mouseY <= getY() + getHeight()) {
component.mouseClick(mouseX, mouseY, button);
}
}
}
public void mouseScroll(double mX, double mY, double d) {
if (mX >= getX() && mX <= getX() + getWidth() && mY >= getY() && mY <= getY() + getHeight()) {
if (max > height - headerHeight) {
scroll += (float) (d * SCROLL_SPEED);
float maxScrollDown = -(max - (height - headerHeight));
scroll = Math.max(maxScrollDown, Math.min(MAX_SCROLL_UP, scroll));
}
}
for (ModuleOptionComponent renderer : modules) {
renderer.mouseScrolled(mX, mY, d);
}
}
@Override
public void charTyped(char codePoints, int modifiers) {
for (ModuleOptionComponent renderer : modules) {
renderer.charTyped(codePoints, modifiers);
}
}
@Override
public void mouseRelease(float mouseX, float mouseY, int mouse) {
for (ModuleOptionComponent renderer : modules) {
renderer.mouseRelease(mouseX, mouseY, mouse);
}
}
public float getHeight() {
return height;
}
public float getWidth() {
return width;
}
public float getX() {
return x;
}
public float getY() {
return y;
}
public float getScroll() {
return scroll;
}
public Category getCategory() {
return selected;
}
public void setX(float x) {
this.x = x;
}
public void setY(float y) {
this.y = y;
}
public void setScroll(float scroll) {
this.scroll = scroll;
}
public List<ModuleOptionComponent> getModules() {
return modules;
}
}