Fixed crash due to a closed image

This commit is contained in:
Sollace 2019-06-11 00:39:50 +02:00
parent fa3f26172e
commit cba057b10c

View file

@ -7,6 +7,7 @@ import net.minecraft.client.texture.ResourceTexture;
import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.minelittlepony.client.ducks.IBufferedTexture; import com.minelittlepony.client.ducks.IBufferedTexture;
@ -25,7 +26,8 @@ public abstract class MixinThreadDownloadImageData extends ResourceTexture imple
@Inject(method = "method_4534(" @Inject(method = "method_4534("
+ "Lnet/minecraft/client/texture/NativeImage;)V", + "Lnet/minecraft/client/texture/NativeImage;)V",
at = @At("HEAD")) at = @At("HEAD"))
private void onSetImage(NativeImage nativeImageIn) { private void onSetImage(NativeImage skin, CallbackInfo info) {
cachedImage = nativeImageIn; cachedImage = new NativeImage(skin.getFormat(), skin.getWidth(), skin.getHeight(), false);
cachedImage.copyFrom(skin);
} }
} }