6
6
import com .mojang .authlib .minecraft .MinecraftProfileTexture ;
7
7
import net .minecraft .client .renderer .ImageBufferDownload ;
8
8
import net .minecraft .client .resources .SkinManager ;
9
+ import net .minecraft .entity .player .EntityPlayer ;
9
10
import net .minecraft .util .ResourceLocation ;
10
11
import org .spongepowered .asm .mixin .Mixin ;
12
+ import org .spongepowered .asm .mixin .Unique ;
11
13
import org .spongepowered .asm .mixin .injection .At ;
12
14
import org .spongepowered .asm .mixin .injection .Inject ;
13
15
import org .spongepowered .asm .mixin .injection .callback .CallbackInfoReturnable ;
@@ -24,7 +26,7 @@ private ResourceLocation changeDownloadLocation(String p_i1293_1_, Operation<Res
24
26
@ Local (argsOnly = true ) final MinecraftProfileTexture .Type p_152789_2_ ,
25
27
@ Local (argsOnly = true ) final SkinManager .SkinAvailableCallback p_152789_3_
26
28
) {
27
- if (p_152789_2_ == MinecraftProfileTexture . Type . SKIN ) {
29
+ if (simpleSkinBackport$isNewPlayerWithPlayerData ( p_152789_2_ , p_152789_3_ ) ) {
28
30
return new ResourceLocation (SimpleSkinBackport .MODID , p_i1293_1_ );
29
31
}
30
32
return original .call (p_i1293_1_ );
@@ -34,7 +36,7 @@ private ResourceLocation changeDownloadLocation(String p_i1293_1_, Operation<Res
34
36
private ImageBufferDownload changeDownloadBufferManager (Operation <ImageBufferDownload > original ,
35
37
@ Local (argsOnly = true ) final MinecraftProfileTexture .Type p_152789_2_ ,
36
38
@ Local (argsOnly = true ) SkinManager .SkinAvailableCallback p_152789_3_ ) {
37
- if (p_152789_2_ == MinecraftProfileTexture . Type . SKIN ) {
39
+ if (simpleSkinBackport$isNewPlayerWithPlayerData ( p_152789_2_ , p_152789_3_ ) ) {
38
40
return new ImageBufferDownloadPlayerSkin ();
39
41
}
40
42
return original .call ();
@@ -44,10 +46,15 @@ private ImageBufferDownload changeDownloadBufferManager(Operation<ImageBufferDow
44
46
at = @ At (value = "INVOKE" , target = "Lnet/minecraft/client/resources/SkinManager$SkinAvailableCallback;func_152121_a(Lcom/mojang/authlib/minecraft/MinecraftProfileTexture$Type;Lnet/minecraft/util/ResourceLocation;)V" ,
45
47
shift = At .Shift .AFTER ))
46
48
private void injectCallbackSkinCheck (MinecraftProfileTexture p_152789_1_ , MinecraftProfileTexture .Type p_152789_2_ , SkinManager .SkinAvailableCallback p_152789_3_ , CallbackInfoReturnable <ResourceLocation > cir ) {
47
- if (p_152789_2_ == MinecraftProfileTexture . Type . SKIN && p_152789_3_ instanceof INewModelData playerData ) {
49
+ if (simpleSkinBackport$isNewPlayerWithPlayerData ( p_152789_2_ , p_152789_3_ ) && p_152789_3_ instanceof INewModelData playerData ) {
48
50
if (Objects .equals (p_152789_1_ .getMetadata ("model" ), "slim" )) {
49
51
playerData .simpleSkinBackport$setSlim (true );
50
52
}
51
53
}
52
54
}
55
+
56
+ @ Unique
57
+ private boolean simpleSkinBackport$isNewPlayerWithPlayerData (final MinecraftProfileTexture .Type type , SkinManager .SkinAvailableCallback callback ) {
58
+ return type == MinecraftProfileTexture .Type .SKIN && callback instanceof EntityPlayer ;
59
+ }
53
60
}
0 commit comments