This commit is contained in:
kirillsaint 2023-07-22 14:09:31 +06:00
parent dcc76c9dd7
commit b3b549e693
6 changed files with 70 additions and 45 deletions

View File

@ -16,7 +16,6 @@ import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.Input;
import net.silentclient.client.gui.elements.Switch;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.font.SilentFontRenderer.FontType;
import net.silentclient.client.gui.hud.HUDConfigScreen;
import net.silentclient.client.gui.lite.clickgui.utils.GlUtils;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
@ -124,30 +123,33 @@ public class ClickGUI extends SilentScreen {
boolean headerHovered = MouseUtils.isInside(mouseX, mouseY, modOffsetX, y, width, 25);
if(selectedCategory != ModCategory.PLUS && selectedCategory != ModCategory.CONFIGS) {
for(Mod m : getMods()) {
float switchX = modOffsetX + ((65 / 2) - (15 / 2));
float switchY = y + modOffsetY - scrollAnimation.getValue() + 55;
boolean switchHovered = selectedCategory.equals(ModCategory.MODS) && Switch.isHovered(mouseX, mouseY, switchX, switchY) && !headerHovered;
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, modOffsetX, y + modOffsetY - scrollAnimation.getValue(), 65, 70) && !headerHovered && !switchHovered && (Client.getInstance().getSettingsManager().getSettingByMod(m).size() != 0 || m.getName() == "Auto Text");
RenderUtil.drawRoundedOutline(modOffsetX, y + modOffsetY - scrollAnimation.getValue(), 65, 70, 3, 1, Theme.borderColor().getRGB());
RenderUtil.drawRoundedRect(modOffsetX, y + modOffsetY - scrollAnimation.getValue(), 65, 70, 3, new Color(255, 255, 255, isHovered ? 30 : 0).getRGB());
GL11.glColor4f(1, 1, 1, 1);
Client.getInstance().getSilentFontRenderer().drawString(m.getName(), modOffsetX + ((65 / 2) - ((Client.getInstance().getSilentFontRenderer().getStringWidth(m.getName(), 8, FontType.HEADER)) / 2)), y + modOffsetY - scrollAnimation.getValue() + 4, 8, FontType.HEADER);
if(m.getIcon() != null) {
RenderUtil.drawImage(new ResourceLocation(m.getIcon()), modOffsetX + ((65 / 2) - 10), y + modOffsetY - scrollAnimation.getValue() + ((70 / 2) - 10), 20, 20, false);
}
if(selectedCategory.equals(ModCategory.MODS)) {
Switch.render(mouseX, mouseY, switchX, switchY, m.switchAniamation, m.isEnabled(), m.isForceDisabled());
}
if(m.isUpdated() || m.isNew()) {
String status = "UPDATED";
if(m.isNew()) {
status = "NEW";
if(mouseInContent(x, (int) (modOffsetY - scrollAnimation.getValue()), y + 25, height - 25) || mouseInContent(x, (int) (modOffsetY - scrollAnimation.getValue() + 70), y + 25, height - 25)) {
float switchX = modOffsetX + ((65 / 2) - (15 / 2));
float switchY = y + modOffsetY - scrollAnimation.getValue() + 55;
boolean switchHovered = selectedCategory.equals(ModCategory.MODS) && Switch.isHovered(mouseX, mouseY, switchX, switchY) && !headerHovered;
boolean isHovered = MouseUtils.isInside(mouseX, mouseY, modOffsetX, y + modOffsetY - scrollAnimation.getValue(), 65, 70) && !headerHovered && !switchHovered && (Client.getInstance().getSettingsManager().getSettingByMod(m).size() != 0 || m.getName() == "Auto Text");
RenderUtil.drawRoundedOutline(modOffsetX, y + modOffsetY - scrollAnimation.getValue(), 65, 70, 3, 1, Theme.borderColor().getRGB());
RenderUtil.drawRoundedRect(modOffsetX, y + modOffsetY - scrollAnimation.getValue(), 65, 70, 3, new Color(255, 255, 255, isHovered ? 30 : 0).getRGB());
GL11.glColor4f(1, 1, 1, 1);
Client.getInstance().getSilentFontRenderer().drawString(m.getName(), modOffsetX + ((65 / 2) - ((Client.getInstance().getSilentFontRenderer().getStringWidth(m.getName(), 8, SilentFontRenderer.FontType.HEADER)) / 2)), y + modOffsetY - scrollAnimation.getValue() + 4, 8, SilentFontRenderer.FontType.HEADER);
if(m.getIcon() != null) {
RenderUtil.drawImage(new ResourceLocation(m.getIcon()), modOffsetX + ((65 / 2) - 10), y + modOffsetY - scrollAnimation.getValue() + ((70 / 2) - 10), 20, 20, false);
}
if(selectedCategory.equals(ModCategory.MODS)) {
Switch.render(mouseX, mouseY, switchX, switchY, m.switchAniamation, m.isEnabled(), m.isForceDisabled());
}
if(m.isUpdated() || m.isNew()) {
String status = "UPDATED";
if(m.isNew()) {
status = "NEW";
}
float badgeX = modOffsetX + ((65 / 2) - 15);
float badgeY = y + modOffsetY - scrollAnimation.getValue() + 13;
RenderUtil.drawRoundedRect(badgeX, badgeY, 30, 8, 8, Color.RED.getRGB());
Client.getInstance().getSilentFontRenderer().drawString(status, badgeX + (status.equals("UPDATED") ? 3 : 9), badgeY + 1, 6, SilentFontRenderer.FontType.HEADER);
}
float badgeX = modOffsetX + ((65 / 2) - 15);
float badgeY = y + modOffsetY - scrollAnimation.getValue() + 13;
RenderUtil.drawRoundedRect(badgeX, badgeY, 30, 8, 8, Color.RED.getRGB());
Client.getInstance().getSilentFontRenderer().drawString(status, badgeX + (status.equals("UPDATED") ? 3 : 9), badgeY + 1, 6, SilentFontRenderer.FontType.HEADER);
}
modOffsetY += column == 4 ? 75 : 0;
@ -247,6 +249,10 @@ public class ClickGUI extends SilentScreen {
}
}
public static boolean mouseInContent(int mouseX, int mouseY, int y, int height) {
return MouseUtils.isInside(mouseX, mouseY, mouseX, y,mouseX + 1, height);
}
private ArrayList<Mod> getMods() {
if(this.silentInputs.get(0).getValue().trim().equals("") || !selectedCategory.equals(ModCategory.MODS)) {
return Client.getInstance().getModInstances().getModByCategory(selectedCategory);

View File

@ -108,7 +108,6 @@ public class ModMenu extends SilentScreen {
}
public static void drawOverlayListBase(float height, String header) {
ModMenu.introAnimation.setAnimation(0, 30);
GlStateManager.translate(ModMenu.introAnimation.getValue(), 0, 0);
RenderUtils.drawRect(0, 0, 150, height, Theme.backgroundColor().getRGB());
RenderUtil.drawImage(new ResourceLocation("silentclient/logos/logo.png"), 3, 3, 97.7F, 19);
@ -122,6 +121,9 @@ public class ModMenu extends SilentScreen {
if(ModMenu.introAnimation.getValue() == 0) {
ModMenu.loaded = true;
}
if(!loaded) {
ModMenu.introAnimation.setAnimation(0, 30);
}
MenuBlurUtils.renderBackground(this);
ModMenu.drawOverlayListBase(height, modCategory == ModCategory.PLUS ? "Premium" : null);
@ -345,8 +347,12 @@ public class ModMenu extends SilentScreen {
scrollAnimation.setValue(0);
}
public static boolean mouseInContent(int mouseX, int mouseY, float height, boolean mainMenu) {
return MouseUtils.isInside(mouseX, mouseY, 0, 66, 150, height - 66 - (mainMenu ? 21 : 0));
}
public static boolean mouseInContent(int mouseX, int mouseY, float height) {
return MouseUtils.isInside(mouseX, mouseY, 0, 66, 150, height - 66 - 21);
return mouseInContent(mouseX, mouseY, height, true);
}
@Override

View File

@ -172,6 +172,10 @@ public class ModSettings extends SilentScreen {
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
if(!ModMenu.mouseInContent(mouseX, mouseY, height, false)) {
return;
}
float settingY = 66 - scrollAnimation.getValue();
int inputIndex = 0;

View File

@ -1,6 +1,5 @@
package net.silentclient.client.keybinds;
import net.minecraft.client.Minecraft;
import net.minecraft.client.settings.GameSettings;
import net.minecraft.client.settings.KeyBinding;
import org.apache.commons.lang3.ArrayUtils;
@ -11,10 +10,12 @@ import java.util.Arrays;
public class KeyBindManager {
public KeyBinding CLICKGUI = new KeyBinding("Silent Client - Mod Menu", Keyboard.KEY_RSHIFT, "Silent Client");
public KeyBinding PERSPECTIVE = new KeyBinding("Silent Client - Perspective", Keyboard.KEY_LMENU, "Silent Client");
public KeyBinding ZOOM = new KeyBinding("Silent Client - Zoom", Keyboard.KEY_C, "Silent Client");
public KeyBindManager(GameSettings gameSettings) {
this.registerKeyBind(gameSettings, CLICKGUI);
this.registerKeyBind(gameSettings, PERSPECTIVE);
this.registerKeyBind(gameSettings, ZOOM);
}
public void registerKeyBind(GameSettings gameSettings, KeyBinding key) {

View File

@ -23,6 +23,7 @@ import net.silentclient.client.gui.lite.LiteMainMenu;
import net.silentclient.client.gui.silentmainmenu.SilentMainMenu;
import net.silentclient.client.gui.util.BackgroundPanorama;
import net.silentclient.client.hooks.MinecraftHook;
import net.silentclient.client.mods.player.ZoomMod;
import net.silentclient.client.mods.render.AnimationsMod;
import net.silentclient.client.mods.settings.FPSBoostMod;
import org.apache.commons.lang3.SystemUtils;
@ -36,9 +37,7 @@ import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.*;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import java.io.File;
@ -213,6 +212,14 @@ public abstract class MinecraftMixin {
event.call();
}
@Redirect(method = "runTick", at = @At(value = "INVOKE", target = "Lorg/lwjgl/input/Mouse;getEventDWheel()I"))
public int cancelScroll() {
if(!Client.getInstance().getModInstances().getZoomMod().isEnabled() || !Client.getInstance().getModInstances().getZoomMod().isActive() || !Client.getInstance().getSettingsManager().getSettingByClass(ZoomMod.class, "Scroll").getValBoolean()) {
return Mouse.getEventDWheel();
}
return 0;
}
@Inject(method = "setInitialDisplayMode", at = @At(value = "HEAD"), cancellable = true)
private void setInitialDisplayMode(CallbackInfo ci) throws LWJGLException {
MinecraftHook.displayFix(ci, fullscreen, displayWidth, displayHeight);

View File

@ -8,6 +8,7 @@ import net.silentclient.client.event.impl.EventZoomFov;
import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModCategory;
import org.lwjgl.input.Keyboard;
public class ZoomMod extends Mod {
public ZoomMod() {
@ -37,21 +38,21 @@ public class ZoomMod extends Mod {
@EventTarget
public void onTick(ClientTickEvent event) {
// if(mc.gameSettings.ofKeyBindZoom.isKeyDown()) {
// if(!active) {
// active = true;
// lastSensitivity = mc.gameSettings.mouseSensitivity;
// resetFactor();
// wasCinematic = this.mc.gameSettings.smoothCamera;
// mc.gameSettings.smoothCamera = Client.getInstance().getSettingsManager().getSettingByName(this, "Smooth Camera").getValBoolean();
// mc.renderGlobal.setDisplayListEntitiesDirty();
// }
// }else if(active) {
// active = false;
// setFactor(1);
// mc.gameSettings.mouseSensitivity = lastSensitivity;
// mc.gameSettings.smoothCamera = wasCinematic;
// }
if(Keyboard.isKeyDown(Client.getInstance().getKeyBindManager().ZOOM.getKeyCode()) && mc.inGameHasFocus) {
if(!active) {
active = true;
lastSensitivity = mc.gameSettings.mouseSensitivity;
resetFactor();
wasCinematic = this.mc.gameSettings.smoothCamera;
mc.gameSettings.smoothCamera = Client.getInstance().getSettingsManager().getSettingByName(this, "Smooth Camera").getValBoolean();
mc.renderGlobal.setDisplayListEntitiesDirty();
}
}else if(active) {
active = false;
setFactor(1);
mc.gameSettings.mouseSensitivity = lastSensitivity;
mc.gameSettings.smoothCamera = wasCinematic;
}
}
@EventTarget