aboutsummaryrefslogtreecommitdiff
path: root/mod/src/main
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2023-01-22 00:30:16 +0900
committersyeyoung <cyoung06@naver.com>2023-01-22 00:30:16 +0900
commit394c52045bcb53a93c08cfab6d60a42bfd777d59 (patch)
tree120a2f198cadcecca5471958ed6d8a2da67e6b11 /mod/src/main
parent6790c6dd1909522eadb6c8917369b357b7fb4119 (diff)
downloadSkyblock-Dungeons-Guide-394c52045bcb53a93c08cfab6d60a42bfd777d59.tar.gz
Skyblock-Dungeons-Guide-394c52045bcb53a93c08cfab6d60a42bfd777d59.tar.bz2
Skyblock-Dungeons-Guide-394c52045bcb53a93c08cfab6d60a42bfd777d59.zip
- Profile viewer now uses guiv2
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod/src/main')
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java7
-rwxr-xr-xmod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/DungeonListener.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/FeatureTerminalSolvers.java1
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FakePlayer.java40
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FeatureViewPlayerStatsOnJoin.java571
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/HoverEventRenderPlayer.java71
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/SkinFetcher.java1
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/IDataRenderer.java3
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRenderDungeonFloorStat.java14
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRenderDungeonHighestFloorStat.java16
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererClassLv.java11
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererDungeonLv.java11
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererFairySouls.java4
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererLilyWeight.java13
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSecrets.java4
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSelectedClassLv.java11
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSetUrOwn.java5
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSkillLv.java11
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererTalismans.java8
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/PlayerModelRenderer.java179
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetDataRendererWrapper.java112
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetPlayerInventory.java148
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetPlayerModel.java105
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetProfileViewer.java94
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetProfileViewerData.java133
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/DomElement.java11
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/MinecraftTooltip.java58
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/MouseTooltip.java50
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Slot.java18
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManagerRootWidget.java5
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/tooltip.gui2
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/gui/features/profileViewer/data.gui72
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/gui/features/profileViewer/player.gui42
-rw-r--r--mod/src/main/resources/assets/dungeonsguide/gui/features/profileViewer/pv.gui68
34 files changed, 1296 insertions, 605 deletions
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java
index 394f95ca..fd8d7164 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java
@@ -18,6 +18,7 @@
package kr.syeyoung.dungeonsguide.mod.commands;
+import com.mojang.authlib.GameProfile;
import kr.syeyoung.dungeonsguide.launcher.Main;
import kr.syeyoung.dungeonsguide.mod.DungeonsGuide;
import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter;
@@ -26,6 +27,7 @@ import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticsManager;
import kr.syeyoung.dungeonsguide.mod.discord.DiscordIntegrationManager;
import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry;
import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.FeatureViewPlayerStatsOnJoin;
+import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.HoverEventRenderPlayer;
import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.ApiFetcher;
import kr.syeyoung.dungeonsguide.mod.guiv2.elements.image.ImageTexture;
import kr.syeyoung.dungeonsguide.mod.party.PartyManager;
@@ -94,7 +96,10 @@ public class CommandDungeonsGuide extends CommandBase {
try {
ApiFetcher.fetchUUIDAsync(args[1])
.thenAccept(a -> {
- sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e" + args[1] + "§f's Profile ").appendSibling(new ChatComponentText("§7view").setChatStyle(new ChatStyle().setChatHoverEvent(new FeatureViewPlayerStatsOnJoin.HoverEventRenderPlayer(a.orElse(null))))));
+ sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §e" + args[1] + "§f's Profile ").appendSibling(new ChatComponentText("§7view").setChatStyle(new ChatStyle().setChatHoverEvent(
+ new HoverEventRenderPlayer(
+ new GameProfile(FeatureViewPlayerStatsOnJoin.fromString(a.orElse(null)), args[1])
+ )))));
});
} catch (Exception e) {
e.printStackTrace();
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/DungeonListener.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/DungeonListener.java
index 0e1001ba..c36fac6d 100755
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/DungeonListener.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/events/listener/DungeonListener.java
@@ -191,7 +191,7 @@ public class DungeonListener {
@SubscribeEvent
public void onRender(RenderGameOverlayEvent.Post postRender) {
- if (!(postRender.type == RenderGameOverlayEvent.ElementType.EXPERIENCE || postRender.type == RenderGameOverlayEvent.ElementType.JUMPBAR))
+ if (!(postRender.type == RenderGameOverlayEvent.ElementType.ALL))
return;
if (!SkyblockStatus.isOnDungeon()) return;
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/FeatureTerminalSolvers.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/FeatureTerminalSolvers.java
index a51affd8..64c200ea 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/FeatureTerminalSolvers.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/boss/terminal/FeatureTerminalSolvers.java
@@ -90,7 +90,6 @@ public class FeatureTerminalSolvers extends SimpleFeature {
@DGEventHandler
public void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered) {
- if (!isEnabled()) return;
if (solutionProvider == null) return;
if (!(Minecraft.getMinecraft().currentScreen instanceof GuiChest)) {
solution = null;
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FakePlayer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FakePlayer.java
index ac0e2fec..1cbb01b5 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FakePlayer.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FakePlayer.java
@@ -41,19 +41,49 @@ public class FakePlayer extends EntityOtherPlayerMP {
@Setter
@Getter
private PlayerProfile skyblockProfile;
+
+ public void setSkyblockProfile(PlayerProfile skyblockProfile) {
+ this.skyblockProfile = skyblockProfile;
+
+ armor = skyblockProfile.getCurrentArmor();
+ this.inventory.armorInventory = skyblockProfile.getCurrentArmor().getArmorSlots();
+
+ int highestDungeonScore = Integer.MIN_VALUE;
+ if (skyblockProfile.getInventory() != null) {
+ ItemStack highestItem = null;
+ for (ItemStack itemStack : skyblockProfile.getInventory()) {
+ if (itemStack == null) continue;
+ NBTTagCompound display = itemStack.getTagCompound().getCompoundTag("display");
+ if (display == null) continue;
+ NBTTagList nbtTagList = display.getTagList("Lore", 8);
+ if (nbtTagList == null) continue;
+ for (int i = 0; i < nbtTagList.tagCount(); i++) {
+ String str = nbtTagList.getStringTagAt(i);
+ if (TextUtils.stripColor(str).startsWith("Gear")) {
+ int dungeonScore = Integer.parseInt(TextUtils.keepIntegerCharactersOnly(TextUtils.stripColor(str).split(" ")[2]));
+ if (dungeonScore > highestDungeonScore) {
+ highestItem = itemStack;
+ highestDungeonScore = dungeonScore;
+ }
+ }
+ }
+ }
+
+ this.inventory.mainInventory[0] = highestItem;
+ this.inventory.currentItem = 0;
+ }
+ }
+
private final SkinFetcher.SkinSet skinSet;
- private final PlayerProfile.Armor armor;
- @Getter
- private final int profileNumber;
+ private PlayerProfile.Armor armor;
private FakePlayer(World w) {
super(w, null);
throw new UnsupportedOperationException("what");
}
- public FakePlayer(GameProfile playerProfile, SkinFetcher.SkinSet skinSet, PlayerProfile skyblockProfile, int profileNumber) {
+ public FakePlayer(GameProfile playerProfile, SkinFetcher.SkinSet skinSet, PlayerProfile skyblockProfile) {
super(Minecraft.getMinecraft().theWorld, playerProfile);
- this.profileNumber = profileNumber;
this.skyblockProfile = skyblockProfile;
this.skinSet = skinSet;
armor = skyblockProfile.getCurrentArmor();
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FeatureViewPlayerStatsOnJoin.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FeatureViewPlayerStatsOnJoin.java
index ddc6ab3b..746f9728 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FeatureViewPlayerStatsOnJoin.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/FeatureViewPlayerStatsOnJoin.java
@@ -22,7 +22,6 @@ import com.mojang.authlib.GameProfile;
import io.github.moulberry.hychat.HyChat;
import io.github.moulberry.hychat.chat.ChatManager;
import io.github.moulberry.hychat.gui.GuiChatBox;
-import kr.syeyoung.dungeonsguide.mod.DungeonsGuide;
import kr.syeyoung.dungeonsguide.mod.chat.ChatProcessResult;
import kr.syeyoung.dungeonsguide.mod.chat.ChatProcessor;
import kr.syeyoung.dungeonsguide.mod.chat.ChatTransmitter;
@@ -30,75 +29,53 @@ import kr.syeyoung.dungeonsguide.mod.config.guiconfig.ConfigPanelCreator;
import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MFeatureEdit;
import kr.syeyoung.dungeonsguide.mod.config.guiconfig.MParameterEdit;
import kr.syeyoung.dungeonsguide.mod.config.guiconfig.RootConfigPanel;
-import kr.syeyoung.dungeonsguide.mod.cosmetics.ActiveCosmetic;
-import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticData;
import kr.syeyoung.dungeonsguide.mod.events.annotations.DGEventHandler;
import kr.syeyoung.dungeonsguide.mod.features.FeatureParameter;
import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry;
import kr.syeyoung.dungeonsguide.mod.features.SimpleFeature;
import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.ApiFetcher;
-import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.PlayerSkyblockData;
-import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.SkinFetcher;
-import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile;
import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.DataRendererEditor;
-import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.DataRendererRegistry;
-import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.IDataRenderer;
+import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.widget.WidgetProfileViewer;
+import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Rect;
+import kr.syeyoung.dungeonsguide.mod.overlay.OverlayManager;
+import kr.syeyoung.dungeonsguide.mod.overlay.OverlayType;
+import kr.syeyoung.dungeonsguide.mod.overlay.OverlayWidget;
import kr.syeyoung.dungeonsguide.mod.party.PartyContext;
import kr.syeyoung.dungeonsguide.mod.party.PartyManager;
import kr.syeyoung.dungeonsguide.mod.utils.TextUtils;
-import lombok.Getter;
-import lombok.Setter;
import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiChat;
import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.gui.inventory.GuiInventory;
-import net.minecraft.client.renderer.GlStateManager;
-import net.minecraft.client.renderer.RenderHelper;
-import net.minecraft.event.HoverEvent;
-import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ChatStyle;
-import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent;
+import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.client.event.GuiScreenEvent;
-import net.minecraftforge.fml.client.config.GuiUtils;
import net.minecraftforge.fml.common.Loader;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.input.Mouse;
-import org.lwjgl.opengl.GL11;
-import org.lwjgl.opengl.GL14;
-import java.awt.*;
import java.util.List;
import java.util.*;
-import java.util.concurrent.CompletableFuture;
-import java.util.concurrent.ExecutionException;
-import java.util.concurrent.Future;
+// TODO: do not limit element positioning
+// maybe a cool editor?
public class FeatureViewPlayerStatsOnJoin extends SimpleFeature {
static Minecraft mc = Minecraft.getMinecraft();
- protected Rectangle popupRect;
- ChangeProfileWidget profileButtonWidget = new ChangeProfileWidget();
- private String lastuid; // actually current uid
- private CompletableFuture<Optional<PlayerSkyblockData>> profileFuture;
- private Future<Optional<GameProfile>> gameProfileFuture;
- private Future<SkinFetcher.SkinSet> skinFuture;
- private FakePlayer fakePlayer;
- private boolean shouldDraw = false;
- public FeatureViewPlayerStatsOnJoin() {
- super("Party", "View player stats when join", "view player rendering when joining/someone joins the party", "partykicker.viewstats", true);
+ public static UUID fromString(String input) {
+ return UUID.fromString(input.replaceFirst("(\\w{8})(\\w{4})(\\w{4})(\\w{4})(\\w{12})", "$1-$2-$3-$4-$5"));
+ }
+ public FeatureViewPlayerStatsOnJoin() {
+ super("Party", "View player stats when join", "view player rendering when joining/someone joins the party", "partykicker.viewstats", true);
addParameter("datarenderers", new FeatureParameter<List<String>>("datarenderers", "DataRenderers", "Datarenderssdasd", new ArrayList<>(Arrays.asList(
"catalv", "selected_class_lv", "dungeon_catacombs_higheststat", "dungeon_master_catacombs_higheststat", "skill_combat_lv", "skill_foraging_lv", "skill_mining_lv", "fairysouls", "dummy"
)), "stringlist"));
ChatProcessor.INSTANCE.subscribe(((txt, messageContext) -> {
-
if (isEnabled() && txt.contains("§r§ejoined the dungeon group! (§r§b")) {
String username = TextUtils.stripColor(txt).split(" ")[3];
if (username.equalsIgnoreCase(mc.getSession().getUsername())) {
@@ -112,23 +89,11 @@ public class FeatureViewPlayerStatsOnJoin extends SimpleFeature {
} else {
processMemberJoin(username);
}
-
-
}
-
-
return ChatProcessResult.NONE;
}));
}
-
- public static void clip(ScaledResolution resolution, int x, int y, int width, int height) {
- if (width < 0 || height < 0) return;
-
- int scale = resolution.getScaleFactor();
- GL11.glScissor((x) * scale, mc.displayHeight - (y + height) * scale, (width) * scale, height * scale);
- }
-
public static void processPartyMembers(PartyContext context) {
for (String member : context.getPartyRawMembers()) {
processMemberJoin(member);
@@ -147,385 +112,55 @@ public class FeatureViewPlayerStatsOnJoin extends SimpleFeature {
ApiFetcher.fetchMostRecentProfileAsync(a.get(), FeatureRegistry.PARTYKICKER_APIKEY.getAPIKey());
IChatComponent comp = new ChatComponentText("§eDungeons Guide §7:: §e" + username + "§f's Profile ")
- .appendSibling(new ChatComponentText("§7view").setChatStyle(new ChatStyle().setChatHoverEvent(new HoverEventRenderPlayer(a.orElse(null)))));
+ .appendSibling(new ChatComponentText("§7view").setChatStyle(new ChatStyle().setChatHoverEvent(new HoverEventRenderPlayer(
+ new GameProfile(fromString(a.get()), username)))));
ChatTransmitter.addToQueue((ChatComponentText) comp);
-
-
});
}
- @DGEventHandler
- public void onGuiPostRender(GuiScreenEvent.DrawScreenEvent.Post rendered) {
+ private OverlayWidget widget;
+
+ @DGEventHandler(triggerOutOfSkyblock = true)
+ public void onGuiPostRender(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) {
if (!(mc.currentScreen instanceof GuiChat)) {
- cancelRender();
return;
}
-
ScaledResolution scaledResolution = new ScaledResolution(mc);
IChatComponent ichatcomponent = getHoveredComponent(scaledResolution);
- String uid = null;
- if (ichatcomponent != null && ichatcomponent.getChatStyle().getChatHoverEvent() instanceof HoverEventRenderPlayer) {
- uid = ((HoverEventRenderPlayer) ichatcomponent.getChatStyle().getChatHoverEvent()).getUuid();
- }
-
- int width = scaledResolution.getScaledWidth();
- int height = scaledResolution.getScaledHeight();
- int mouseX = Mouse.getX() * width / mc.displayWidth;
- int mouseY = height - Mouse.getY() * height / mc.displayHeight - 1;
-
- shouldCancelRendering(uid, mouseX, mouseY);
-
- if (lastuid == null) return;
-
-
- if (popupRect == null) {
- popupRect = new Rectangle(mouseX, mouseY, 220, 220);
- if (popupRect.y + popupRect.height > scaledResolution.getScaledHeight()) {
- popupRect.y -= popupRect.y + popupRect.height - scaledResolution.getScaledHeight();
- }
- }
-
- if (profileFuture == null) {
- profileFuture = ApiFetcher.fetchMostRecentProfileAsync(lastuid, FeatureRegistry.PARTYKICKER_APIKEY.getAPIKey());
- }
-
- if (gameProfileFuture == null) {
- gameProfileFuture = ApiFetcher.getSkinGameProfileByUUIDAsync(lastuid);
- }
- boolean plsSetAPIKEY = false;
- if (skinFuture == null && gameProfileFuture.isDone()) {
- try {
- skinFuture = SkinFetcher.getSkinSet(gameProfileFuture.get().orElse(null));
- } catch (InterruptedException | ExecutionException e) {
- e.printStackTrace();
- }
- }
-
- try {
- if (fakePlayer == null && skinFuture != null && profileFuture != null && skinFuture.isDone() && profileFuture.isDone() && profileFuture.get().isPresent()) {
- if (profileButtonWidget.getCurrentrySelectedProfile(profileFuture.get().get()) != null) {
- if (skinFuture.get() != null) {
- profileButtonWidget.setCurrentyselectedprofile(profileFuture.get().get().getLastestprofileArrayIndex());
- fakePlayer = new FakePlayer(gameProfileFuture.get().orElse(null), skinFuture.get(), profileButtonWidget.getCurrentrySelectedProfile(profileFuture.get().get()), profileButtonWidget.getCurrentyselectedprofile());
- }
- }
- } else if (fakePlayer != null) {
- if (fakePlayer.getProfileNumber() != profileButtonWidget.getCurrentyselectedprofile()) {
- fakePlayer = new FakePlayer(gameProfileFuture.get().orElse(null), skinFuture.get(), profileButtonWidget.getCurrentrySelectedProfile(profileFuture.get().get()), profileButtonWidget.getCurrentyselectedprofile());
- }
- }
- } catch (InterruptedException | ExecutionException e) {
- plsSetAPIKEY = true;
- }
-
-
- Optional<PlayerProfile> playerProfile;
- if (plsSetAPIKEY || !profileFuture.isDone()) {
- playerProfile = null;
- } else {
- PlayerSkyblockData data = null;
- try {
- data = profileFuture.get().get();
- } catch (InterruptedException | ExecutionException e) {
- throw new RuntimeException(e);
- }
- PlayerProfile currentlySelectedProfile = profileButtonWidget.getCurrentrySelectedProfile(data);
- playerProfile = Optional.ofNullable(currentlySelectedProfile);
- }
-
-
- draw(scaledResolution, mouseX, mouseY, plsSetAPIKEY, playerProfile);
- }
-
- private void draw(ScaledResolution scaledResolution, int mouseX, int mouseY, boolean plsSetAPIKEY, Optional<PlayerProfile> playerProfile) {
- GlStateManager.pushMatrix();
- GlStateManager.translate(popupRect.x, popupRect.y, 0);
- int backroundGuiColor = 0xFF23272a;
- Gui.drawRect(0, 0, popupRect.width, popupRect.height, backroundGuiColor);
- Gui.drawRect(2, 2, popupRect.width - 2, popupRect.height - 2, 0XFF2c2f33);
-
- GlStateManager.enableBlend();
- GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- if (plsSetAPIKEY) {
- mc.fontRendererObj.drawString("Please set API KEY on /dg -> Party Kicker", 5, 5, 0xFFFFFFFF);
- GlStateManager.popMatrix();
- } else if (playerProfile == null) {
- mc.fontRendererObj.drawString("Fetching data...", 5, 5, 0xFFFFFFFF);
- GlStateManager.popMatrix();
- } else if (!playerProfile.isPresent()) {
- mc.fontRendererObj.drawString("User could not be found", 5, 5, 0xFFFFFFFF);
- GlStateManager.popMatrix();
- } else {
- int relX = mouseX - popupRect.x;
- int relY = mouseY - popupRect.y;
- FontRenderer fr = mc.fontRendererObj;
- GL11.glEnable(GL11.GL_SCISSOR_TEST);
- clip(scaledResolution, popupRect.x, popupRect.y, popupRect.width, popupRect.height);
-
- Gui.drawRect(0, 168, 90, 195, backroundGuiColor);
- Gui.drawRect(2, 170, 88, 193, new Rectangle(2, 170, 86, 23).contains(relX, relY) ? 0xFFff7777 : 0xFFFF3333);
-
- Gui.drawRect(0, 193, 90, 220, backroundGuiColor);
- Gui.drawRect(2, 195, 88, 218, new Rectangle(2, 195, 86, 23).contains(relX, relY) ? 0xFF859DF0 : 0xFF7289da);
-
-
- GlStateManager.enableBlend();
- GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- fr.drawString("Kick", (90 - fr.getStringWidth("Kick")) / 2, (364 - fr.FONT_HEIGHT) / 2, 0xFFFFFFFF);
- fr.drawString("Invite", (90 - fr.getStringWidth("Invite")) / 2, (414 - fr.FONT_HEIGHT) / 2, 0xFFFFFFFF);
-
- GlStateManager.pushMatrix();
- GlStateManager.translate(95, 5, 0);
- int culmutativeY = 5;
- IDataRenderer dataRendererToHover = null;
- for (String datarenderers : this.<List<String>>getParameter("datarenderers").getValue()) {
- GlStateManager.enableBlend();
- GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- IDataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderers);
- Dimension dim;
- if (dataRenderer == null) {
- fr.drawString("Couldn't find Datarenderer", 0, 0, 0xFFFF0000);
- fr.drawString(datarenderers, 0, fr.FONT_HEIGHT, 0xFFFF0000);
- dim = new Dimension(0, fr.FONT_HEIGHT * 2);
- } else {
- GlStateManager.pushMatrix();
- dim = dataRenderer.renderData(playerProfile.get());
- GlStateManager.popMatrix();
- }
- if (relX >= 95 && relX <= popupRect.width && relY >= culmutativeY && relY < culmutativeY + dim.height && dataRenderer != null) {
- dataRendererToHover = dataRenderer;
- }
- culmutativeY += dim.height;
- GlStateManager.translate(0, dim.height, 0);
- }
- GlStateManager.popMatrix();
- GlStateManager.enableBlend();
- GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- Gui.drawRect(0, 0, 90, 170, backroundGuiColor);
- Gui.drawRect(2, 2, 88, 168, 0xFF444444);
-
- GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
-
- profileButtonWidget.drawChangeProfileButton(relX, relY);
-
-
- Gui.drawRect(78, 156, 90, 170, backroundGuiColor);
- fr.drawString("§eI", 82, 159, -1);
-
-
- GlStateManager.color(1, 1, 1, 1.0F);
- if (fakePlayer != null) {
- drawFakePlayer(scaledResolution, mouseX, mouseY, playerProfile, relX, relY, fr);
- } else {
- GlStateManager.enableBlend();
- GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- fr.drawString("Loading", 5, 35, 0xFFEFFF00);
- }
- GlStateManager.popMatrix();
- GL11.glDisable(GL11.GL_SCISSOR_TEST);
- if (dataRendererToHover != null && !shouldDraw) {
- dataRendererToHover.onHover(playerProfile.get(), mouseX, mouseY);
- }
- GL11.glEnable(GL11.GL_SCISSOR_TEST);
- GlStateManager.pushMatrix();
- GlStateManager.translate(popupRect.x, popupRect.y, 0);
- if (shouldDraw) {
- int startX = 81;
- int startY = 86;
- clip(scaledResolution, popupRect.x + startX - 1, popupRect.y + startY - 1, 164, 74);
- GlStateManager.translate(startX, startY, 1);
- Gui.drawRect(-1, -1, 163, 73, 0xFF000000);
- GlStateManager.disableLighting();
- ItemStack toHover = null;
- int rx = relX - startX;
- int ry = relY - startY;
-
- if (playerProfile.get().getInventory() != null) {
- GlStateManager.disableRescaleNormal();
- RenderHelper.enableGUIStandardItemLighting();
- GlStateManager.disableLighting();
- for (int i = 0; i < playerProfile.get().getInventory().length; i++) {
- int x = (i % 9) * 18;
- int y = (i / 9) * 18;
- if (x <= rx && rx < x + 18 && y <= ry && ry < y + 18) {
- toHover = playerProfile.get().getInventory()[(i + 9) % 36];
+ GameProfile gameProfile = null;
+ if (ichatcomponent != null && ichatcomponent.getChatStyle().getChatHoverEvent() instanceof HoverEventRenderPlayer) {
+ gameProfile = ((HoverEventRenderPlayer) ichatcomponent.getChatStyle().getChatHoverEvent()).getGameProfile();
+ }
+ if (gameProfile != null && widget == null) {
+ int mouseX = Mouse.getX();
+ int mouseY = (Minecraft.getMinecraft().displayHeight - Mouse.getY());
+
+ double width = 220 * scaledResolution.getScaleFactor();
+ double heigth = 220 * scaledResolution.getScaleFactor();
+ widget = new OverlayWidget(
+ new WidgetProfileViewer(gameProfile, FeatureRegistry.PARTYKICKER_APIKEY.getAPIKey(),
+ scaledResolution.getScaleFactor(), () -> {
+ if (widget != null) {
+ OverlayManager.getInstance().removeOverlay(widget);
+ widget = null;
}
- Gui.drawRect(x, y, x + 18, y + 18, 0xFF000000);
- Gui.drawRect(x + 1, y + 1, x + 17, y + 17, 0xFF666666);
- GlStateManager.color(1, 1, 1, 1.0F);
-
- mc.getRenderItem().renderItemAndEffectIntoGUI(playerProfile.get().getInventory()[(i + 9) % 36], (i % 9) * 18 + 1, (i / 9) * 18 + 1);
- }
-
- if (toHover != null) {
- drawItemStackToolTip(scaledResolution, mouseX, mouseY, fr, toHover);
- }
- } else {
- Gui.drawRect(0, 0, 162, 72, 0xFF666666);
- fr.drawSplitString("Player has disabled Inventory API", 5, 5, 142, -1);
- }
-
- }
- GL11.glDisable(GL11.GL_SCISSOR_TEST);
- GlStateManager.popMatrix(); // 33 66 108 130 154 // 5 75
- }
-
-
- }
-
- private void drawFakePlayer(ScaledResolution scaledResolution, int mouseX, int mouseY, Optional<PlayerProfile> playerProfile, int relX, int relY, FontRenderer fr) {
- clip(scaledResolution, popupRect.x + 2, popupRect.y + 2, 86, 166);
- GuiInventory.drawEntityOnScreen(45, 150, 60, -(mouseX - popupRect.x - 75), 0, fakePlayer);
-
- String toDraw = fakePlayer.getName();
- List<ActiveCosmetic> activeCosmetics = DungeonsGuide.getDungeonsGuide().getCosmeticsManager().getActiveCosmeticByPlayer().get(UUID.fromString(TextUtils.insertDashUUID(playerProfile.get().getMemberUID())));
- CosmeticData prefix = null;
- CosmeticData color = null;
- if (activeCosmetics != null) {
- for (ActiveCosmetic activeCosmetic : activeCosmetics) {
- CosmeticData cosmeticData = DungeonsGuide.getDungeonsGuide().getCosmeticsManager().getCosmeticDataMap().get(activeCosmetic.getCosmeticData());
- if (cosmeticData != null) {
- if (cosmeticData.getCosmeticType().equals("prefix")) prefix = cosmeticData;
- if (cosmeticData.getCosmeticType().equals("color")) color = cosmeticData;
- }
- }
- }
- toDraw = (color == null ? "§e" : color.getData().replace("&", "§")) + toDraw;
- if (prefix != null) toDraw = prefix.getData().replace("&", "§") + " " + toDraw;
-
- GlStateManager.enableBlend();
- GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
- GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
-
-
- String profileName = "on §6" + playerProfile.get().getProfileName();
- fr.drawString(profileName, (90 - fr.getStringWidth(profileName)) / 2, 15, -1);
-
-
- fr.drawString(toDraw, (90 - fr.getStringWidth(toDraw)) / 2, 10 - (fr.FONT_HEIGHT / 2), -1);
-
- ItemStack toHover = null;
- if (relX > 20 && relX < 70) {
- if (33 <= relY && relY <= 66) {
- toHover = fakePlayer.getInventory()[3];
- } else if (66 <= relY && relY <= 108) {
- toHover = fakePlayer.getInventory()[2];
- } else if (108 <= relY && relY <= 130) {
- toHover = fakePlayer.getInventory()[1];
- } else if (130 <= relY && relY <= 154) {
- toHover = fakePlayer.getInventory()[0];
- }
- } else if (relX > 0 && relX <= 20) {
- if (80 <= relY && relY <= 120) {
- toHover = fakePlayer.inventory.mainInventory[fakePlayer.inventory.currentItem];
- }
- }
-
- if (toHover != null) {
- drawItemStackToolTip(scaledResolution, mouseX, mouseY, fr, toHover);
- GlStateManager.translate(popupRect.x, popupRect.y, 0);
+ }),
+ OverlayType.OVER_CHAT,
+ () -> new Rect(mouseX, mouseY-heigth, width, heigth)
+ );
+ OverlayManager.getInstance().addOverlay(widget);
}
- clip(scaledResolution, popupRect.x, popupRect.y, popupRect.width, popupRect.height);
}
-
- public void drawItemStackToolTip(ScaledResolution scaledResolution, int mouseX, int mouseY, FontRenderer fr, ItemStack toHover) {
- List<String> list = toHover.getTooltip(mc.thePlayer, mc.gameSettings.advancedItemTooltips);
- for (int i = 0; i < list.size(); ++i) {
- if (i == 0) {
- list.set(i, toHover.getRarity().rarityColor + list.get(i));
- } else {
- list.set(i, EnumChatFormatting.GRAY + list.get(i));
- }
- }
- FontRenderer font = toHover.getItem().getFontRenderer(toHover);
- GlStateManager.popMatrix();
- GL11.glDisable(GL11.GL_SCISSOR_TEST);
- FontRenderer theRenderer = (font == null ? fr : font);
- GuiUtils.drawHoveringText(list, mouseX, mouseY, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, theRenderer);
- GL11.glEnable(GL11.GL_SCISSOR_TEST);
- GlStateManager.pushMatrix();
- }
-
- private void shouldCancelRendering(String uid, int mouseX, int mouseY) {
- if (!((popupRect != null && (popupRect.contains(mouseX, mouseY) || shouldDraw)) || uid != null && uid.equals(lastuid))) {
- cancelRender();
- }
-
- if (uid != null && !uid.equals(lastuid) && (popupRect == null || (!popupRect.contains(mouseX, mouseY) && !shouldDraw))) {
- cancelRender();
- lastuid = uid;
+ @DGEventHandler(triggerOutOfSkyblock = true)
+ public void onGuiClose(GuiOpenEvent event) {
+ if (!(event.gui instanceof GuiChat) && widget != null) {
+ OverlayManager.getInstance().removeOverlay(widget);
+ widget = null;
}
}
- public void cancelRender() {
- popupRect = null;
- profileFuture = null;
- lastuid = null;
- gameProfileFuture = null;
- skinFuture = null;
- fakePlayer = null;
- shouldDraw = false;
- }
-
- @DGEventHandler
- public void onMouseInput(GuiScreenEvent.MouseInputEvent.Pre mouseInputEvent) {
- ScaledResolution scaledResolution = new ScaledResolution(mc);
- int width = scaledResolution.getScaledWidth();
- int height = scaledResolution.getScaledHeight();
- int mouseX = Mouse.getX() * width / mc.displayWidth;
- int mouseY = height - Mouse.getY() * height / mc.displayHeight - 1;
-
- if (Mouse.getEventButton() != -1 && Mouse.isButtonDown(Mouse.getEventButton()) && shouldDraw)
- shouldDraw = false;
- if (popupRect == null || !popupRect.contains(mouseX, mouseY)) return;
-
- mouseInputEvent.setCanceled(true);
-
- int relX = mouseX - popupRect.x;
- int relY = mouseY - popupRect.y;
-
- try {
- PlayerSkyblockData playerData;
-
- if (profileFuture.isDone()) {
- playerData = profileFuture.get().orElse(null);
- } else {
- return;
- }
-
- if (playerData == null) {
- return;
- }
-
- if (Mouse.getEventButton() == -1 && !Mouse.isButtonDown(Mouse.getEventButton())) return;
-
- if (new Rectangle(2, 195, 86, 23).contains(relX, relY)) {
- // invite
- ChatProcessor.INSTANCE.addToChatQueue("/p invite " + ApiFetcher.fetchNicknameAsync(profileButtonWidget.getCurrentrySelectedProfile(playerData).getMemberUID()).get().orElse("-"), () -> {
- }, true);
- } else if (new Rectangle(2, 170, 86, 23).contains(relX, relY)) {
- // kick
- ChatProcessor.INSTANCE.addToChatQueue("/p kick " + ApiFetcher.fetchNicknameAsync(profileButtonWidget.getCurrentrySelectedProfile(playerData).getMemberUID()).get().orElse("-"), () -> {
- }, true);
- } else if (new Rectangle(80, 159, 10, 11).contains(relX, relY)) {
- shouldDraw = true;
- }
-
-
- this.profileButtonWidget.handleClickProfileButton(playerData);
-
-
- } catch (InterruptedException | ExecutionException e) {
- }
-
-
- }
public IChatComponent getHoveredComponent(ScaledResolution scaledResolution) {
IChatComponent ichatcomponent = null;
@@ -561,120 +196,4 @@ public class FeatureViewPlayerStatsOnJoin extends SimpleFeature {
return "base." + getKey();
}
- public static class HoverEventRenderPlayer extends HoverEvent {
- @Getter
- private final String uuid;
- private IChatComponent cached;
-
- public HoverEventRenderPlayer(String uuid) {
- super(Action.SHOW_TEXT, new ChatComponentText(""));
- this.uuid = uuid;
- }
-
- @Override
- public boolean equals(Object o) {
- if (this == o) return true;
- if (o == null || getClass() != o.getClass()) return false;
- if (!super.equals(o)) return false;
- HoverEventRenderPlayer that = (HoverEventRenderPlayer) o;
- return Objects.equals(uuid, that.uuid);
- }
-
- @Override
- public int hashCode() {
- return Objects.hash(super.hashCode(), uuid);
- }
-
- @Override
- public IChatComponent getValue() {
- if (cached == null) {
- cached = new ChatComponentText("")
- .setChatStyle(
- new ChatStyle()
- .setChatHoverEvent(
- new HoverEvent(
- Action.SHOW_TEXT,
- new ChatComponentText(uuid)
- )
- )
- );
- return cached;
- }
- return cached;
- }
- }
-
- class ChangeProfileWidget {
- FontRenderer fr;
- @Getter
- @Setter
- int currentyselectedprofile = 0;
- String buttonText = "Switch Profile";
- int stringWidth;
- int textx;
- int texty;
- int blockWidth;
- int blockHeight;
- long clickDeBounce = 0;
-
- public ChangeProfileWidget() {
- fr = Minecraft.getMinecraft().fontRendererObj;
- stringWidth = fr.getStringWidth(buttonText);
- textx = ((83 - stringWidth) / 2);
- texty = (324 - fr.FONT_HEIGHT) / 2;
- blockWidth = stringWidth + 3;
- blockHeight = fr.FONT_HEIGHT + 2;
- }
-
- void drawChangeProfileButton(float relX, float relY) {
-
- boolean contains = isWithinButtonRec(relX, relY);
-
- Gui.drawRect(textx - 5, texty - 1, textx + blockWidth, texty + blockHeight, contains ? 0xFFFFFFFF : 0xFF30afd3);
-
- fr.drawString(buttonText, textx, texty + 2, contains ? 0x30afd3 : 0xFFFFFF);
- }
-
- Rectangle getButtonRec() {
- return new Rectangle(textx - 5, texty - 1, blockWidth, blockHeight);
- }
-
- boolean isWithinButtonRec(float relX, float relY) {
- return getButtonRec().contains(relX, relY);
- }
-
- void handleClickProfileButton(PlayerSkyblockData playerData) {
-
- if (System.currentTimeMillis() <= clickDeBounce) {
- return;
- } else {
- clickDeBounce = System.currentTimeMillis() + 200;
- }
-
- ScaledResolution scaledResolution = new ScaledResolution(mc);
- int width = scaledResolution.getScaledWidth();
- int height = scaledResolution.getScaledHeight();
- int mouseX = Mouse.getX() * width / mc.displayWidth;
- int mouseY = height - Mouse.getY() * height / mc.displayHeight - 1;
-
- int relX = mouseX - popupRect.x;
- int relY = mouseY - popupRect.y;
-
- if (isWithinButtonRec(relX, relY)) {
- if (profileButtonWidget.currentyselectedprofile + 1 >= playerData.getPlayerProfiles().length) {
- profileButtonWidget.currentyselectedprofile = 0;
- } else {
- profileButtonWidget.currentyselectedprofile++;
- }
- }
- }
-
- PlayerProfile getCurrentrySelectedProfile(PlayerSkyblockData data) {
- if (data == null) return null;
- if (data.getPlayerProfiles() == null) return null;
- if (data.getPlayerProfiles().length == 0) return null;
- if (data.getPlayerProfiles().length < currentyselectedprofile) return null;
- return data.getPlayerProfiles()[currentyselectedprofile];
- }
- }
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/HoverEventRenderPlayer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/HoverEventRenderPlayer.java
new file mode 100644
index 00000000..5fd82b73
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/HoverEventRenderPlayer.java
@@ -0,0 +1,71 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2023 cyoung06 (syeyoung)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview;
+
+import com.mojang.authlib.GameProfile;
+import lombok.Getter;
+import net.minecraft.event.HoverEvent;
+import net.minecraft.util.ChatComponentText;
+import net.minecraft.util.ChatStyle;
+import net.minecraft.util.IChatComponent;
+
+import java.util.Objects;
+
+public class HoverEventRenderPlayer extends HoverEvent {
+ @Getter
+ private final GameProfile gameProfile;
+ private IChatComponent cached;
+
+ public HoverEventRenderPlayer(GameProfile gameProfile) {
+ super(Action.SHOW_TEXT, new ChatComponentText(""));
+ this.gameProfile = Objects.requireNonNull(gameProfile);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+ if (!super.equals(o)) return false;
+ HoverEventRenderPlayer that = (HoverEventRenderPlayer) o;
+ return Objects.equals(gameProfile.getId(), that.gameProfile.getId());
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hash(super.hashCode(), gameProfile.getId());
+ }
+
+ @Override
+ public IChatComponent getValue() {
+ if (cached == null) {
+ cached = new ChatComponentText("")
+ .setChatStyle(
+ new ChatStyle()
+ .setChatHoverEvent(
+ new HoverEvent(
+ Action.SHOW_TEXT,
+ new ChatComponentText(gameProfile.getId().toString())
+ )
+ )
+ );
+ return cached;
+ }
+ return cached;
+ }
+}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/SkinFetcher.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/SkinFetcher.java
index 5488f637..b93debf9 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/SkinFetcher.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/SkinFetcher.java
@@ -75,7 +75,6 @@ public class SkinFetcher {
}
}
}, true);
-
return skinSet2;
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/IDataRenderer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/IDataRenderer.java
index 577bdcb5..77b3bfa2 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/IDataRenderer.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/IDataRenderer.java
@@ -21,10 +21,11 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarend
import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile;
import java.awt.*;
+import java.util.List;
public interface IDataRenderer {
Dimension renderData(PlayerProfile playerProfile);
- void onHover(PlayerProfile playerProfile, int mouseX, int mouseY);
+ List<String> onHover(PlayerProfile playerProfile);
Dimension renderDummy();
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRenderDungeonFloorStat.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRenderDungeonFloorStat.java
index e4f4ea0b..67b91566 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRenderDungeonFloorStat.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRenderDungeonFloorStat.java
@@ -28,11 +28,10 @@ import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarende
import kr.syeyoung.dungeonsguide.mod.utils.TextUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraftforge.fml.client.config.GuiUtils;
import java.awt.*;
import java.util.Arrays;
+import java.util.List;
public class DataRenderDungeonFloorStat implements IDataRenderer {
private final DungeonType dungeonType;
@@ -81,16 +80,15 @@ public class DataRenderDungeonFloorStat implements IDataRenderer {
}
@Override
- public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) {
+ public List<String> onHover(PlayerProfile playerProfile) {
DungeonSpecificData<DungeonStat> dungeonStatDungeonSpecificData = playerProfile.getDungeonStats().get(dungeonType);
- if (dungeonStatDungeonSpecificData == null) return;
+ if (dungeonStatDungeonSpecificData == null) return null;
FloorSpecificData<DungeonStat.PlayedFloor> playedFloorFloorSpecificData = dungeonStatDungeonSpecificData.getData().getPlays().get(floor);
- if (playedFloorFloorSpecificData == null) return;
+ if (playedFloorFloorSpecificData == null) return null;
String floorName = (dungeonType == DungeonType.CATACOMBS ? "F" : "M") + floor;
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- GuiUtils.drawHoveringText(Arrays.asList(
+ return Arrays.asList(
"§bFloor "+floorName,
"§bBest Score§7: §f"+playedFloorFloorSpecificData.getData().getBestScore(),
"§bTotal Completions§7: §f"+playedFloorFloorSpecificData.getData().getCompletions(),
@@ -101,6 +99,6 @@ public class DataRenderDungeonFloorStat implements IDataRenderer {
"§bFastest Run§7: §f"+(playedFloorFloorSpecificData.getData().getFastestTime() != -1? TextUtils.formatTime(playedFloorFloorSpecificData.getData().getFastestTime()) : "§7N/A"),
"§bMost Mobs Killed§7: §f"+playedFloorFloorSpecificData.getData().getMostMobsKilled(),
"§bTotal Mobs Killed§7: §f"+playedFloorFloorSpecificData.getData().getMobsKilled()
- ), mouseX, mouseY, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, Minecraft.getMinecraft().fontRendererObj);
+ );
}
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRenderDungeonHighestFloorStat.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRenderDungeonHighestFloorStat.java
index 8eb10ad4..7d36f1b9 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRenderDungeonHighestFloorStat.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRenderDungeonHighestFloorStat.java
@@ -28,11 +28,10 @@ import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarende
import kr.syeyoung.dungeonsguide.mod.utils.TextUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraftforge.fml.client.config.GuiUtils;
import java.awt.*;
import java.util.Arrays;
+import java.util.List;
public class DataRenderDungeonHighestFloorStat implements IDataRenderer {
private final DungeonType dungeonType;
@@ -82,17 +81,16 @@ public class DataRenderDungeonHighestFloorStat implements IDataRenderer {
}
@Override
- public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) {
+ public List<String> onHover(PlayerProfile playerProfile) {
DungeonSpecificData<DungeonStat> dungeonStatDungeonSpecificData = playerProfile.getDungeonStats().get(dungeonType);
- if (dungeonStatDungeonSpecificData == null) return;
- if (dungeonStatDungeonSpecificData.getData().getHighestCompleted() == -1) return;
+ if (dungeonStatDungeonSpecificData == null) return null;
+ if (dungeonStatDungeonSpecificData.getData().getHighestCompleted() == -1) return null;
FloorSpecificData<DungeonStat.PlayedFloor> playedFloorFloorSpecificData = dungeonStatDungeonSpecificData.getData().getPlays().get( dungeonStatDungeonSpecificData.getData().getHighestCompleted());
- if (playedFloorFloorSpecificData == null) return;
+ if (playedFloorFloorSpecificData == null) return null;
String floorName = (dungeonType == DungeonType.CATACOMBS ? "F" : "M") + dungeonStatDungeonSpecificData.getData().getHighestCompleted();
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- GuiUtils.drawHoveringText(Arrays.asList(
+ return Arrays.asList(
"§bFloor "+floorName,
"§bBest Score§7: §f"+playedFloorFloorSpecificData.getData().getBestScore(),
"§bTotal Completions§7: §f"+playedFloorFloorSpecificData.getData().getCompletions(),
@@ -103,6 +101,6 @@ public class DataRenderDungeonHighestFloorStat implements IDataRenderer {
"§bFastest Run§7: §f"+(playedFloorFloorSpecificData.getData().getFastestTime() != -1? TextUtils.formatTime(playedFloorFloorSpecificData.getData().getFastestTime()) : "§7N/A"),
"§bMost Mobs Killed§7: §f"+playedFloorFloorSpecificData.getData().getMostMobsKilled(),
"§bTotal Mobs Killed§7: §f"+playedFloorFloorSpecificData.getData().getMobsKilled()
- ), mouseX, mouseY, scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, Minecraft.getMinecraft().fontRendererObj);
+ );
}
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererClassLv.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererClassLv.java
index 62a56209..b76bcbf9 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererClassLv.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererClassLv.java
@@ -28,11 +28,10 @@ import kr.syeyoung.dungeonsguide.mod.utils.TextUtils;
import kr.syeyoung.dungeonsguide.mod.utils.XPUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraftforge.fml.client.config.GuiUtils;
import java.awt.*;
import java.util.Arrays;
+import java.util.List;
public class DataRendererClassLv implements IDataRenderer {
private final DungeonClass dungeonClass;
@@ -77,13 +76,11 @@ public class DataRendererClassLv implements IDataRenderer {
}
@Override
- public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) {
+ public List<String> onHover(PlayerProfile playerProfile) {
ClassSpecificData<PlayerProfile.PlayerClassData> dungeonStatDungeonSpecificData = playerProfile.getPlayerClassData().get(dungeonClass);
- if (dungeonStatDungeonSpecificData == null) return;
+ if (dungeonStatDungeonSpecificData == null) return null;
XPUtils.XPCalcResult xpCalcResult = XPUtils.getCataXp(dungeonStatDungeonSpecificData.getData().getExperience());
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- GuiUtils.drawHoveringText(Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+ TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format((long)dungeonStatDungeonSpecificData.getData().getExperience())),mouseX, mouseY,
- scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, Minecraft.getMinecraft().fontRendererObj);
+ return Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+ TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format((long)dungeonStatDungeonSpecificData.getData().getExperience()));
}
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererDungeonLv.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererDungeonLv.java
index 2da70108..63cad630 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererDungeonLv.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererDungeonLv.java
@@ -28,11 +28,10 @@ import kr.syeyoung.dungeonsguide.mod.utils.TextUtils;
import kr.syeyoung.dungeonsguide.mod.utils.XPUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraftforge.fml.client.config.GuiUtils;
import java.awt.*;
import java.util.Arrays;
+import java.util.List;
public class DataRendererDungeonLv implements IDataRenderer {
private final DungeonType dungeonType;
@@ -71,12 +70,10 @@ public class DataRendererDungeonLv implements IDataRenderer {
}
@Override
- public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) {
+ public List<String> onHover(PlayerProfile playerProfile) {
DungeonSpecificData<DungeonStat> dungeonStatDungeonSpecificData = playerProfile.getDungeonStats().get(dungeonType);
- if (dungeonStatDungeonSpecificData == null) return;
+ if (dungeonStatDungeonSpecificData == null) return null;
XPUtils.XPCalcResult xpCalcResult = XPUtils.getCataXp(dungeonStatDungeonSpecificData.getData().getExperience());
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- GuiUtils.drawHoveringText(Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format((long)dungeonStatDungeonSpecificData.getData().getExperience())),mouseX, mouseY,
- scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, Minecraft.getMinecraft().fontRendererObj);
+ return Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format((long)dungeonStatDungeonSpecificData.getData().getExperience()));
}
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererFairySouls.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererFairySouls.java
index afaef852..5250c291 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererFairySouls.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererFairySouls.java
@@ -24,6 +24,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import java.awt.*;
+import java.util.List;
public class DataRendererFairySouls implements IDataRenderer {
@Override
@@ -45,6 +46,7 @@ public class DataRendererFairySouls implements IDataRenderer {
}
@Override
- public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) {
+ public List<String> onHover(PlayerProfile playerProfile) {
+ return null;
}
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererLilyWeight.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererLilyWeight.java
index 251368eb..567ba757 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererLilyWeight.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererLilyWeight.java
@@ -23,11 +23,10 @@ import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playe
import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.IDataRenderer;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraftforge.fml.client.config.GuiUtils;
import java.awt.*;
import java.util.Arrays;
+import java.util.List;
public class DataRendererLilyWeight implements IDataRenderer {
@Override
@@ -52,11 +51,10 @@ public class DataRendererLilyWeight implements IDataRenderer {
}
@Override
- public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) {
+ public List<String> onHover(PlayerProfile playerProfile) {
PlayerProfile.LilyWeight lilyWeight= playerProfile.getLilyWeight();
- if (lilyWeight == null) return;
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- GuiUtils.drawHoveringText(Arrays.asList(
+ if (lilyWeight == null) return null;
+ return Arrays.asList(
"§bDungeon Weights§7: §e"+ String.format("%.3f",lilyWeight.getCatacombs_base()+lilyWeight.getCatacombs_master()+lilyWeight.getCatacombs_exp()),
" §bCatacomb Completion§7: §e"+String.format("%.3f",lilyWeight.getCatacombs_base()),
" §bMaster Completion§7: §e"+String.format("%.3f", lilyWeight.getCatacombs_master()),
@@ -66,7 +64,6 @@ public class DataRendererLilyWeight implements IDataRenderer {
" §bOverflow Weight§7: §e"+String.format("%.3f", lilyWeight.getSkill_overflow()),
"§bSlayer Weight§7: §e"+String.format("%.3f", lilyWeight.getSlayer()),
"§bTotal§7: §e"+String.format("%.3f", lilyWeight.getTotal())
- ),mouseX, mouseY,
- scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, Minecraft.getMinecraft().fontRendererObj);
+ );
}
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSecrets.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSecrets.java
index ed3da2ec..f8c43a06 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSecrets.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSecrets.java
@@ -24,6 +24,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import java.awt.*;
+import java.util.List;
public class DataRendererSecrets implements IDataRenderer {
@Override
@@ -48,6 +49,7 @@ public class DataRendererSecrets implements IDataRenderer {
}
@Override
- public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) {
+ public List<String> onHover(PlayerProfile playerProfile) {
+ return null;
}
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSelectedClassLv.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSelectedClassLv.java
index 470cfbbb..4d1d46e1 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSelectedClassLv.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSelectedClassLv.java
@@ -26,11 +26,10 @@ import kr.syeyoung.dungeonsguide.mod.utils.TextUtils;
import kr.syeyoung.dungeonsguide.mod.utils.XPUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraftforge.fml.client.config.GuiUtils;
import java.awt.*;
import java.util.Arrays;
+import java.util.List;
public class DataRendererSelectedClassLv implements IDataRenderer {
@Override
@@ -66,12 +65,10 @@ public class DataRendererSelectedClassLv implements IDataRenderer {
}
@Override
- public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) {
+ public List<String> onHover(PlayerProfile playerProfile) {
ClassSpecificData<PlayerProfile.PlayerClassData> dungeonStatDungeonSpecificData = playerProfile.getPlayerClassData().get(playerProfile.getSelectedClass());
- if (dungeonStatDungeonSpecificData == null) return;
+ if (dungeonStatDungeonSpecificData == null) return null;
XPUtils.XPCalcResult xpCalcResult = XPUtils.getCataXp(dungeonStatDungeonSpecificData.getData().getExperience());
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- GuiUtils.drawHoveringText(Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+ TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format((long)dungeonStatDungeonSpecificData.getData().getExperience())),mouseX, mouseY,
- scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, Minecraft.getMinecraft().fontRendererObj);
+ return Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+ TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format((long)dungeonStatDungeonSpecificData.getData().getExperience()));
}
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSetUrOwn.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSetUrOwn.java
index 919201a9..1916218b 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSetUrOwn.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSetUrOwn.java
@@ -24,6 +24,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import java.awt.*;
+import java.util.List;
public class DataRendererSetUrOwn implements IDataRenderer {
@Override
@@ -37,8 +38,8 @@ public class DataRendererSetUrOwn implements IDataRenderer {
}
@Override
- public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) {
-
+ public List<String> onHover(PlayerProfile playerProfile) {
+ return null;
}
@Override
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSkillLv.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSkillLv.java
index aede6295..3165611f 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSkillLv.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererSkillLv.java
@@ -26,11 +26,10 @@ import kr.syeyoung.dungeonsguide.mod.utils.TextUtils;
import kr.syeyoung.dungeonsguide.mod.utils.XPUtils;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
-import net.minecraft.client.gui.ScaledResolution;
-import net.minecraftforge.fml.client.config.GuiUtils;
import java.awt.*;
import java.util.Arrays;
+import java.util.List;
public class DataRendererSkillLv implements IDataRenderer {
private final Skill skill;
@@ -69,12 +68,10 @@ public class DataRendererSkillLv implements IDataRenderer {
}
@Override
- public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) {
+ public List<String> onHover(PlayerProfile playerProfile) {
Double xp = playerProfile.getSkillXp().get(skill);
- if (xp == null) return;
+ if (xp == null) return null;
XPUtils.XPCalcResult xpCalcResult = XPUtils.getSkillXp(skill, xp);
- ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
- GuiUtils.drawHoveringText(Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+ TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format(xp.longValue())),mouseX, mouseY,
- scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, Minecraft.getMinecraft().fontRendererObj);
+ return Arrays.asList("§bCurrent Lv§7: §e"+xpCalcResult.getLevel(),"§bExp§7: §e"+ TextUtils.format((long)xpCalcResult.getRemainingXp()) + "§7/§e"+TextUtils.format((long)xpCalcResult.getNextLvXp()), "§bTotal Xp§7: §e"+ TextUtils.format(xp.longValue()));
}
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererTalismans.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererTalismans.java
index 4bd59644..40e523e1 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererTalismans.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/datarenders/impl/DataRendererTalismans.java
@@ -28,7 +28,6 @@ import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
-import net.minecraftforge.fml.client.config.GuiUtils;
import java.awt.*;
import java.util.ArrayList;
@@ -99,17 +98,16 @@ public class DataRendererTalismans implements IDataRenderer {
}
@Override
- public void onHover(PlayerProfile playerProfile, int mouseX, int mouseY) {
+ public List<String> onHover(PlayerProfile playerProfile) {
int[] rawData = (int[]) playerProfile.getAdditionalProperties().get("talismanCnt");
- if (rawData == null) return;
+ if (rawData == null) return null;
ScaledResolution scaledResolution = new ScaledResolution(Minecraft.getMinecraft());
List<String> list = new ArrayList<>();
for (Rarity r : Rarity.values()) {
list.add(r.getColor()+r.name()+"§7: §e"+rawData[r.idx]);
}
- GuiUtils.drawHoveringText(list,mouseX, mouseY,
- scaledResolution.getScaledWidth(), scaledResolution.getScaledHeight(), -1, Minecraft.getMinecraft().fontRendererObj);
+ return list;
}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/PlayerModelRenderer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/PlayerModelRenderer.java
new file mode 100644
index 00000000..54dcd2af
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/PlayerModelRenderer.java
@@ -0,0 +1,179 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2023 cyoung06 (syeyoung)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.widget;
+
+import com.mojang.authlib.GameProfile;
+import kr.syeyoung.dungeonsguide.mod.DungeonsGuide;
+import kr.syeyoung.dungeonsguide.mod.cosmetics.ActiveCosmetic;
+import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticData;
+import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.FakePlayer;
+import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile;
+import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute;
+import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement;
+import kr.syeyoung.dungeonsguide.mod.guiv2.Widget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.MinecraftTooltip;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.MouseTooltip;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.PopupMgr;
+import kr.syeyoung.dungeonsguide.mod.guiv2.layouter.Layouter;
+import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.ConstraintBox;
+import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Size;
+import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.Renderer;
+import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.RenderingContext;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedExportOnlyWidget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Export;
+import kr.syeyoung.dungeonsguide.mod.utils.TextUtils;
+import lombok.AllArgsConstructor;
+import lombok.Setter;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.inventory.GuiInventory;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.RenderHelper;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL14;
+
+import java.util.Collections;
+import java.util.List;
+
+public class PlayerModelRenderer extends AnnotatedExportOnlyWidget implements Layouter, Renderer {
+ @Setter
+ private FakePlayer fakePlayer;
+ public PlayerModelRenderer(FakePlayer fakePlayer) {
+ this.fakePlayer = fakePlayer;
+ }
+ // let me do the skin fetching myself.
+ @Override
+ public List<Widget> build(DomElement buildContext) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Size layout(DomElement buildContext, ConstraintBox constraintBox) {
+ return new Size(constraintBox.getMaxWidth(), constraintBox.getMaxHeight());
+ }
+
+ @Override
+ public double getMaxIntrinsicWidth(DomElement buildContext, double height) {
+ return 0;
+ }
+
+ @Override
+ public double getMaxIntrinsicHeight(DomElement buildContext, double width) {
+ return 0;
+ }
+
+ @Override
+ public void doRender(int absMouseX, int absMouseY, double relMouseX, double relMouseY, float partialTicks, RenderingContext context, DomElement buildContext) {
+ GlStateManager.enableDepth();
+ GlStateManager.color(1, 1, 1, 1.0F);
+ GuiInventory.drawEntityOnScreen(45, 150, 60, (float) -relMouseX+75, 0, fakePlayer);
+ GlStateManager.disableDepth();
+
+ String toDraw = fakePlayer.getName();
+ List<ActiveCosmetic> activeCosmetics = DungeonsGuide.getDungeonsGuide().getCosmeticsManager().getActiveCosmeticByPlayer().get(
+ fakePlayer.getGameProfile().getId());
+ CosmeticData prefix = null;
+ CosmeticData color = null;
+ if (activeCosmetics != null) {
+ for (ActiveCosmetic activeCosmetic : activeCosmetics) {
+ CosmeticData cosmeticData = DungeonsGuide.getDungeonsGuide().getCosmeticsManager().getCosmeticDataMap().get(activeCosmetic.getCosmeticData());
+ if (cosmeticData != null) {
+ if (cosmeticData.getCosmeticType().equals("prefix")) prefix = cosmeticData;
+ if (cosmeticData.getCosmeticType().equals("color")) color = cosmeticData;
+ }
+ }
+ }
+ toDraw = (color == null ? "§e" : color.getData().replace("&", "§")) + toDraw;
+ if (prefix != null) toDraw = prefix.getData().replace("&", "§") + " " + toDraw;
+
+ GlStateManager.enableBlend();
+ GL14.glBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
+ GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
+
+
+ String profileName = "on §6" + this.fakePlayer.getSkyblockProfile().getProfileName();
+ FontRenderer fr = Minecraft.getMinecraft().fontRendererObj;
+ fr.drawString(profileName, (90 - fr.getStringWidth(profileName)) / 2, 15, -1);
+ fr.drawString(toDraw, (90 - fr.getStringWidth(toDraw)) / 2, 10 - (fr.FONT_HEIGHT / 2), -1);
+ }
+
+ private MinecraftTooltip actualTooltip = new MinecraftTooltip();
+ private MouseTooltip tooltip = null;
+ @Override
+ public boolean mouseMoved(int absMouseX, int absMouseY, double relMouseX0, double relMouseY0) {
+ ItemStack toHover = null;
+ System.out.println(relMouseX0+"/"+relMouseY0);
+ if (relMouseX0 > 20 && relMouseX0 < 70) {
+ if (33 <= relMouseY0 && relMouseY0 <= 66) {
+ toHover = fakePlayer.getInventory()[3];
+ } else if (66 <= relMouseY0 && relMouseY0 <= 108) {
+ toHover = fakePlayer.getInventory()[2];
+ } else if (108 <= relMouseY0 && relMouseY0 <= 130) {
+ toHover = fakePlayer.getInventory()[1];
+ } else if (130 <= relMouseY0 && relMouseY0 <= 154) {
+ toHover = fakePlayer.getInventory()[0];
+ }
+ } else if (relMouseX0 > 0 && relMouseX0 <= 20) {
+ if (80 <= relMouseY0 && relMouseY0 <= 120) {
+ toHover = fakePlayer.inventory.mainInventory[fakePlayer.inventory.currentItem];
+ }
+ }
+ if (toHover != null) {
+ List<String> list = toHover.getTooltip(Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().gameSettings.advancedItemTooltips);
+ for (int i = 0; i < list.size(); ++i) {
+ if (i == 0) {
+ list.set(i, toHover.getRarity().rarityColor + list.get(i));
+ } else {
+ list.set(i, EnumChatFormatting.GRAY + list.get(i));
+ }
+ }
+ actualTooltip.setTooltip(list);
+ }
+ if (toHover == null && this.tooltip != null) {
+ PopupMgr.getPopupMgr(getDomElement())
+ .closePopup(this.tooltip, null);
+ this.tooltip = null;
+ } else if (toHover != null && this.tooltip == null)
+ PopupMgr.getPopupMgr(getDomElement())
+ .openPopup(this.tooltip = new MouseTooltip(absMouseX, absMouseY, actualTooltip), null);
+ return false;
+ }
+
+
+ @Override
+ public void mouseExited(int absMouseX, int absMouseY, double relMouseX, double relMouseY) {
+ if (this.tooltip != null) {
+ PopupMgr.getPopupMgr(getDomElement())
+ .closePopup(this.tooltip, null);
+ this.tooltip = null;
+ }
+ }
+
+ @Override
+ public void onUnmount() {
+ if (this.tooltip != null) {
+ PopupMgr.getPopupMgr(getDomElement())
+ .closePopup(this.tooltip, null);
+ this.tooltip = null;
+ }
+ }
+}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetDataRendererWrapper.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetDataRendererWrapper.java
new file mode 100644
index 00000000..dc98feb5
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetDataRendererWrapper.java
@@ -0,0 +1,112 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2023 cyoung06 (syeyoung)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.widget;
+
+import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile;
+import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.IDataRenderer;
+import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement;
+import kr.syeyoung.dungeonsguide.mod.guiv2.Widget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.MinecraftTooltip;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.MouseTooltip;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.PopupMgr;
+import kr.syeyoung.dungeonsguide.mod.guiv2.layouter.Layouter;
+import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.ConstraintBox;
+import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Size;
+import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.Renderer;
+import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.RenderingContext;
+import net.minecraft.client.Minecraft;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+
+import java.awt.*;
+import java.util.Collections;
+import java.util.List;
+
+public class WidgetDataRendererWrapper extends Widget implements Layouter, Renderer {
+ private PlayerProfile profile;
+ private final IDataRenderer dataRenderer;
+ public WidgetDataRendererWrapper(PlayerProfile profile, IDataRenderer dataRenderer) {
+ this.profile = profile;
+ this.dataRenderer = dataRenderer;
+ }
+
+ public void setProfile(PlayerProfile profile) {
+ this.profile = profile;
+ }
+
+ @Override
+ public List<Widget> build(DomElement buildContext) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Size layout(DomElement buildContext, ConstraintBox constraintBox) {
+ Dimension dim = dataRenderer.getDimension();
+ return new Size(
+ Layouter.clamp(dim.width, constraintBox.getMinWidth(), constraintBox.getMaxWidth()),
+ Layouter.clamp(dim.height, constraintBox.getMinHeight(), constraintBox.getMaxHeight())
+ );
+ }
+
+ @Override
+ public void doRender(int absMouseX, int absMouseY, double relMouseX, double relMouseY, float partialTicks, RenderingContext context, DomElement buildContext) {
+ dataRenderer.renderData(profile);
+ }
+
+
+ private MinecraftTooltip actualTooltip = new MinecraftTooltip();
+ private MouseTooltip tooltip = null;
+ @Override
+ public boolean mouseMoved(int absMouseX, int absMouseY, double relMouseX0, double relMouseY0) {
+ List<String> toHover = null;
+ if (getDomElement().getAbsBounds().contains(absMouseX, absMouseY))
+ toHover = dataRenderer.onHover(profile);
+
+ if (toHover != null)
+ actualTooltip.setTooltip(toHover);
+
+ if (toHover == null && this.tooltip != null) {
+ PopupMgr.getPopupMgr(getDomElement())
+ .closePopup(this.tooltip, null);
+ this.tooltip = null;
+ } else if (toHover != null && this.tooltip == null)
+ PopupMgr.getPopupMgr(getDomElement())
+ .openPopup(this.tooltip = new MouseTooltip(absMouseX, absMouseY, actualTooltip), null);
+ return false;
+ }
+
+ @Override
+ public void mouseExited(int absMouseX, int absMouseY, double relMouseX, double relMouseY) {
+ if (this.tooltip != null) {
+ PopupMgr.getPopupMgr(getDomElement())
+ .closePopup(this.tooltip, null);
+ this.tooltip = null;
+ }
+ }
+
+
+ @Override
+ public void onUnmount() {
+ if (this.tooltip != null) {
+ PopupMgr.getPopupMgr(getDomElement())
+ .closePopup(this.tooltip, null);
+ this.tooltip = null;
+ }
+ }
+}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetPlayerInventory.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetPlayerInventory.java
new file mode 100644
index 00000000..87d5077b
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetPlayerInventory.java
@@ -0,0 +1,148 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2023 cyoung06 (syeyoung)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.widget;
+
+import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile;
+import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement;
+import kr.syeyoung.dungeonsguide.mod.guiv2.Widget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.MinecraftTooltip;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.MouseTooltip;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.PopupMgr;
+import kr.syeyoung.dungeonsguide.mod.guiv2.layouter.Layouter;
+import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.ConstraintBox;
+import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Size;
+import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.Renderer;
+import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.RenderingContext;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.client.renderer.RenderHelper;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+
+import java.util.Collections;
+import java.util.List;
+
+public class WidgetPlayerInventory extends Widget implements Renderer, Layouter {
+ @Override
+ public List<Widget> build(DomElement buildContext) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Size layout(DomElement buildContext, ConstraintBox constraintBox) {
+ return new Size(164, 74);
+ }
+
+ public WidgetPlayerInventory(PlayerProfile profile) {
+ this.playerProfile = profile;
+ }
+ private PlayerProfile playerProfile;
+
+ public void setPlayerProfile(PlayerProfile playerProfile) {
+ this.playerProfile = playerProfile;
+ }
+
+ @Override
+ public void doRender(int absMouseX, int absMouseY, double relMouseX, double relMouseY, float partialTicks, RenderingContext context, DomElement buildContext) {
+ Gui.drawRect(0, 0, 164, 74, 0xFF000000);
+ GlStateManager.disableLighting();
+
+ if (playerProfile.getInventory() != null) {
+ GlStateManager.disableRescaleNormal();
+ RenderHelper.enableGUIStandardItemLighting();
+ GlStateManager.disableLighting();
+ for (int i = 0; i < playerProfile.getInventory().length; i++) {
+ int x = (i % 9) * 18 + 1;
+ int y = (i / 9) * 18 + 1;
+ Gui.drawRect(x, y, x + 18, y + 18, 0xFF000000);
+ Gui.drawRect(x + 1, y + 1, x + 17, y + 17, 0xFF666666);
+ GlStateManager.color(1, 1, 1, 1.0F);
+
+ Minecraft.getMinecraft().getRenderItem().renderItemAndEffectIntoGUI(playerProfile.getInventory()[(i + 9) % 36], (i % 9) * 18 + 2, (i / 9) * 18 + 2);
+ }
+ } else {
+ Gui.drawRect(1, 1, 162, 72, 0xFF666666);
+ Minecraft.getMinecraft().fontRendererObj.drawSplitString("Player has disabled Inventory API", 6, 6, 142, -1);
+ }
+ }
+
+
+
+ private MinecraftTooltip actualTooltip = new MinecraftTooltip();
+ private MouseTooltip tooltip = null;
+ @Override
+ public boolean mouseMoved(int absMouseX, int absMouseY, double relMouseX, double relMouseY) {
+ List<String> toHover = null;
+ if (getDomElement().getAbsBounds().contains(absMouseX, absMouseY)) {
+ ItemStack toHoverStack = null;
+ for (int i = 0; i < playerProfile.getInventory().length; i++) {
+ int x = (i % 9) * 18 + 1;
+ int y = (i / 9) * 18 + 1;
+ if (x <= relMouseX && relMouseX < x + 18 && y <= relMouseY && relMouseY < y + 18) {
+ toHoverStack = playerProfile.getInventory()[(i + 9) % 36];
+ }
+ }
+
+
+ if (toHoverStack != null) {
+ List<String> list = toHoverStack.getTooltip(Minecraft.getMinecraft().thePlayer,
+ Minecraft.getMinecraft().gameSettings.advancedItemTooltips);
+ for (int i = 0; i < list.size(); ++i) {
+ if (i == 0) {
+ list.set(i, toHoverStack.getRarity().rarityColor + list.get(i));
+ } else {
+ list.set(i, EnumChatFormatting.GRAY + list.get(i));
+ }
+ }
+ toHover= list;
+ }
+ }
+
+ if (toHover != null)
+ actualTooltip.setTooltip(toHover);
+
+ if (toHover == null && this.tooltip != null) {
+ PopupMgr.getPopupMgr(getDomElement())
+ .closePopup(this.tooltip, null);
+ this.tooltip = null;
+ } else if (toHover != null && this.tooltip == null)
+ PopupMgr.getPopupMgr(getDomElement())
+ .openPopup(this.tooltip = new MouseTooltip(absMouseX, absMouseY, actualTooltip), null);
+ return false;
+ }
+
+ @Override
+ public void mouseExited(int absMouseX, int absMouseY, double relMouseX, double relMouseY) {
+ if (this.tooltip != null) {
+ PopupMgr.getPopupMgr(getDomElement())
+ .closePopup(this.tooltip, null);
+ this.tooltip = null;
+ }
+ }
+
+ @Override
+ public void onUnmount() {
+ if (this.tooltip != null) {
+ PopupMgr.getPopupMgr(getDomElement())
+ .closePopup(this.tooltip, null);
+ this.tooltip = null;
+ }
+ }
+}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetPlayerModel.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetPlayerModel.java
new file mode 100644
index 00000000..86eafaa7
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetPlayerModel.java
@@ -0,0 +1,105 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2023 cyoung06 (syeyoung)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.widget;
+
+import com.mojang.authlib.GameProfile;
+import kr.syeyoung.dungeonsguide.mod.DungeonsGuide;
+import kr.syeyoung.dungeonsguide.mod.cosmetics.ActiveCosmetic;
+import kr.syeyoung.dungeonsguide.mod.cosmetics.CosmeticData;
+import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.FakePlayer;
+import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.ApiFetcher;
+import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.SkinFetcher;
+import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfile;
+import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute;
+import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement;
+import kr.syeyoung.dungeonsguide.mod.guiv2.Widget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.MinecraftTooltip;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.MouseTooltip;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.PopupMgr;
+import kr.syeyoung.dungeonsguide.mod.guiv2.layouter.Layouter;
+import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.ConstraintBox;
+import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Size;
+import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.Renderer;
+import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.RenderingContext;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedExportOnlyWidget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedWidget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Export;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.On;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.FontRenderer;
+import net.minecraft.client.gui.inventory.GuiInventory;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.item.ItemStack;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraft.util.ResourceLocation;
+import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL14;
+
+import java.util.Collections;
+import java.util.List;
+
+public class WidgetPlayerModel extends AnnotatedWidget {
+
+ @Bind(variableName = "visible")
+ public final BindableAttribute<String> visible = new BindableAttribute<>(String.class, "fetching");
+
+ @Bind(variableName = "playerRender")
+ public final BindableAttribute<Widget> widgetBindable = new BindableAttribute<>(Widget.class, null);
+
+ private volatile PlayerProfile sbProfile;
+ private final GameProfile mcProfile;
+ private volatile FakePlayer fakePlayer;
+ private final PlayerModelRenderer renderer;
+ public WidgetPlayerModel(GameProfile mcProfile, PlayerProfile sbProfile) {
+ super(new ResourceLocation("dungeonsguide:gui/features/profileViewer/player.gui"));
+ this.mcProfile = mcProfile;
+ this.sbProfile = sbProfile;
+ this.renderer = new PlayerModelRenderer(null);
+ refresh();
+ }
+
+ public void setSbProfile(PlayerProfile sbProfile) {
+ this.sbProfile = sbProfile;
+ if (this.fakePlayer != null)
+ this.fakePlayer.setSkyblockProfile(sbProfile);
+ }
+
+ @On(functionName = "refresh")
+ public void refresh() {
+ fakePlayer = null;
+ widgetBindable.setValue(null);
+ renderer.setFakePlayer(null);
+ visible.setValue("fetching");
+ SkinFetcher.getSkinSet(mcProfile)
+ .whenComplete((a,e) ->{
+ if (e != null){
+ e.printStackTrace();
+ visible.setValue("noPlayer");
+ } else {
+ fakePlayer = new FakePlayer(
+ mcProfile, a, sbProfile
+ );
+ renderer.setFakePlayer(fakePlayer);
+ widgetBindable.setValue(renderer);
+ visible.setValue("player");
+ }
+ });
+ }
+}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetProfileViewer.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetProfileViewer.java
new file mode 100644
index 00000000..a5109610
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetProfileViewer.java
@@ -0,0 +1,94 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2023 cyoung06 (syeyoung)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.widget;
+
+import com.mojang.authlib.GameProfile;
+import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.ApiFetcher;
+import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute;
+import kr.syeyoung.dungeonsguide.mod.guiv2.Widget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedWidget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.On;
+import net.minecraft.util.ResourceLocation;
+
+import java.util.UUID;
+
+public class WidgetProfileViewer extends AnnotatedWidget {
+
+ @Bind(variableName = "width")
+ public final BindableAttribute<Double> width = new BindableAttribute<>(Double.class, 500.0);
+ @Bind(variableName = "height")
+ public final BindableAttribute<Double> height = new BindableAttribute<>(Double.class, 500.0);
+ @Bind(variableName = "actualPV")
+ public final BindableAttribute<Widget> actualPV = new BindableAttribute<>(Widget.class, null);
+ @Bind(variableName = "visible")
+ public final BindableAttribute<String> visiblePage = new BindableAttribute<>(String.class, "fetching");
+
+ @Bind(variableName = "scale")
+ public final BindableAttribute<Double> scale = new BindableAttribute<>(Double.class, 1.0);
+ private GameProfile gameProfile;
+ private String apiKey;
+ private Runnable close;
+ public WidgetProfileViewer(GameProfile gameProfile, String apiKey, double scale, Runnable close) {
+ super(new ResourceLocation("dungeonsguide:gui/features/profileViewer/pv.gui"));
+ if (apiKey.isEmpty()) {
+ visiblePage.setValue("apiKeyInvalid");
+ return;
+ }
+ this.gameProfile = gameProfile;
+ this.apiKey = apiKey;
+ this.scale.setValue(scale);
+ this.close = close;
+ refresh();
+ }
+
+ @On(functionName = "refresh")
+ public void refresh() {
+ actualPV.setValue(null);
+ if (apiKey.isEmpty()) {
+ visiblePage.setValue("apiKeyInvalid");
+ return;
+ }
+ visiblePage.setValue("fetching");
+ ApiFetcher.fetchMostRecentProfileAsync(gameProfile.getId().toString(), apiKey)
+ .whenComplete((a,e) -> {
+ if (e != null) {
+ e.printStackTrace();
+ visiblePage.setValue("noPlayer");
+ } else {
+ if (a.isPresent()) {
+ actualPV.setValue(new WidgetProfileViewerData(gameProfile, a.get()));
+ visiblePage.setValue("pv");
+ } else {
+ visiblePage.setValue("noPlayer");
+ }
+ }
+ });
+ }
+
+ @Override
+ public void mouseExited(int absMouseX, int absMouseY, double relMouseX, double relMouseY) {
+ close.run();
+ }
+
+ @Override
+ public boolean mouseClicked(int absMouseX, int absMouseY, double relMouseX, double relMouseY, int mouseButton) {
+ return true;
+ }
+}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetProfileViewerData.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetProfileViewerData.java
new file mode 100644
index 00000000..e1cf6ab7
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/WidgetProfileViewerData.java
@@ -0,0 +1,133 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2023 cyoung06 (syeyoung)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.widget;
+
+import com.mojang.authlib.GameProfile;
+import kr.syeyoung.dungeonsguide.mod.chat.ChatProcessor;
+import kr.syeyoung.dungeonsguide.mod.features.FeatureRegistry;
+import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.ApiFetcher;
+import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.PlayerSkyblockData;
+import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.DataRendererRegistry;
+import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.datarenders.IDataRenderer;
+import kr.syeyoung.dungeonsguide.mod.features.impl.secret.mechanicbrowser.WidgetStateTooltip;
+import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute;
+import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement;
+import kr.syeyoung.dungeonsguide.mod.guiv2.Widget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.LocationedPopup;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.PopupMgr;
+import kr.syeyoung.dungeonsguide.mod.guiv2.elements.Scaler;
+import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Rect;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedWidget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.DomElementRegistry;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.ExportedWidgetConverter;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.On;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.data.WidgetList;
+import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.ScaledResolution;
+import net.minecraft.client.renderer.GlStateManager;
+import net.minecraft.util.ResourceLocation;
+
+import java.awt.*;
+import java.util.ArrayList;
+import java.util.List;
+
+public class WidgetProfileViewerData extends AnnotatedWidget {
+ @Bind(variableName = "playerModel")
+ public final BindableAttribute<Widget> playerModel = new BindableAttribute<>(Widget.class);
+ @Bind(variableName = "datarenderers")
+ public final BindableAttribute renderers = new BindableAttribute(WidgetList.class);
+
+ @Bind(variableName = "invButtonRef")
+ public final BindableAttribute<DomElement> inventoryButton = new BindableAttribute<>(DomElement.class);
+
+ private final PlayerSkyblockData playerSkyblockData;
+ private int idx;
+
+ private final GameProfile gameProfile;
+
+
+ private final WidgetPlayerModel widgetPlayerModel;
+
+ private List<WidgetDataRendererWrapper> dataRendererWrapperList = new ArrayList<>();
+
+ public WidgetProfileViewerData(GameProfile gameProfile, PlayerSkyblockData playerSkyblockData) {
+ super(new ResourceLocation("dungeonsguide:gui/features/profileViewer/data.gui"));
+
+ this.playerSkyblockData = playerSkyblockData;
+ this.gameProfile = gameProfile;
+
+ playerModel.setValue(widgetPlayerModel = new WidgetPlayerModel(gameProfile, playerSkyblockData.getPlayerProfiles()
+ [idx = playerSkyblockData.getLastestprofileArrayIndex()]));
+
+ List<String> stuff = FeatureRegistry.PARTYKICKER_VIEWPLAYER.<List<String>>getParameter("datarenderers").getValue();
+ for (String datarenderer : stuff) {
+ IDataRenderer dataRenderer = DataRendererRegistry.getDataRenderer(datarenderer);
+ dataRendererWrapperList.add(new WidgetDataRendererWrapper(playerSkyblockData.getPlayerProfiles()[idx], dataRenderer));
+ }
+
+ renderers.setValue(dataRendererWrapperList);
+ }
+
+
+ @On(functionName = "switchProfile")
+ public void switchToNext() {
+ idx = (idx + 1) % playerSkyblockData.getPlayerProfiles().length;
+ widgetPlayerModel.setSbProfile(playerSkyblockData.getPlayerProfiles()[idx]);
+ for (WidgetDataRendererWrapper widgetDataRendererWrapper : dataRendererWrapperList) {
+ widgetDataRendererWrapper.setProfile(playerSkyblockData.getPlayerProfiles()[idx]);
+ }
+ }
+
+ @On(functionName = "invite")
+ public void invite() {
+ ChatProcessor.INSTANCE.addToChatQueue("/p invite " + gameProfile.getName(), () -> {
+ }, true);
+ }
+ @On(functionName = "kick")
+ public void kick() {
+ ChatProcessor.INSTANCE.addToChatQueue("/p kick " + gameProfile.getName(), () -> {
+ }, true);
+ }
+
+
+ private LocationedPopup popup;
+ @On(functionName = "openInventory")
+ public void openStates() {
+ Rect abs = inventoryButton.getValue().getAbsBounds();
+ double x = abs.getX() + abs.getWidth();
+ double y = abs.getY();
+
+ PopupMgr popupMgr = PopupMgr.getPopupMgr(getDomElement());
+ Scaler scaler = new Scaler();
+ scaler.scale.setValue((double) new ScaledResolution(Minecraft.getMinecraft()).getScaleFactor());
+ scaler.child.setValue(new WidgetPlayerInventory(
+ playerSkyblockData.getPlayerProfiles()[idx]
+ ));
+ popupMgr.openPopup(popup = new LocationedPopup(x, y, scaler), null);
+ }
+
+ @Override
+ public void onUnmount() {
+ PopupMgr popupMgr = PopupMgr.getPopupMgr(getDomElement());
+ if (popup != null)
+ popupMgr.closePopup(popup, null);
+ }
+
+}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/DomElement.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/DomElement.java
index 7d863e74..46390e66 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/DomElement.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/DomElement.java
@@ -232,11 +232,10 @@ public class DomElement {
if (!absBounds.contains(absMouseX, absMouseY)) {
if (wasMouseIn) widget.mouseExited(absMouseX, absMouseY, relMouseX0, relMouseY0);
wasMouseIn = false;
- return false;
+ } else {
+ if (!wasMouseIn) widget.mouseEntered(absMouseX, absMouseY, relMouseX0, relMouseY0);
+ wasMouseIn = true;
}
- if (!wasMouseIn) widget.mouseEntered(absMouseX, absMouseY, relMouseX0, relMouseY0);
- wasMouseIn = true;
-
for (DomElement childComponent : children) {
Position transformed = renderer.transformPoint(childComponent, new Position(relMouseX0, relMouseY0));
@@ -244,7 +243,9 @@ public class DomElement {
return true;
}
}
- return widget.mouseMoved(absMouseX, absMouseY, relMouseX0, relMouseY0);
+ if (wasMouseIn)
+ return widget.mouseMoved(absMouseX, absMouseY, relMouseX0, relMouseY0);
+ return false;
}
public void setCursor(EnumCursor enumCursor) {
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/MinecraftTooltip.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/MinecraftTooltip.java
new file mode 100644
index 00000000..f445c52f
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/MinecraftTooltip.java
@@ -0,0 +1,58 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2023 cyoung06 (syeyoung)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.mod.guiv2.elements;
+
+import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement;
+import kr.syeyoung.dungeonsguide.mod.guiv2.Widget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.layouter.Layouter;
+import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.ConstraintBox;
+import kr.syeyoung.dungeonsguide.mod.guiv2.primitive.Size;
+import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.Renderer;
+import kr.syeyoung.dungeonsguide.mod.guiv2.renderer.RenderingContext;
+import net.minecraft.client.Minecraft;
+import net.minecraftforge.fml.client.config.GuiUtils;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+
+public class MinecraftTooltip extends Widget implements Renderer, Layouter {
+ public List<String> tooltip = new ArrayList<>();
+
+ public void setTooltip(List<String> tooltip) {
+ this.tooltip = tooltip;
+ }
+
+ @Override
+ public List<Widget> build(DomElement buildContext) {
+ return Collections.emptyList();
+ }
+
+ @Override
+ public Size layout(DomElement buildContext, ConstraintBox constraintBox) {
+ return new Size(constraintBox.getMaxWidth(), constraintBox.getMaxHeight());
+ }
+
+ @Override
+ public void doRender(int absMouseX, int absMouseY, double relMouseX, double relMouseY, float partialTicks, RenderingContext context, DomElement buildContext) {
+ GuiUtils.drawHoveringText(tooltip,0,0,
+ Minecraft.getMinecraft().displayWidth,
+ Minecraft.getMinecraft().displayHeight, -1, Minecraft.getMinecraft().fontRendererObj);
+ }
+}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/MouseTooltip.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/MouseTooltip.java
new file mode 100644
index 00000000..e065774e
--- /dev/null
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/MouseTooltip.java
@@ -0,0 +1,50 @@
+/*
+ * Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ * Copyright (C) 2023 cyoung06 (syeyoung)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <https://www.gnu.org/licenses/>.
+ */
+
+package kr.syeyoung.dungeonsguide.mod.guiv2.elements;
+
+import kr.syeyoung.dungeonsguide.mod.guiv2.BindableAttribute;
+import kr.syeyoung.dungeonsguide.mod.guiv2.DomElement;
+import kr.syeyoung.dungeonsguide.mod.guiv2.Widget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.AnnotatedWidget;
+import kr.syeyoung.dungeonsguide.mod.guiv2.xml.annotations.Bind;
+import net.minecraft.util.ResourceLocation;
+
+public class MouseTooltip extends AnnotatedWidget {
+ @Bind(variableName = "x")
+ public final BindableAttribute<Double> x = new BindableAttribute<>(Double.class);
+ @Bind(variableName = "y")
+ public final BindableAttribute<Double> y = new BindableAttribute<>(Double.class);;
+ @Bind(variableName = "ref")
+ public final BindableAttribute<DomElement> ref = new BindableAttribute<>(DomElement.class);
+ @Bind(variableName = "child")
+ public final BindableAttribute<Widget> child = new BindableAttribute<>(Widget.class);
+ public MouseTooltip(double mouseX, double mouseY, Widget child) {
+ super(new ResourceLocation("dungeonsguide:gui/elements/locationedPopup.gui"));
+ this.x.setValue(mouseX);
+ this.y.setValue(mouseY);
+ this.child.setValue(child);
+ }
+
+ @Override
+ public boolean mouseMoved(int absMouseX, int absMouseY, double relMouseX0, double relMouseY0) {
+ x.setValue((double) absMouseX);
+ y.setValue((double) absMouseY);
+ return false;
+ }
+}
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Slot.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Slot.java
index f4f52859..2ec81139 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Slot.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/guiv2/elements/Slot.java
@@ -33,6 +33,24 @@ public class Slot extends AnnotatedExportOnlyWidget {
@Export(attributeName = "_")
public final BindableAttribute<Widget> original = new BindableAttribute<>(Widget.class);
+ public Slot() {
+ replacement.addOnUpdate(this::update);
+ original.addOnUpdate(this::update);
+ }
+
+ private void update(Widget widget, Widget widget1) {
+ if (this.getDomElement().getParent() == null) return;
+ getDomElement().removeElement(getDomElement().getChildren().get(0));
+
+ DomElement domElement = null;
+ if (replacement.getValue() != null) domElement = replacement.getValue().createDomElement(getDomElement());
+ else if (original.getValue() != null) domElement = original.getValue().createDomElement(getDomElement());
+
+ if (domElement != null)
+ getDomElement().addElement(domElement);
+ }
+
+
@Override
public List<Widget> build(DomElement buildContext) {
if (replacement.getValue() != null) return Collections.singletonList(replacement.getValue());
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManagerRootWidget.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManagerRootWidget.java
index 80097025..ed5a259c 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManagerRootWidget.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/overlay/OverlayManagerRootWidget.java
@@ -37,7 +37,10 @@ public class OverlayManagerRootWidget extends Widget implements Layouter {
}
public void addOverlay(OverlayWidget overlayWidget) {
- if (getDomElement().getChildren().contains(overlayWidget.getDomElement())) return;
+ if (getDomElement().getChildren().contains(overlayWidget.getDomElement())) {
+ System.out.println("ono");
+ removeOverlay(overlayWidget);
+ }
DomElement domElement = overlayWidget.createDomElement(getDomElement());
getDomElement().addElement(domElement);
diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/tooltip.gui b/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/tooltip.gui
index d948c9cf..79a5ea2a 100644
--- a/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/tooltip.gui
+++ b/mod/src/main/resources/assets/dungeonsguide/gui/features/mechanicBrowser/tooltip.gui
@@ -17,7 +17,7 @@
-->
<UnconstrainedBox>
- <size width="120">
+ <size width="86">
<scaler bind:scale="scale">
<border>
<line slot="left" dir="VERTICAL" thickness="1.0" color="#FF444444"/>
diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/features/profileViewer/data.gui b/mod/src/main/resources/assets/dungeonsguide/gui/features/profileViewer/data.gui
new file mode 100644
index 00000000..6b8df44c
--- /dev/null
+++ b/mod/src/main/resources/assets/dungeonsguide/gui/features/profileViewer/data.gui
@@ -0,0 +1,72 @@
+<!--
+ ~ Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ ~ Copyright (C) 2023 cyoung06 (syeyoung)
+ ~
+ ~ This program is free software: you can redistribute it and/or modify
+ ~ it under the terms of the GNU Affero General Public License as published
+ ~ by the Free Software Foundation, either version 3 of the License, or
+ ~ (at your option) any later version.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ~ GNU Affero General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Affero General Public License
+ ~ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ -->
+
+<row>
+ <size width="90">
+ <col>
+ <flexible>
+ <!--Player model-->
+ <slot bind:child="playerModel"/>
+ </flexible>
+
+ <size height="11">
+ <row>
+ <flexible>
+ <ColorButton on:click="switchProfile" hPadding="1"
+ backgroundColor="#FF30AFD3" textColor="#FFFFFFFF"
+ hoveredBackgroundColor="#FFFFFFFF" hoveredTextColor="#FF30AFd3"
+ disabledBackgroundColor="0" disabledTextColor="0"
+ pressedBackgroundColor="#FFFFFFFF" pressedTextColor="#FF30AFd3"
+ text="§bSwitch Profile"
+ />
+ </flexible>
+ <size width="11">
+ <ColorButton on:click="openInventory" hPadding="1"
+ backgroundColor="#FF555555" textColor="#FFFFFFFF"
+ hoveredBackgroundColor="#FF636363" hoveredTextColor="#FFFFFFFF"
+ disabledBackgroundColor="0" disabledTextColor="0"
+ pressedBackgroundColor="#FF707070" pressedTextColor="#FFFFFFFF"
+ text="§eI" bind:ref="invButtonRef"
+ />
+ </size>
+ </row>
+ </size>
+ <size height="27">
+ <ColorButton on:click="invite" hPadding="1"
+ backgroundColor="#FF7289DA" textColor="#FFFFFFFF"
+ hoveredBackgroundColor="#FF859DF0" hoveredTextColor="#FFFFFFFF"
+ disabledBackgroundColor="0" disabledTextColor="0"
+ pressedBackgroundColor="#FF859DF0" pressedTextColor="#FFFFFFFF"
+ text="Invite"
+ />
+ </size>
+ <size height="27">
+ <ColorButton on:click="kick" hPadding="1"
+ backgroundColor="#FFFF3333" textColor="#FFFFFFFF"
+ hoveredBackgroundColor="#FFFF7777" hoveredTextColor="#FFFFFFFF"
+ disabledBackgroundColor="0" disabledTextColor="0"
+ pressedBackgroundColor="#FFFF7777" pressedTextColor="#FFFFFFFF"
+ text="Kick"
+ />
+ </size>
+ </col>
+ </size>
+ <flexible>
+ <col bind:_="datarenderers"/>
+ </flexible>
+</row> \ No newline at end of file
diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/features/profileViewer/player.gui b/mod/src/main/resources/assets/dungeonsguide/gui/features/profileViewer/player.gui
new file mode 100644
index 00000000..256d48d1
--- /dev/null
+++ b/mod/src/main/resources/assets/dungeonsguide/gui/features/profileViewer/player.gui
@@ -0,0 +1,42 @@
+<!--
+ ~ Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ ~ Copyright (C) 2023 cyoung06 (syeyoung)
+ ~
+ ~ This program is free software: you can redistribute it and/or modify
+ ~ it under the terms of the GNU Affero General Public License as published
+ ~ by the Free Software Foundation, either version 3 of the License, or
+ ~ (at your option) any later version.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ~ GNU Affero General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Affero General Public License
+ ~ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ -->
+<size>
+ <SelectiveContainer bind:visible="visible">
+ <slot bind:child="playerRender" slot="player"/>
+ <slot slot="noPlayer">
+ <col mainAlign="CENTER" crossAlign="CENTER">
+ <Text text="An error occured while fetching skin" color="#FFFFFFFF"/>
+ <Text text="Or player does not exist" color="#FFFFFFFF"/>
+ <size width="50" height="27">
+ <ColorButton on:click="refresh" hPadding="1"
+ backgroundColor="#FF7289DA" textColor="#FFFFFFFF"
+ hoveredBackgroundColor="#FF859DF0" hoveredTextColor="#FFFFFFFF"
+ disabledBackgroundColor="0" disabledTextColor="0"
+ pressedBackgroundColor="#FF859DF0" pressedTextColor="#FFFFFFFF"
+ text="Refresh"
+ />
+ </size>
+ </col>
+ </slot>
+ <slot slot="fetching">
+ <align hAlign="CENTER" vAlign="CENTER">
+ <Text text="Fetching..." color="#FFFFFFFF"/>
+ </align>
+ </slot>
+ </SelectiveContainer>
+</size> \ No newline at end of file
diff --git a/mod/src/main/resources/assets/dungeonsguide/gui/features/profileViewer/pv.gui b/mod/src/main/resources/assets/dungeonsguide/gui/features/profileViewer/pv.gui
new file mode 100644
index 00000000..53050180
--- /dev/null
+++ b/mod/src/main/resources/assets/dungeonsguide/gui/features/profileViewer/pv.gui
@@ -0,0 +1,68 @@
+<!--
+ ~ Dungeons Guide - The most intelligent Hypixel Skyblock Dungeons Mod
+ ~ Copyright (C) 2023 cyoung06 (syeyoung)
+ ~
+ ~ This program is free software: you can redistribute it and/or modify
+ ~ it under the terms of the GNU Affero General Public License as published
+ ~ by the Free Software Foundation, either version 3 of the License, or
+ ~ (at your option) any later version.
+ ~
+ ~ This program is distributed in the hope that it will be useful,
+ ~ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ ~ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ ~ GNU Affero General Public License for more details.
+ ~
+ ~ You should have received a copy of the GNU Affero General Public License
+ ~ along with this program. If not, see <https://www.gnu.org/licenses/>.
+ -->
+
+<scaler bind:scale="scale">
+ <border>
+ <line slot="left" dir="VERTICAL" thickness="1.0" color="#FF23272A"/>
+ <line slot="top" dir="HORIZONTAL" thickness="1.0" color="#FF23272A"/>
+ <line slot="bottom" dir="HORIZONTAL" thickness="1.0" color="#FF23272A"/>
+ <line slot="right" dir="VERTICAL" thickness="1.0" color="#FF23272A"/>
+ <bgcolor slot="content" backgroundColor="#FF2C2F33">
+ <clip>
+ <SelectiveContainer bind:visible="visible">
+ <slot bind:child="actualPV" slot="pv"/>
+ <slot slot="apiKeyInvalid">
+ <col mainAlign="CENTER" crossAlign="CENTER">
+ <Text text="API key is invalid or missing" color="#FFFFFFFF"/>
+ <size width="50" height="27">
+ <ColorButton on:click="refresh" hPadding="1"
+ backgroundColor="#FF7289DA" textColor="#FFFFFFFF"
+ hoveredBackgroundColor="#FF859DF0" hoveredTextColor="#FFFFFFFF"
+ disabledBackgroundColor="0" disabledTextColor="0"
+ pressedBackgroundColor="#FF859DF0" pressedTextColor="#FFFFFFFF"
+ text="Refresh"
+ />
+ </size>
+ </col>
+ </slot>
+ <slot slot="noPlayer">
+ <col mainAlign="CENTER" crossAlign="CENTER">
+ <Text text="An error occured while fetching profile" color="#FFFFFFFF"/>
+ <Text text="Or maybe player does not exist?" color="#FFFFFFFF"/>
+ <size width="50" height="27">
+ <ColorButton on:click="refresh" hPadding="1"
+ backgroundColor="#FF7289DA" textColor="#FFFFFFFF"
+ hoveredBackgroundColor="#FF859DF0" hoveredTextColor="#FFFFFFFF"
+ disabledBackgroundColor="0" disabledTextColor="0"
+ pressedBackgroundColor="#FF859DF0" pressedTextColor="#FFFFFFFF"
+ text="Refresh"
+ />
+ </size>
+ </col>
+ </slot>
+ <slot slot="fetching">
+ <align hAlign="CENTER" vAlign="CENTER">
+ <Text text="Fetching..." color="#FFFFFFFF"/>
+ </align>
+ </slot>
+ </SelectiveContainer>
+
+ </clip>
+ </bgcolor>
+ </border>
+</scaler> \ No newline at end of file