From 3bb39660c4fe4baebcdb4c6750d0718e5b95f151 Mon Sep 17 00:00:00 2001 From: Scribble Date: Tue, 13 Aug 2024 17:24:12 +0200 Subject: [PATCH] [Shields] Fixed a crash when minecrafttas.com is unavailable --- .../minecrafttas/tasmod/util/ShieldDownloader.java | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/minecrafttas/tasmod/util/ShieldDownloader.java b/src/main/java/com/minecrafttas/tasmod/util/ShieldDownloader.java index 2588c4e1..ab61d305 100644 --- a/src/main/java/com/minecrafttas/tasmod/util/ShieldDownloader.java +++ b/src/main/java/com/minecrafttas/tasmod/util/ShieldDownloader.java @@ -35,7 +35,7 @@ * * @author Scribble */ -public class ShieldDownloader implements EventPlayerJoinedClientSide, EventOtherPlayerJoinedClientSide{ +public class ShieldDownloader implements EventPlayerJoinedClientSide, EventOtherPlayerJoinedClientSide { private final ResourceLocation bottleshield = new ResourceLocation("tasmod:textures/shields/bottleshield.png"); private final String defaultshield = "bottleshield"; private final String cacheLocation = "tasmod/shields/"; @@ -59,15 +59,19 @@ public ResourceLocation getResourceLocation(EntityLivingBase entitylivingbaseIn) public void onPlayerJoinedClientSide(EntityPlayerSP player) { onPlayerJoin(player.getGameProfile()); } - + @Override public void onOtherPlayerJoinedClientSide(GameProfile profile) { onPlayerJoin(profile); } - + public void onPlayerJoin(GameProfile profile) { String uuid = profile.getId().toString(); - loadTexture(uuid); + Thread t = new Thread(() -> { + loadTexture(uuid); + }, "Shield downloader"); + t.run(); + // downloadFromTASTools(uuid, cacheLocation); } @@ -124,7 +128,7 @@ public ResourceLocation getResourceLocationOld(EntityLivingBase entitylivingbase return bottleshield; } } - + @Deprecated public void downloadFromTASTools(String uuid, String location) { String name = getShieldName(uuid);