mirror of
https://github.com/Miasmusa/Shadow.git
synced 2024-11-15 03:14:54 -05:00
Merge branch 'master' of https://github.com/0x3C50/shad
This commit is contained in:
commit
5581369514
1 changed files with 58 additions and 57 deletions
|
@ -26,6 +26,7 @@ import org.spongepowered.asm.mixin.Shadow;
|
|||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.URL;
|
||||
|
@ -40,65 +41,65 @@ public class PlayerSkinMixin {
|
|||
@Final
|
||||
private MinecraftSessionService sessionService;
|
||||
//I cant even launch mc with this! it doesnt work
|
||||
//@Inject(method = "method_4653", at = @At(
|
||||
// value = "INVOKE",
|
||||
// target = "Lnet/minecraft/client/MinecraftClient;execute(Ljava/lang/Runnable;)V",
|
||||
// shift = At.Shift.BEFORE
|
||||
//), remap = false, locals = LocalCapture.CAPTURE_FAILEXCEPTION)
|
||||
//void real(GameProfile gameProfile, boolean bl, PlayerSkinProvider.SkinTextureAvailableCallback skinTextureAvailableCallback, CallbackInfo ci, Map<Type, MinecraftProfileTexture> map) {
|
||||
// addCape(gameProfile, map);
|
||||
//}
|
||||
|
||||
@Inject(at = {@At("HEAD")},
|
||||
method = {
|
||||
"loadSkin(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/texture/PlayerSkinProvider$SkinTextureAvailableCallback;Z)V"},
|
||||
cancellable = true)
|
||||
private void onLoadSkin(GameProfile profile,
|
||||
PlayerSkinProvider.SkinTextureAvailableCallback callback,
|
||||
boolean requireSecure, CallbackInfo ci) {
|
||||
|
||||
Runnable runnable = () -> {
|
||||
HashMap<MinecraftProfileTexture.Type, MinecraftProfileTexture> map =
|
||||
Maps.newHashMap();
|
||||
|
||||
try {
|
||||
map.putAll(sessionService.getTextures(profile, requireSecure));
|
||||
} catch (InsecureTextureException ignored) {
|
||||
|
||||
}
|
||||
|
||||
if (map.isEmpty()) {
|
||||
profile.getProperties().clear();
|
||||
if (profile.getId().equals(MinecraftClient.getInstance()
|
||||
.getSession().getProfile().getId())) {
|
||||
profile.getProperties().putAll(
|
||||
MinecraftClient.getInstance().getSessionProperties());
|
||||
map.putAll(sessionService.getTextures(profile, false));
|
||||
} else {
|
||||
sessionService.fillProfileProperties(profile,
|
||||
requireSecure);
|
||||
|
||||
try {
|
||||
map.putAll(
|
||||
sessionService.getTextures(profile, requireSecure));
|
||||
} catch (InsecureTextureException ignored) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
addCape(profile, map);
|
||||
|
||||
MinecraftClient.getInstance().execute(() -> RenderSystem.recordRenderCall(() -> ImmutableList.of(Type.SKIN, Type.CAPE).forEach((type) -> {
|
||||
if (map.containsKey(type))
|
||||
loadSkin(map.get(type), type, callback);
|
||||
})));
|
||||
};
|
||||
Util.getMainWorkerExecutor().execute(runnable);
|
||||
|
||||
ci.cancel();
|
||||
@Inject(method = "method_4653", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/MinecraftClient;execute(Ljava/lang/Runnable;)V",
|
||||
shift = At.Shift.BEFORE
|
||||
), locals = LocalCapture.CAPTURE_FAILEXCEPTION)
|
||||
void real(GameProfile gameProfile, boolean bl, PlayerSkinProvider.SkinTextureAvailableCallback skinTextureAvailableCallback, CallbackInfo ci, Map<Type, MinecraftProfileTexture> map) {
|
||||
addCape(gameProfile, map);
|
||||
}
|
||||
|
||||
// @Inject(at = {@At("HEAD")},
|
||||
// method = {
|
||||
// "loadSkin(Lcom/mojang/authlib/GameProfile;Lnet/minecraft/client/texture/PlayerSkinProvider$SkinTextureAvailableCallback;Z)V"},
|
||||
// cancellable = true)
|
||||
// private void onLoadSkin(GameProfile profile,
|
||||
// PlayerSkinProvider.SkinTextureAvailableCallback callback,
|
||||
// boolean requireSecure, CallbackInfo ci) {
|
||||
//
|
||||
// Runnable runnable = () -> {
|
||||
// HashMap<MinecraftProfileTexture.Type, MinecraftProfileTexture> map =
|
||||
// Maps.newHashMap();
|
||||
//
|
||||
// try {
|
||||
// map.putAll(sessionService.getTextures(profile, requireSecure));
|
||||
// } catch (InsecureTextureException ignored) {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// if (map.isEmpty()) {
|
||||
// profile.getProperties().clear();
|
||||
// if (profile.getId().equals(MinecraftClient.getInstance()
|
||||
// .getSession().getProfile().getId())) {
|
||||
// profile.getProperties().putAll(
|
||||
// MinecraftClient.getInstance().getSessionProperties());
|
||||
// map.putAll(sessionService.getTextures(profile, false));
|
||||
// } else {
|
||||
// sessionService.fillProfileProperties(profile,
|
||||
// requireSecure);
|
||||
//
|
||||
// try {
|
||||
// map.putAll(
|
||||
// sessionService.getTextures(profile, requireSecure));
|
||||
// } catch (InsecureTextureException ignored) {
|
||||
//
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// addCape(profile, map);
|
||||
//
|
||||
// MinecraftClient.getInstance().execute(() -> RenderSystem.recordRenderCall(() -> ImmutableList.of(Type.SKIN, Type.CAPE).forEach((type) -> {
|
||||
// if (map.containsKey(type))
|
||||
// loadSkin(map.get(type), type, callback);
|
||||
// })));
|
||||
// };
|
||||
// Util.getMainWorkerExecutor().execute(runnable);
|
||||
//
|
||||
// ci.cancel();
|
||||
// }
|
||||
|
||||
private void addCape(GameProfile profile,
|
||||
Map<MinecraftProfileTexture.Type, MinecraftProfileTexture> map) {
|
||||
String name = profile.getName();
|
||||
|
|
Loading…
Reference in a new issue