mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 08:14:23 +01:00
Fix missing wing when using optifine.
Why didn't I think of this earlier?
This commit is contained in:
parent
0cfe8fdee7
commit
33390c66d4
1 changed files with 7 additions and 29 deletions
|
@ -5,11 +5,8 @@ import net.minecraft.client.renderer.IImageBuffer;
|
|||
import net.minecraft.client.renderer.ImageBufferDownload;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.At.Shift;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.Surrogate;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.awt.Graphics;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
@ -19,35 +16,16 @@ public abstract class MixinImageBufferDownload implements IImageBuffer {
|
|||
|
||||
@Inject(
|
||||
method = "parseUserSkin(Ljava/awt/image/BufferedImage;)Ljava/awt/image/BufferedImage;",
|
||||
locals = LocalCapture.CAPTURE_FAILEXCEPTION,
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
shift = Shift.BEFORE,
|
||||
target = "Ljava/awt/Graphics;dispose()V",
|
||||
remap = false))
|
||||
private void update(BufferedImage image, CallbackInfo ci, BufferedImage image2) {
|
||||
at = @At("RETURN"),
|
||||
cancellable = true)
|
||||
private void update(BufferedImage image, CallbackInfoReturnable<BufferedImage> ci) {
|
||||
// convert skins from mojang server
|
||||
BufferedImage image2 = ci.getReturnValue();
|
||||
boolean isLegacy = image.getHeight() == 32;
|
||||
if (isLegacy) {
|
||||
Graphics graphics = image2.getGraphics();
|
||||
if (isLegacy) {
|
||||
HDSkinManager.INSTANCE.convertSkin(image2, graphics);
|
||||
}
|
||||
}
|
||||
|
||||
// development
|
||||
@Surrogate
|
||||
private void update(BufferedImage image, CallbackInfo ci, BufferedImage image2, Graphics graphics, boolean isLegacy) {
|
||||
if (isLegacy) {
|
||||
HDSkinManager.INSTANCE.convertSkin(image2, graphics);
|
||||
}
|
||||
}
|
||||
|
||||
// for optifine
|
||||
@Surrogate
|
||||
private void update(BufferedImage image, CallbackInfo ci, int w, int h, int k, BufferedImage image2, Graphics graphics, boolean isLegacy) {
|
||||
// convert skins from mojang server
|
||||
if (isLegacy) {
|
||||
HDSkinManager.INSTANCE.convertSkin(image2, graphics);
|
||||
graphics.dispose();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue