From da3f14c85bee449989c6b134d1883783eb0b3435 Mon Sep 17 00:00:00 2001 From: Sollace Date: Sat, 28 Apr 2018 12:28:45 +0200 Subject: [PATCH] Killjoy reminded me you can use interfaces for this --- .../minelittlepony/ducks/IDownloadImageData.java | 10 ---------- .../mixin/MixinThreadDownloadImageData.java | 14 ++------------ .../java/com/minelittlepony/pony/data/Pony.java | 6 +++--- 3 files changed, 5 insertions(+), 25 deletions(-) delete mode 100644 src/main/java/com/minelittlepony/ducks/IDownloadImageData.java diff --git a/src/main/java/com/minelittlepony/ducks/IDownloadImageData.java b/src/main/java/com/minelittlepony/ducks/IDownloadImageData.java deleted file mode 100644 index 15a0b914..00000000 --- a/src/main/java/com/minelittlepony/ducks/IDownloadImageData.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.minelittlepony.ducks; - -import java.awt.image.BufferedImage; - -public interface IDownloadImageData { - /** - * Gets the downloaded image data as a buffered image. - */ - BufferedImage getBufferedImage(); -} diff --git a/src/main/java/com/minelittlepony/mixin/MixinThreadDownloadImageData.java b/src/main/java/com/minelittlepony/mixin/MixinThreadDownloadImageData.java index 835fb3f6..6c4f0a60 100644 --- a/src/main/java/com/minelittlepony/mixin/MixinThreadDownloadImageData.java +++ b/src/main/java/com/minelittlepony/mixin/MixinThreadDownloadImageData.java @@ -5,20 +5,10 @@ import java.awt.image.BufferedImage; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.gen.Accessor; -import com.minelittlepony.ducks.IDownloadImageData; - import net.minecraft.client.renderer.ThreadDownloadImageData; -import net.minecraft.client.renderer.texture.SimpleTexture; -import net.minecraft.util.ResourceLocation; @Mixin(ThreadDownloadImageData.class) -public abstract class MixinThreadDownloadImageData extends SimpleTexture implements IDownloadImageData { - - private MixinThreadDownloadImageData(ResourceLocation textureResourceLocation) { - super(textureResourceLocation); - } - - @Override +public interface MixinThreadDownloadImageData { @Accessor("bufferedImage") - public abstract BufferedImage getBufferedImage(); + BufferedImage getBufferedImage(); } diff --git a/src/main/java/com/minelittlepony/pony/data/Pony.java b/src/main/java/com/minelittlepony/pony/data/Pony.java index 638995f3..a7317438 100644 --- a/src/main/java/com/minelittlepony/pony/data/Pony.java +++ b/src/main/java/com/minelittlepony/pony/data/Pony.java @@ -2,7 +2,7 @@ package com.minelittlepony.pony.data; import com.google.common.base.MoreObjects; import com.minelittlepony.MineLittlePony; -import com.minelittlepony.ducks.IDownloadImageData; +import com.minelittlepony.mixin.MixinThreadDownloadImageData; import com.minelittlepony.model.ModelWrapper; import com.voxelmodpack.hdskins.DynamicTextureImage; import com.voxelmodpack.hdskins.ThreadDownloadImageETag; @@ -78,8 +78,8 @@ public class Pony { try { ITextureObject e2 = Minecraft.getMinecraft().getTextureManager().getTexture(resource); - if (e2 instanceof IDownloadImageData) { - return ((IDownloadImageData) e2).getBufferedImage(); + if (e2 instanceof MixinThreadDownloadImageData) { + return ((MixinThreadDownloadImageData) e2).getBufferedImage(); } else if (e2 instanceof ThreadDownloadImageETag) { return ((ThreadDownloadImageETag) e2).getBufferedImage(); } else if (e2 instanceof DynamicTextureImage) {