Skip to content
This repository has been archived by the owner on Nov 6, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
Pan4ur committed Aug 13, 2024
2 parents 40cf026 + 11918fd commit 8294d1d
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 25 deletions.
25 changes: 19 additions & 6 deletions src/main/java/thunder/hack/gui/clickui/ClickGUI.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import java.util.Objects;

import static thunder.hack.features.modules.Module.mc;
import static thunder.hack.features.modules.client.ClientSettings.isRu;

public class ClickGUI extends Screen {
public static List<AbstractCategory> windows;
Expand Down Expand Up @@ -202,12 +203,24 @@ public void render(DrawContext context, int mouseX, int mouseY, float delta) {

if (ModuleManager.clickGui.tips.getValue() && !close)
FontRenderers.sf_medium.drawString(context.getMatrices(),
"Left Mouse Click to enable module" +
"\nRight Mouse Click to open module settings\nMiddle Mouse Click to bind module" +
"\nCtrl + F to start searching\nDrag n Drop config there to load" +
"\nShift + Left Mouse Click to change module visibility in array list" +
isRu() ? "Щелкните левой кнопкой мыши, чтобы включить модуль." +
"\nЩелкните правой кнопкой мыши, чтобы открыть настройки модуля." +
"\nЩелкните колёсиком мыши, чтобы привязать модуль" +
"\nCtrl + F, чтобы начать поиск" +
"\nПерекиньте конфиг в окошко майна, чтобы загрузить его" +
"\nShift + Left Mouse Click, чтобы изменить отображение модуля в Array list" +
"\nЩелкните колёсиком мыши по слайдеру, чтобы ввести значение с клавиатуры." +
"\nDelete + Left Mouse Click по модулю, чтобы сбросить его настройки"
:
"Left Mouse Click to enable module" +
"\nRight Mouse Click to open module settings" +
"\nMiddle Mouse Click to bind module" +
"\nCtrl + F to start searching" +
"\nDrag n Drop config there to load" +
"\nShift + Left Mouse Click to change module visibility in Array list" +
"\nMiddle Mouse Click on slider to enter value from keyboard" +
"\nDelete + Left Mouse Click on module to reset", 5, mc.getWindow().getScaledHeight() - 80, HudEditor.getColor(0).getRGB());
"\nDelete + Left Mouse Click on module to reset",
5, mc.getWindow().getScaledHeight() - 80, HudEditor.getColor(0).getRGB());

if (!HudElement.anyHovered && !ClickGUI.anyHovered)
if (GLFW.glfwGetPlatform() != GLFW.GLFW_PLATFORM_WAYLAND) {
Expand Down Expand Up @@ -281,4 +294,4 @@ public boolean keyPressed(int keyCode, int scanCode, int modifiers) {

return false;
}
}
}
25 changes: 14 additions & 11 deletions src/main/java/thunder/hack/gui/clickui/ModuleButton.java
Original file line number Diff line number Diff line change
Expand Up @@ -278,16 +278,19 @@ public void mouseClicked(int mouseX, int mouseY, int button) {
}

if (InputUtil.isKeyPressed(mc.getWindow().getHandle(), InputUtil.GLFW_KEY_DELETE) && button == 0) {
DialogScreen dialogScreen = new DialogScreen(isRu() ? "Сброс модуля" : "Reset module",
isRu() ? "Ты действительно хочешь сбросить " + module.getName() + "?" : "Are you sure you want to reset " + module.getName() + "?",
isRu() ? "Да ебать" : "Do it, piece of shit!", isRu() ? "Не, че за хуйня?" : "Nooo fuck ur ass nigga!",
() -> {
if (module.isEnabled())
module.disable("reseting");
for (Setting s : module.getSettings())
s.setValue(s.getDefaultValue());
mc.setScreen(null);
}, () -> mc.setScreen(null));
DialogScreen dialogScreen = new DialogScreen(
TextureStorage.questionPic,
isRu() ? "Сброс модуля" : "Reset module",
isRu() ? "Ты действительно хочешь сбросить " + module.getName() + "?" : "Are you sure you want to reset " + module.getName() + "?",
isRu() ? "Да" : "Yes",
isRu() ? "Нет" : "No",
() -> {
if (module.isEnabled())
module.disable("reseting");
for (Setting s : module.getSettings())
s.setValue(s.getDefaultValue());
mc.setScreen(null);
}, () -> mc.setScreen(null));
mc.setScreen(dialogScreen);
}

