mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
For god's sake space your code out. I can't stand these cramped conditions
This commit is contained in:
parent
a308e0ce96
commit
2c4a03d74b
2 changed files with 19 additions and 7 deletions
|
@ -93,7 +93,6 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
||||||
private List<ISkinParser> skinParsers = Lists.newArrayList();
|
private List<ISkinParser> skinParsers = Lists.newArrayList();
|
||||||
|
|
||||||
private SkinResourceManager resources = new SkinResourceManager();
|
private SkinResourceManager resources = new SkinResourceManager();
|
||||||
// private ExecutorService executor = Executors.newCachedThreadPool();
|
|
||||||
|
|
||||||
private Function<List<SkinServer>, GuiSkins> skinsGuiFunc = GuiSkins::new;
|
private Function<List<SkinServer>, GuiSkins> skinsGuiFunc = GuiSkins::new;
|
||||||
|
|
||||||
|
@ -189,6 +188,7 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
||||||
callback.skinAvailable(type, resource, texture);
|
callback.skinAvailable(type, resource, texture);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// schedule texture loading on the main thread.
|
// schedule texture loading on the main thread.
|
||||||
TextureLoader.loadTexture(resource, new ThreadDownloadImageData(
|
TextureLoader.loadTexture(resource, new ThreadDownloadImageData(
|
||||||
new File(LiteLoader.getAssetsDirectory(), "hd/" + skinDir + texture.getHash().substring(0, 2) + "/" + texture.getHash()),
|
new File(LiteLoader.getAssetsDirectory(), "hd/" + skinDir + texture.getHash().substring(0, 2) + "/" + texture.getHash()),
|
||||||
|
@ -200,26 +200,30 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
||||||
}
|
}
|
||||||
})));
|
})));
|
||||||
}
|
}
|
||||||
|
|
||||||
return resource;
|
return resource;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Map<Type, ResourceLocation> getTextures(GameProfile profile) {
|
public Map<Type, ResourceLocation> getTextures(GameProfile profile) {
|
||||||
|
|
||||||
Map<Type, ResourceLocation> map = new HashMap<>();
|
Map<Type, ResourceLocation> map = new HashMap<>();
|
||||||
|
|
||||||
for (Map.Entry<Type, MinecraftProfileTexture> e : loadProfileTextures(profile).getNow(Collections.emptyMap()).entrySet()) {
|
for (Map.Entry<Type, MinecraftProfileTexture> e : loadProfileTextures(profile).getNow(Collections.emptyMap()).entrySet()) {
|
||||||
map.put(e.getKey(), loadTexture(e.getKey(), e.getValue(), null));
|
map.put(e.getKey(), loadTexture(e.getKey(), e.getValue(), null));
|
||||||
}
|
}
|
||||||
return map;
|
|
||||||
|
|
||||||
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSkinServerType(Class<? extends SkinServer> type) {
|
private void addSkinServerType(Class<? extends SkinServer> type) {
|
||||||
Preconditions.checkArgument(!type.isInterface(), "type cannot be an interface");
|
Preconditions.checkArgument(!type.isInterface(), "type cannot be an interface");
|
||||||
Preconditions.checkArgument(!Modifier.isAbstract(type.getModifiers()), "type cannot be abstract");
|
Preconditions.checkArgument(!Modifier.isAbstract(type.getModifiers()), "type cannot be abstract");
|
||||||
|
|
||||||
ServerType st = type.getAnnotation(ServerType.class);
|
ServerType st = type.getAnnotation(ServerType.class);
|
||||||
|
|
||||||
if (st == null) {
|
if (st == null) {
|
||||||
throw new IllegalArgumentException("class is not annotated with @ServerType");
|
throw new IllegalArgumentException("class is not annotated with @ServerType");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.skinServerTypes.put(st.value(), type);
|
this.skinServerTypes.put(st.value(), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -336,9 +340,11 @@ public final class HDSkinManager implements IResourceManagerReloadListener {
|
||||||
private static <T> CompletableFuture<T> getUntilNonnull(Supplier<T> getter) {
|
private static <T> CompletableFuture<T> getUntilNonnull(Supplier<T> getter) {
|
||||||
return CompletableFuture.supplyAsync(() -> {
|
return CompletableFuture.supplyAsync(() -> {
|
||||||
T res = null;
|
T res = null;
|
||||||
|
|
||||||
while (res == null) {
|
while (res == null) {
|
||||||
res = getter.get();
|
res = getter.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,11 +26,17 @@ public abstract class MixinNetworkPlayerInfo implements INetworkPlayerInfo {
|
||||||
private Map<Type, ResourceLocation> customTextures = new HashMap<>();
|
private Map<Type, ResourceLocation> customTextures = new HashMap<>();
|
||||||
private Map<Type, MinecraftProfileTexture> customProfiles = new HashMap<>();
|
private Map<Type, MinecraftProfileTexture> customProfiles = new HashMap<>();
|
||||||
|
|
||||||
@Shadow @Final private GameProfile gameProfile;
|
@Shadow @Final
|
||||||
@Shadow private boolean playerTexturesLoaded;
|
private GameProfile gameProfile;
|
||||||
@Shadow private String skinType;
|
|
||||||
|
|
||||||
@Shadow private Map<Type, ResourceLocation> playerTextures;
|
@Shadow
|
||||||
|
private boolean playerTexturesLoaded;
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
private String skinType;
|
||||||
|
|
||||||
|
@Shadow
|
||||||
|
private Map<Type, ResourceLocation> playerTextures;
|
||||||
|
|
||||||
@SuppressWarnings("InvalidMemberReference") // mc-dev bug?
|
@SuppressWarnings("InvalidMemberReference") // mc-dev bug?
|
||||||
@Redirect(method = { "getLocationSkin", "getLocationCape", "getLocationElytra" },
|
@Redirect(method = { "getLocationSkin", "getLocationCape", "getLocationElytra" },
|
||||||
|
|
Loading…
Reference in a new issue