From 9956824861082e36262fd801cf69586b19876a8a Mon Sep 17 00:00:00 2001 From: Matthew Messinger Date: Wed, 29 Aug 2018 23:03:50 -0400 Subject: [PATCH] No --- .../voxelmodpack/hdskins/HDSkinManager.java | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinManager.java b/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinManager.java index 5a1e9021..ed3f0a1b 100644 --- a/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinManager.java +++ b/src/hdskins/java/com/voxelmodpack/hdskins/HDSkinManager.java @@ -271,25 +271,22 @@ public final class HDSkinManager implements IResourceManagerReloadListener { } public void reloadSkins() { + Stream playerList = Stream.empty(); Minecraft mc = Minecraft.getMinecraft(); + if (mc.world != null) { + playerList = mc.world.playerEntities.stream() + .filter(AbstractClientPlayer.class::isInstance) + .map(AbstractClientPlayer.class::cast) + .map(PlayerUtil::getInfo); + } NetHandlerPlayClient playClient = mc.getConnection(); + if (playClient != null) { + playerList = Stream.concat(playerList, playClient.getPlayerInfoMap().stream()); + } - Stream playerList = playClient == null ? - Stream.empty() : - playClient.getPlayerInfoMap().stream(); - - Stream world = mc.world == null ? - Stream.empty() : - mc.world.playerEntities.stream() - .filter(AbstractClientPlayer.class::isInstance) - .map(AbstractClientPlayer.class::cast) - .map(PlayerUtil::getInfo); - - Stream.concat(playerList, world) - .filter(Objects::nonNull) - .distinct() + playerList.filter(Objects::nonNull).distinct() .forEach(this::clearNetworkSkin); clearListeners.removeIf(this::onSkinCacheCleared); @@ -297,6 +294,7 @@ public final class HDSkinManager implements IResourceManagerReloadListener { public void parseSkin(GameProfile profile, Type type, ResourceLocation resource, MinecraftProfileTexture texture) { + // TODO: Infinite loop // The texture needs to be loaded in order to be parsed. ITextureObject ito = null; while (ito == null) {