diff options
| author | Lulonaut <lulonaut@lulonaut.tech> | 2023-07-27 18:12:51 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-07-27 18:12:51 +0200 |
| commit | 247239132ad481d5ba9d775e723e134ca116837e (patch) | |
| tree | 19ecbb2106b9fa818391fb7ab83d5750d30dac87 /src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java | |
| parent | 2c58c09f12eb4cceeacbb31fcca4804198be140b (diff) | |
| download | notenoughupdates-247239132ad481d5ba9d775e723e134ca116837e.tar.gz notenoughupdates-247239132ad481d5ba9d775e723e134ca116837e.tar.bz2 notenoughupdates-247239132ad481d5ba9d775e723e134ca116837e.zip | |
buttons for guild name & status in PV (#776)
Co-authored-by: nea <nea@nea.moe>
Diffstat (limited to 'src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java')
| -rw-r--r-- | src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java index 331d2ad3..a1135205 100644 --- a/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java +++ b/src/main/java/io/github/moulberry/notenoughupdates/profileviewer/BasicPage.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2022 NotEnoughUpdates contributors + * Copyright (C) 2022-2023 NotEnoughUpdates contributors * * This file is part of NotEnoughUpdates. * @@ -25,12 +25,14 @@ import com.google.gson.JsonObject; import com.mojang.authlib.GameProfile; import io.github.moulberry.notenoughupdates.NotEnoughUpdates; import io.github.moulberry.notenoughupdates.core.util.StringUtils; +import io.github.moulberry.notenoughupdates.core.util.render.RenderUtils; import io.github.moulberry.notenoughupdates.profileviewer.level.LevelPage; import io.github.moulberry.notenoughupdates.profileviewer.weight.lily.LilyWeight; import io.github.moulberry.notenoughupdates.profileviewer.weight.senither.SenitherWeight; import io.github.moulberry.notenoughupdates.profileviewer.weight.weight.Weight; import io.github.moulberry.notenoughupdates.util.Constants; import io.github.moulberry.notenoughupdates.util.PronounDB; +import io.github.moulberry.notenoughupdates.util.Rectangle; import io.github.moulberry.notenoughupdates.util.SBInfo; import io.github.moulberry.notenoughupdates.util.Utils; import net.minecraft.client.Minecraft; @@ -121,6 +123,7 @@ public class BasicPage extends GuiProfileViewerPage { private boolean onSecondPage; private final LevelPage levelPage; + private boolean clickedLoadStatusButton = false; public BasicPage(GuiProfileViewer instance) { super(instance); @@ -141,7 +144,7 @@ public class BasicPage extends GuiProfileViewerPage { } String location = null; - JsonObject status = profile.getPlayerStatus(); + JsonObject status = clickedLoadStatusButton ? profile.getPlayerStatus() : null; if (status != null && status.has("mode")) { location = status.get("mode").getAsString(); } @@ -438,6 +441,29 @@ public class BasicPage extends GuiProfileViewerPage { } Utils.drawStringCentered(statusStr, guiLeft + 63, guiTop + 160, true, 0); + } else { + Rectangle buttonRect = new Rectangle( + guiLeft + 24, + guiTop + 155, + 80, + 12 + ); + + RenderUtils.drawFloatingRectWithAlpha(buttonRect.getX(), buttonRect.getY(), buttonRect.getWidth(), + buttonRect.getHeight(), 100, true + ); + Utils.renderShadowedString( + clickedLoadStatusButton + ? EnumChatFormatting.AQUA + "Loading..." + : EnumChatFormatting.WHITE + "Load Status", + guiLeft + 63, + guiTop + 157, + 79 + ); + + if (Mouse.getEventButtonState() && Utils.isWithinRect(mouseX, mouseY, buttonRect)) { + clickedLoadStatusButton = true; + } } if (entityPlayer == null) { |
