Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Shields] Fixed a crash when minecrafttas.com is unavailable #216

Merged
merged 1 commit into from
Aug 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions src/main/java/com/minecrafttas/tasmod/util/ShieldDownloader.java
Original file line number Diff line number Diff line change
Expand Up @@ -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/";
Expand All @@ -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);
}

Expand Down Expand Up @@ -124,7 +128,7 @@ public ResourceLocation getResourceLocationOld(EntityLivingBase entitylivingbase
return bottleshield;
}
}

@Deprecated
public void downloadFromTASTools(String uuid, String location) {
String name = getShieldName(uuid);
Expand Down