Killjoy reminded me you can use interfaces for this

This commit is contained in:
Sollace 2018-04-28 12:28:45 +02:00
parent 2dfe647165
commit da3f14c85b
3 changed files with 5 additions and 25 deletions

View file

@ -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();
}

View file

@ -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();
}

View file

@ -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) {