mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Killjoy reminded me you can use interfaces for this
This commit is contained in:
parent
2dfe647165
commit
da3f14c85b
3 changed files with 5 additions and 25 deletions
|
@ -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();
|
|
||||||
}
|
|
|
@ -5,20 +5,10 @@ import java.awt.image.BufferedImage;
|
||||||
import org.spongepowered.asm.mixin.Mixin;
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||||
|
|
||||||
import com.minelittlepony.ducks.IDownloadImageData;
|
|
||||||
|
|
||||||
import net.minecraft.client.renderer.ThreadDownloadImageData;
|
import net.minecraft.client.renderer.ThreadDownloadImageData;
|
||||||
import net.minecraft.client.renderer.texture.SimpleTexture;
|
|
||||||
import net.minecraft.util.ResourceLocation;
|
|
||||||
|
|
||||||
@Mixin(ThreadDownloadImageData.class)
|
@Mixin(ThreadDownloadImageData.class)
|
||||||
public abstract class MixinThreadDownloadImageData extends SimpleTexture implements IDownloadImageData {
|
public interface MixinThreadDownloadImageData {
|
||||||
|
|
||||||
private MixinThreadDownloadImageData(ResourceLocation textureResourceLocation) {
|
|
||||||
super(textureResourceLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
@Accessor("bufferedImage")
|
@Accessor("bufferedImage")
|
||||||
public abstract BufferedImage getBufferedImage();
|
BufferedImage getBufferedImage();
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ package com.minelittlepony.pony.data;
|
||||||
|
|
||||||
import com.google.common.base.MoreObjects;
|
import com.google.common.base.MoreObjects;
|
||||||
import com.minelittlepony.MineLittlePony;
|
import com.minelittlepony.MineLittlePony;
|
||||||
import com.minelittlepony.ducks.IDownloadImageData;
|
import com.minelittlepony.mixin.MixinThreadDownloadImageData;
|
||||||
import com.minelittlepony.model.ModelWrapper;
|
import com.minelittlepony.model.ModelWrapper;
|
||||||
import com.voxelmodpack.hdskins.DynamicTextureImage;
|
import com.voxelmodpack.hdskins.DynamicTextureImage;
|
||||||
import com.voxelmodpack.hdskins.ThreadDownloadImageETag;
|
import com.voxelmodpack.hdskins.ThreadDownloadImageETag;
|
||||||
|
@ -78,8 +78,8 @@ public class Pony {
|
||||||
try {
|
try {
|
||||||
ITextureObject e2 = Minecraft.getMinecraft().getTextureManager().getTexture(resource);
|
ITextureObject e2 = Minecraft.getMinecraft().getTextureManager().getTexture(resource);
|
||||||
|
|
||||||
if (e2 instanceof IDownloadImageData) {
|
if (e2 instanceof MixinThreadDownloadImageData) {
|
||||||
return ((IDownloadImageData) e2).getBufferedImage();
|
return ((MixinThreadDownloadImageData) e2).getBufferedImage();
|
||||||
} else if (e2 instanceof ThreadDownloadImageETag) {
|
} else if (e2 instanceof ThreadDownloadImageETag) {
|
||||||
return ((ThreadDownloadImageETag) e2).getBufferedImage();
|
return ((ThreadDownloadImageETag) e2).getBufferedImage();
|
||||||
} else if (e2 instanceof DynamicTextureImage) {
|
} else if (e2 instanceof DynamicTextureImage) {
|
||||||
|
|
Loading…
Reference in a new issue