Merge pull request #6 from Silent-Client/TEST2

Test2
This commit is contained in:
kirillsaint 2023-07-27 18:55:40 +06:00 committed by GitHub
commit 4b76d2a083
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 21 deletions

View File

@ -44,9 +44,10 @@ public class OutfitsGui extends SilentScreen {
} else {
MenuBlurUtils.loadBlur();
}
int width = 250;
int x = this.width / 2 - 125;
int y = this.height / 2 - 100;
int width = 255;
int height = 200;
int x = this.width / 2 - (width / 2);
int y = this.height / 2 - (height / 2);
this.buttonList.add(new IconButton(0, x + width - 14 - 3, y + 3, 14, 14, 8, 8, new ResourceLocation("silentclient/icons/exit.png")));
}
@ -60,10 +61,10 @@ public class OutfitsGui extends SilentScreen {
} else {
MenuBlurUtils.renderBackground(this);
}
int width = 250;
int width = 255;
int height = 200;
int x = this.width / 2 - 125;
int y = this.height / 2 - 100;
int x = this.width / 2 - (width / 2);
int y = this.height / 2 - (height / 2);
RenderUtil.drawRoundedRect(x, y, width, height, 4, Theme.backgroundColor().getRGB());
Client.getInstance().getSilentFontRenderer().drawString(x + 3, y + 3, "Outfits", 14, SilentFontRenderer.FontType.TITLE);
super.drawScreen(mouseX, mouseY, partialTicks);
@ -72,7 +73,7 @@ public class OutfitsGui extends SilentScreen {
ScaledResolution r = new ScaledResolution(Minecraft.getMinecraft());
int s = r.getScaleFactor();
int listHeight = height - 20;
int translatedY = r.getScaledHeight() - 20 - 20 - listHeight;
int translatedY = r.getScaledHeight() - y - 20 - listHeight;
GL11.glScissor(0 * s, translatedY * s, this.width * s, listHeight * s);
int outfitX = x + 3;
float outfitY = (int) (y + 20 - scrollAnimation.getValue());
@ -205,10 +206,10 @@ public class OutfitsGui extends SilentScreen {
@Override
protected void mouseClicked(int mouseX, int mouseY, int mouseButton) throws IOException {
super.mouseClicked(mouseX, mouseY, mouseButton);
int width = 250;
int width = 255;
int height = 200;
int x = this.width / 2 - 125;
int y = this.height / 2 - 100;
int x = this.width / 2 - (width / 2);
int y = this.height / 2 - (height / 2);
int outfitX = x + 3;
float outfitY = (int) (y + 20 - scrollAnimation.getValue());
int outfitIndex = 0;

View File

@ -7,17 +7,16 @@ import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.gui.animation.SimpleAnimation;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.elements.Button;
import net.silentclient.client.gui.elements.IconButton;
import net.silentclient.client.gui.font.SilentFontRenderer;
import net.silentclient.client.gui.notification.NotificationManager;
import net.silentclient.client.gui.lite.clickgui.utils.MouseUtils;
import net.silentclient.client.gui.lite.clickgui.utils.RenderUtils;
import net.silentclient.client.gui.theme.Theme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.gui.theme.button.DefaultButtonTheme;
import net.silentclient.client.gui.theme.button.SelectedButtonTheme;
import net.silentclient.client.gui.util.RenderUtil;
import net.silentclient.client.mods.settings.GeneralMod;
import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.MenuBlurUtils;
import net.silentclient.client.utils.types.FriendsResponse;
@ -104,15 +103,14 @@ public class FriendsListOverlay extends GuiScreen {
GL11.glPopMatrix();
GlStateManager.popMatrix();
if(scrollY > height) {
scrollAnimation.setAnimation((float) scrollY, 16);
}
}
@Override
public void handleMouseInput() throws IOException {
super.handleMouseInput();
int dw = Mouse.getEventDWheel();
double newScrollY = this.scrollY;
if(dw != 0) {
if (dw > 0) {
dw = -1;
@ -120,10 +118,19 @@ public class FriendsListOverlay extends GuiScreen {
dw = 1;
}
float amountScrolled = (float) (dw * 10);
if (scrollY + amountScrolled > 0)
scrollY += amountScrolled;
int friendsHeight = (showRequests ? Client.getInstance().getFriends().getRequests().size() : Client.getInstance().getFriends().getFriends().size()) * 25;
if (newScrollY + amountScrolled > 0)
newScrollY += amountScrolled;
else
scrollY = 0;
newScrollY = 0;
if((newScrollY < friendsHeight && friendsHeight > height - 46) || amountScrolled < 0) {
this.scrollY = (float) newScrollY;
if(this.scrollY < 0) {
this.scrollY = 0;
}
}
}
}