diff --git a/gradle.properties b/gradle.properties index 6d08862fe3..fb662b6712 100644 --- a/gradle.properties +++ b/gradle.properties @@ -33,9 +33,9 @@ occlusionculling_version = 0.0.8-SNAPSHOT ## neu repoparser (https://repo.nea.moe/#/releases/moe/nea/neurepoparser/) repoparser_version = 1.6.0 ## Networth Calculator (https://github.com/AzureAaron/networth-calculator) -networth_calculator_version = 1.0.3 +networth_calculator_version = 1.0.4 ## Legacy Item DFU (https://github.com/AzureAaron/legacy-item-dfu) -legacy_item_dfu_version = 1.0.0+1.21.1 +legacy_item_dfu_version = 1.0.1+1.21.1 # Other Libraries ## JGit (https://mvnrepository.com/artifact/org.eclipse.jgit/org.eclipse.jgit) diff --git a/src/main/java/de/hysky/skyblocker/skyblock/itemlist/ItemFixerUpper.java b/src/main/java/de/hysky/skyblocker/skyblock/itemlist/ItemFixerUpper.java index ab748698d8..e931c7e2ab 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/itemlist/ItemFixerUpper.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/itemlist/ItemFixerUpper.java @@ -180,6 +180,8 @@ public class ItemFixerUpper { private final static Int2ObjectMap SPAWN_EGG_VARIANTS = Int2ObjectMaps.unmodifiable(new Int2ObjectOpenHashMap<>(Map.ofEntries( //This entry 0 is technically not right but Hypixel decided to make it polar bear so well we use that Map.entry(0, "minecraft:polar_bear_spawn_egg"), + //This entry 4 does not actually exist, Hypixel uses it as a placeholder for elder guardians + Map.entry(4, "minecraft:elder_guardian_spawn_egg"), Map.entry(50, "minecraft:creeper_spawn_egg"), Map.entry(51, "minecraft:skeleton_spawn_egg"), Map.entry(52, "minecraft:spider_spawn_egg"), diff --git a/src/main/java/de/hysky/skyblocker/skyblock/profileviewer/ProfileViewerScreen.java b/src/main/java/de/hysky/skyblocker/skyblock/profileviewer/ProfileViewerScreen.java index d789f5d94e..91b569a217 100644 --- a/src/main/java/de/hysky/skyblocker/skyblock/profileviewer/ProfileViewerScreen.java +++ b/src/main/java/de/hysky/skyblocker/skyblock/profileviewer/ProfileViewerScreen.java @@ -5,9 +5,10 @@ import com.google.gson.JsonParser; import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.builder.LiteralArgumentBuilder; +import com.mojang.util.UndashedUuid; + import de.hysky.skyblocker.SkyblockerMod; import de.hysky.skyblocker.annotations.Init; -import de.hysky.skyblocker.mixins.accessors.SkullBlockEntityAccessor; import de.hysky.skyblocker.skyblock.profileviewer.collections.CollectionsPage; import de.hysky.skyblocker.skyblock.profileviewer.dungeons.DungeonsPage; import de.hysky.skyblocker.skyblock.profileviewer.inventory.InventoryPage; @@ -22,6 +23,7 @@ import net.fabricmc.fabric.api.client.command.v2.ClientCommandManager; import net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback; import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; +import net.minecraft.block.entity.SkullBlockEntity; import net.minecraft.client.MinecraftClient; import net.minecraft.client.gui.DrawContext; import net.minecraft.client.gui.screen.Screen; @@ -146,35 +148,46 @@ private CompletableFuture fetchPlayerData(String username) { } }); - CompletableFuture minecraftProfileFuture = SkullBlockEntityAccessor.invokeFetchProfileByName(username).thenAccept(profile -> { - this.playerName = profile.get().getName(); - entity = new OtherClientPlayerEntity(MinecraftClient.getInstance().world, profile.get()) { - @Override - public SkinTextures getSkinTextures() { - PlayerListEntry playerListEntry = new PlayerListEntry(profile.get(), false); - return playerListEntry.getSkinTextures(); - } + CompletableFuture playerFuture = CompletableFuture.runAsync(() -> { + String stringifiedUuid = ApiUtils.name2Uuid(username); - @Override - public boolean isPartVisible(PlayerModelPart modelPart) { - return !(modelPart.getName().equals(PlayerModelPart.CAPE.getName())); - } + if (stringifiedUuid.isEmpty()) { + this.playerName = "User not found"; + this.profileNotFound = true; + } + + UUID uuid = UndashedUuid.fromStringLenient(stringifiedUuid); + + //The fetch by name method can sometimes fail in weird cases and return a fake offline player + SkullBlockEntity.fetchProfileByUuid(uuid).thenAccept(profile -> { + this.playerName = profile.get().getName(); + entity = new OtherClientPlayerEntity(MinecraftClient.getInstance().world, profile.get()) { + @Override + public SkinTextures getSkinTextures() { + PlayerListEntry playerListEntry = new PlayerListEntry(profile.get(), false); + return playerListEntry.getSkinTextures(); + } - @Override - public boolean isInvisibleTo(PlayerEntity player) { - return true; - } - }; - entity.setCustomNameVisible(false); - }).exceptionally(ex -> { - this.playerName = "User not found"; - this.profileNotFound = true; - return null; - }); + @Override + public boolean isPartVisible(PlayerModelPart modelPart) { + return !(modelPart.getName().equals(PlayerModelPart.CAPE.getName())); + } - return CompletableFuture.allOf(profileFuture, minecraftProfileFuture); - } + @Override + public boolean isInvisibleTo(PlayerEntity player) { + return true; + } + }; + entity.setCustomNameVisible(false); + }).exceptionally(ex -> { + this.playerName = "User not found"; + this.profileNotFound = true; + return null; + }).join(); + }); + return CompletableFuture.allOf(profileFuture, playerFuture); + } public void onNavButtonClick(ProfileViewerNavButton clickedButton) { if (profileViewerPages[activePage] != null) profileViewerPages[activePage].markWidgetsAsInvisible(); diff --git a/src/main/java/de/hysky/skyblocker/utils/ItemUtils.java b/src/main/java/de/hysky/skyblocker/utils/ItemUtils.java index e6fa3d983a..94dc75aa3e 100644 --- a/src/main/java/de/hysky/skyblocker/utils/ItemUtils.java +++ b/src/main/java/de/hysky/skyblocker/utils/ItemUtils.java @@ -338,7 +338,7 @@ public static IntIntPair getDurability(@NotNull ItemStack stack) { if (stack.getSkyblockId().equals("PICKONIMBUS")) { int pickonimbusDurability = customData.getInt("pickonimbus_durability"); - return IntIntPair.of(customData.contains("pickonimbus_durability") ? pickonimbusDurability : 5000, 5000); + return IntIntPair.of(customData.contains("pickonimbus_durability") ? pickonimbusDurability : 2000, 2000); } String drillFuel = Formatting.strip(getLoreLineIf(stack, FUEL_PREDICATE)); diff --git a/src/main/java/de/hysky/skyblocker/utils/ws/SkyblockerWebSocket.java b/src/main/java/de/hysky/skyblocker/utils/ws/SkyblockerWebSocket.java index da026209c3..0c82acee37 100644 --- a/src/main/java/de/hysky/skyblocker/utils/ws/SkyblockerWebSocket.java +++ b/src/main/java/de/hysky/skyblocker/utils/ws/SkyblockerWebSocket.java @@ -6,7 +6,6 @@ import de.hysky.skyblocker.events.SkyblockEvents; import de.hysky.skyblocker.utils.ApiAuthentication; import de.hysky.skyblocker.utils.Http; -import net.minecraft.util.Util; import org.slf4j.Logger; import java.net.URI; @@ -130,8 +129,7 @@ public void onError(WebSocket webSocket, Throwable error) { } private void handleWholeMessage(List parts) { - StringBuilder builder = Util.make(new StringBuilder(), sb -> parts.forEach(sb::append)); - String message = builder.toString(); + String message = String.join("", parts); if (Debug.debugEnabled() && Debug.webSocketDebug()) LOGGER.info("[Skyblocker WebSocket] Received Message: {}", message); diff --git a/src/main/java/de/hysky/skyblocker/utils/ws/WsMessageHandler.java b/src/main/java/de/hysky/skyblocker/utils/ws/WsMessageHandler.java index f4aadbc440..0ca067cb2b 100644 --- a/src/main/java/de/hysky/skyblocker/utils/ws/WsMessageHandler.java +++ b/src/main/java/de/hysky/skyblocker/utils/ws/WsMessageHandler.java @@ -31,7 +31,7 @@ public static void sendMessage(Service service, Message> me * Useful for sending simple state updates with an optional message */ static void sendSimple(Type type, Service service, String serverId, Optional>> message) { - send(type, service, serverId, message.isPresent() ? Optional.of(encodeMessage(message.get())) : Optional.empty()); + send(type, service, serverId, message.map(WsMessageHandler::encodeMessage)); } private static void send(Type type, Service service, String serverId, Optional> message) {