Expand Down Expand Up @@ -376,4 +379,4 @@ public void tick() {
ticksOpened = 0;
}
}
}
}
6 changes: 4 additions & 2 deletions src/main/java/thunder/hack/gui/misc/DialogScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,17 @@
import static thunder.hack.features.modules.Module.mc;

public class DialogScreen extends Screen {
private final Identifier pic;
private final String header;
private final String description;
private final String yesText;
private final String noText;
private final Runnable yesAction;
private final Runnable noAction;

public DialogScreen(String header, String description, String yesText, String noText, Runnable yesAction, Runnable noAction) {
public DialogScreen(Identifier pic, String header, String description, String yesText, String noText, Runnable yesAction, Runnable noAction) {
super(Text.of("ThDialogScreen"));
this.pic = pic;
this.header = header;
this.description = description;
this.yesText = yesText;
Expand Down Expand Up @@ -52,7 +54,7 @@ public void render(@NotNull DrawContext context, int mouseX, int mouseY, float d
Render2DEngine.drawHudBase(context.getMatrices(), mainX + 125, mainY + 95, 110, 40, 15, false);
FontRenderers.sf_medium.drawCenteredString(context.getMatrices(), noText, mainX + 180f, mainY + 112, noHovered(mouseX, mouseY) ? -1 : new Color(0xABFFFFFF, true).getRGB());

context.drawTexture(TextureStorage.questionPic, (int) (mainX + (mainWidth / 2f) - 35), (int) mainY + 25, 0, 0, 70, 65, 70, 65);
context.drawTexture(pic, (int) (mainX + (mainWidth / 2f) - 35), (int) mainY + 25, 0, 0, 70, 65, 70, 65);
}

private boolean isHovered(int mouseX, int mouseY, int x, int y, int width, int height) {
Expand Down
17 changes: 12 additions & 5 deletions src/main/java/thunder/hack/injection/MixinScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import thunder.hack.features.modules.client.ClientSettings;
import thunder.hack.utility.math.MathUtility;
import thunder.hack.utility.render.Render2DEngine;
import thunder.hack.utility.render.TextureStorage;

import java.io.BufferedReader;
import java.io.File;
Expand Down Expand Up @@ -56,9 +57,12 @@ public void filesDragged(List<Path> paths, CallbackInfo ci) {
String fileName = cfgFile.getName();

if (fileName.contains(".th")) {
DialogScreen dialogScreen = new DialogScreen(isRu() ? "Обнаружен конфиг!" : "Config detected!",
DialogScreen dialogScreen = new DialogScreen(
TextureStorage.questionPic,
isRu() ? "Обнаружен конфиг!" : "Config detected!",
isRu() ? "Ты действительно хочешь загрузить " + fileName + "?" : "Are you sure you want to load " + fileName + "?",
isRu() ? "Да ебать" : "Do it, piece of shit!", isRu() ? "Не, че за хуйня?" : "Nooo fuck ur ass nigga!",
isRu() ? "Да" : "Yes",
isRu() ? "Нет" : "No",
() -> {
Managers.MODULE.onUnload("none");
Managers.CONFIG.load(cfgFile);
Expand All @@ -68,9 +72,12 @@ public void filesDragged(List<Path> paths, CallbackInfo ci) {
mc.setScreen(dialogScreen);

} else if (fileName.contains(".txt")){
DialogScreen dialogScreen2 = new DialogScreen(isRu() ? "Обнаружен текстовый файл!" : "Text file detected!",
DialogScreen dialogScreen2 = new DialogScreen(
TextureStorage.questionPic,
isRu() ? "Обнаружен текстовый файл!" : "Text file detected!",
isRu() ? "Импортировать файл " + fileName + " как" : "Import file " + fileName + " as",
isRu() ? "Прокси" : "Proxies", isRu() ? "Забить" : "Cancel",
isRu() ? "Прокси" : "Proxies",
isRu() ? "Забить" : "Cancel",
() -> {
try {
try (BufferedReader reader = new BufferedReader(new FileReader(cfgFile))) {
Expand Down Expand Up @@ -125,4 +132,4 @@ public void onRenderBackground(DrawContext context, int mouseX, int mouseY, floa
ci.cancel();
}
}
}
}
40 changes: 39 additions & 1 deletion src/main/java/thunder/hack/injection/MixinTitleScreen.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import net.minecraft.client.gui.screen.ConfirmScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.TitleScreen;
import net.minecraft.client.util.InputUtil;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;
import net.minecraft.util.Util;
Expand All @@ -12,12 +13,16 @@
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import thunder.hack.ThunderHack;
import thunder.hack.gui.misc.DialogScreen;
import thunder.hack.gui.mainmenu.MainMenuScreen;
import thunder.hack.utility.render.TextureStorage;
import thunder.hack.core.manager.client.ModuleManager;
import thunder.hack.features.modules.client.ClientSettings;

import java.net.URI;

import static thunder.hack.features.modules.Module.mc;
import static thunder.hack.features.modules.client.ClientSettings.isRu;

@Mixin(TitleScreen.class)
public class MixinTitleScreen extends Screen {
Expand All @@ -27,9 +32,42 @@ protected MixinTitleScreen(Text title) {

@Inject(method = "init", at = @At("RETURN"))
public void postInitHook(CallbackInfo ci) {
if (ClientSettings.customMainMenu.getValue() && !MainMenuScreen.getInstance().confirm) {
if (ClientSettings.customMainMenu.getValue() && !MainMenuScreen.getInstance().confirm && ModuleManager.clickGui.getBind().getKey() != -1) {
mc.setScreen(MainMenuScreen.getInstance());
}
if (ModuleManager.clickGui.getBind().getKey() == -1) {
DialogScreen dialogScreen2 = new DialogScreen(
TextureStorage.cutie,
isRu() ? "Спасибо что скачали ThunderHack!" : "Thank you for downloading ThunderHack!",
isRu() ? "Меню с функциями клиента открывается на клавишу - P" : "Menu with client modules is opened with the key - P",
isRu() ? "Зайти в майн" : "Join on minecraft",
isRu() ? "Закрыть майн" : "Close minecraft",
() -> {
ModuleManager.clickGui.setBind(InputUtil.fromTranslationKey("key.keyboard.p").getCode(), false, false);
mc.setScreen(MainMenuScreen.getInstance());
},
() -> {
ModuleManager.clickGui.setBind(InputUtil.fromTranslationKey("key.keyboard.p").getCode(), false, false);
mc.stop();
}
);
DialogScreen dialogScreen1 = new DialogScreen(
TextureStorage.questionPic,
"Hello!",
"What's your language?",
"Русский",
"English",
() -> {
ClientSettings.language.setValue(ClientSettings.Language.RU);
mc.setScreen(dialogScreen2);
},
() -> {
ClientSettings.language.setValue(ClientSettings.Language.ENG);
mc.setScreen(dialogScreen2);
}
);
mc.setScreen(dialogScreen1);
}

if (ThunderHack.isOutdated && !FabricLoader.getInstance().isDevelopmentEnvironment()) {
mc.setScreen(new ConfirmScreen(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,4 +47,5 @@ public final class TextureStorage {
public static final Identifier sunRiseSkin = Identifier.of("thunderhack", "textures/misc/sunskin.png");
public static final Identifier crackedSkin = Identifier.of("thunderhack", "textures/gui/elements/cracked.png");
public static final Identifier questionPic = Identifier.of("thunderhack", "textures/gui/helper/pic1.png");
public static final Identifier cutie = Identifier.of("thunderhack", "textures/gui/images/cutie.png");
}

0 comments on commit 8294d1d

Please sign in to comment.