aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorsyeyoung <cyoung06@naver.com>2023-01-22 17:26:27 +0900
committersyeyoung <cyoung06@naver.com>2023-01-22 17:26:27 +0900
commitbab77894b18c80461fd1db2565d783aa0a9f7f49 (patch)
tree0b5dc808b854ac86130755e6ae7b4ab91372a706 /mod
parent4b6f8e059e8417c14fc5e93a6bda55526986f646 (diff)
downloadSkyblock-Dungeons-Guide-bab77894b18c80461fd1db2565d783aa0a9f7f49.tar.gz
Skyblock-Dungeons-Guide-bab77894b18c80461fd1db2565d783aa0a9f7f49.tar.bz2
Skyblock-Dungeons-Guide-bab77894b18c80461fd1db2565d783aa0a9f7f49.zip
- fix skin not loading in pv
Signed-off-by: syeyoung <cyoung06@naver.com>
Diffstat (limited to 'mod')
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/commands/CommandDungeonsGuide.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/ApiFetcher.java2
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/SkinFetcher.java46
-rw-r--r--mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/widget/PlayerModelRenderer.java1
4 files changed, 32 insertions, 19 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 fd8d7164..f682055f 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
@@ -29,6 +29,7 @@ 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.features.impl.party.playerpreview.api.SkinFetcher;
import kr.syeyoung.dungeonsguide.mod.guiv2.elements.image.ImageTexture;
import kr.syeyoung.dungeonsguide.mod.party.PartyManager;
import kr.syeyoung.dungeonsguide.mod.stomp.StompManager;
@@ -112,6 +113,7 @@ public class CommandDungeonsGuide extends CommandBase {
cosmeticsManager.requestActiveCosmetics();
StaticResourceCache.INSTANCE.purgeCache();
ImageTexture.imageMap.clear();
+ SkinFetcher.purgeCache();
sender.addChatMessage(new ChatComponentText("§eDungeons Guide §7:: §fSuccessfully purged API Cache!"));
} else if (args[0].equals("pbroadcast")) {
diff --git a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/ApiFetcher.java b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/ApiFetcher.java
index 9519879b..36c59fe9 100644
--- a/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/ApiFetcher.java
+++ b/mod/src/main/java/kr/syeyoung/dungeonsguide/mod/features/impl/party/playerpreview/api/ApiFetcher.java
@@ -51,7 +51,7 @@ public class ApiFetcher {
private static final Map<String, CachedData<String>> UIDtoNickname = new ConcurrentHashMap<>();
private static final Map<String, CachedData<GameProfile>> UIDtoGameProfile = new ConcurrentHashMap<>();
- private static final ExecutorService ex = Executors.newFixedThreadPool(4, DungeonsGuide.THREAD_FACTORY);
+ public static final ExecutorService ex = Executors.newFixedThreadPool(4, DungeonsGuide.THREAD_FACTORY);
private static final Set<String> invalidKeys = new HashSet<>();
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 b93debf9..fa9e11ab 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
@@ -20,6 +20,7 @@ package kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api;
import com.mojang.authlib.GameProfile;
import com.mojang.authlib.minecraft.MinecraftProfileTexture;
+import kr.syeyoung.dungeonsguide.mod.features.impl.party.playerpreview.api.playerprofile.PlayerProfileParser;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@@ -57,27 +58,38 @@ public class SkinFetcher {
SkinSet skinSet = new SkinSet();
CompletableFuture<SkinSet> skinSet2 = new CompletableFuture<>();
currentReq.put(gameProfile.getId().toString(), skinSet2);
- Minecraft.getMinecraft().getSkinManager().loadProfileTextures(gameProfile, new SkinManager.SkinAvailableCallback() {
- public void skinAvailable(MinecraftProfileTexture.Type p_180521_1_, ResourceLocation location, MinecraftProfileTexture profileTexture) {
- switch (p_180521_1_) {
- case SKIN:
- skinSet.setSkinLoc(location);
- skinSet.setSkinType(profileTexture.getMetadata("model"));
- if (skinSet.getSkinType() == null) {
- skinSet.setSkinType("default");
+ ApiFetcher.ex.submit(() -> {
+ GameProfile gameProfile1 = Minecraft.getMinecraft().getSessionService().fillProfileProperties(gameProfile, true);
+
+ Minecraft.getMinecraft().getSkinManager().loadProfileTextures(gameProfile1, new SkinManager.SkinAvailableCallback() {
+ public void skinAvailable(MinecraftProfileTexture.Type p_180521_1_, ResourceLocation location, MinecraftProfileTexture profileTexture) {
+ switch (p_180521_1_) {
+ case SKIN:
+ skinSet.setSkinLoc(location);
+ skinSet.setSkinType(profileTexture.getMetadata("model"));
+ if (skinSet.getSkinType() == null) {
+ skinSet.setSkinType("default");
+ }
+ skinSet2.complete(skinSet);
+ skinSetMap.put(gameProfile.getId().toString(), new CachedData<>(System.currentTimeMillis() + 1000*60*60*3, skinSet));
+ currentReq.get(gameProfile.getId().toString());
+ break;
+ case CAPE:
+ skinSet.setCapeLoc(location);
}
- skinSet2.complete(skinSet);
- skinSetMap.put(gameProfile.getId().toString(), new CachedData<>(System.currentTimeMillis() + 1000*60*60*3, skinSet));
- currentReq.get(gameProfile.getId().toString());
- break;
- case CAPE:
- skinSet.setCapeLoc(location);
- }
- }
- }, true);
+ }
+ }, true);
+ });
return skinSet2;
}
+
+ public static void purgeCache() {
+ skinSetMap.clear();
+ currentReq.clear();
+ }
+
+
@Data
@NoArgsConstructor
@AllArgsConstructor
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
index 54dcd2af..e4e1e97c 100644
--- 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
@@ -120,7 +120,6 @@ public class PlayerModelRenderer extends AnnotatedExportOnlyWidget implements La
@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];