mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-12-01 16:27:59 +01:00
Merge branch 'master' into hdskins_rewrites
This commit is contained in:
commit
44ffb2362f
4 changed files with 7 additions and 6 deletions
|
@ -34,6 +34,9 @@ import net.minecraft.client.resources.IResourceManagerReloadListener;
|
||||||
import net.minecraft.client.resources.SkinManager.SkinAvailableCallback;
|
import net.minecraft.client.resources.SkinManager.SkinAvailableCallback;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
import org.apache.commons.io.FileUtils;
|
import org.apache.commons.io.FileUtils;
|
||||||
|
import org.apache.http.impl.client.CloseableHttpClient;
|
||||||
|
import org.apache.http.impl.client.HttpClients;
|
||||||
|
import org.apache.logging.log4j.LogManager;
|
||||||
|
|
||||||
import java.awt.Graphics;
|
import java.awt.Graphics;
|
||||||
import java.awt.image.BufferedImage;
|
import java.awt.image.BufferedImage;
|
||||||
|
@ -48,6 +51,7 @@ import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.CompletableFuture;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
|
@ -20,7 +20,6 @@ import net.minecraft.util.ResourceLocation;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
@SuppressWarnings("EntityConstructor")
|
@SuppressWarnings("EntityConstructor")
|
||||||
public class EntityPlayerModel extends EntityLivingBase implements IBlankSkinSupplier {
|
public class EntityPlayerModel extends EntityLivingBase implements IBlankSkinSupplier {
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.io.Reader;
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
import java.nio.charset.StandardCharsets;
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
@ -52,13 +52,13 @@ public interface MoreHttpResponses extends AutoCloseable {
|
||||||
}
|
}
|
||||||
|
|
||||||
default <T> T json(Class<T> type) throws IOException {
|
default <T> T json(Class<T> type) throws IOException {
|
||||||
try (Reader reader = new InputStreamReader(getResponse().getEntity().getContent())) {
|
try (BufferedReader reader = getReader()) {
|
||||||
return SkinServer.gson.fromJson(reader, type);
|
return SkinServer.gson.fromJson(reader, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
default <T> T json(Type type) throws IOException {
|
default <T> T json(Type type) throws IOException {
|
||||||
try (Reader reader = new InputStreamReader(getResponse().getEntity().getContent())) {
|
try (BufferedReader reader = getReader()) {
|
||||||
return SkinServer.gson.fromJson(reader, type);
|
return SkinServer.gson.fromJson(reader, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,12 +37,10 @@ public class ValhallaSkinServer extends AbstractSkinServer {
|
||||||
super(address);
|
super(address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MinecraftTexturesPayload getProfileData(GameProfile profile) throws IOException {
|
public MinecraftTexturesPayload getProfileData(GameProfile profile) throws IOException {
|
||||||
|
|
||||||
try (MoreHttpResponses response = MoreHttpResponses.execute(NetClient.nativeClient(), new HttpGet(getTexturesURI(profile)))) {
|
try (MoreHttpResponses response = MoreHttpResponses.execute(NetClient.nativeClient(), new HttpGet(getTexturesURI(profile)))) {
|
||||||
|
|
||||||
if (response.ok()) {
|
if (response.ok()) {
|
||||||
return readJson(response, MinecraftTexturesPayload.class);
|
return readJson(response, MinecraftTexturesPayload.class);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue