Fix textures not applying properly
This commit is contained in:
parent
e713f7b1c2
commit
4d44836bb3
|
@ -22,6 +22,7 @@ import net.minecraft.src.RenderEngine;
|
||||||
import net.minecraft.src.TextureFX;
|
import net.minecraft.src.TextureFX;
|
||||||
import net.minecraft.src.TexturePackBase;
|
import net.minecraft.src.TexturePackBase;
|
||||||
import cpw.mods.fml.common.FMLCommonHandler;
|
import cpw.mods.fml.common.FMLCommonHandler;
|
||||||
|
import cpw.mods.fml.common.FMLLog;
|
||||||
|
|
||||||
public class FMLTextureFX extends TextureFX implements ITextureFX
|
public class FMLTextureFX extends TextureFX implements ITextureFX
|
||||||
{
|
{
|
||||||
|
@ -30,7 +31,7 @@ public class FMLTextureFX extends TextureFX implements ITextureFX
|
||||||
public int tileSizeMask = 15;
|
public int tileSizeMask = 15;
|
||||||
public int tileSizeSquareMask = 255;
|
public int tileSizeSquareMask = 255;
|
||||||
public boolean errored = false;
|
public boolean errored = false;
|
||||||
protected Logger log = FMLCommonHandler.instance().getFMLLogger();
|
protected Logger log = FMLLog.getLogger();
|
||||||
|
|
||||||
public FMLTextureFX(int icon)
|
public FMLTextureFX(int icon)
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,30 +33,30 @@ public class ModTextureStatic extends FMLTextureFX
|
||||||
private int storedSize;
|
private int storedSize;
|
||||||
private BufferedImage overrideData = null;
|
private BufferedImage overrideData = null;
|
||||||
private int needApply = 2;
|
private int needApply = 2;
|
||||||
|
|
||||||
|
|
||||||
public ModTextureStatic(int icon, int target, BufferedImage image)
|
public ModTextureStatic(int icon, int target, BufferedImage image)
|
||||||
{
|
{
|
||||||
this(icon, 1, target, image);
|
this(icon, 1, target, image);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModTextureStatic(int icon, int size, int target, BufferedImage image)
|
public ModTextureStatic(int icon, int size, int target, BufferedImage image)
|
||||||
{
|
{
|
||||||
this(icon, size, (target == 0 ? "/terrain.png" : "/gui/items.png"), image);
|
this(icon, size, (target == 0 ? "/terrain.png" : "/gui/items.png"), image);
|
||||||
}
|
}
|
||||||
|
|
||||||
public ModTextureStatic(int icon, int size, String target, BufferedImage image)
|
public ModTextureStatic(int icon, int size, String target, BufferedImage image)
|
||||||
{
|
{
|
||||||
super(icon);
|
super(icon);
|
||||||
RenderEngine re = FMLClientHandler.instance().getClient().field_71446_o;
|
RenderEngine re = FMLClientHandler.instance().getClient().field_71446_o;
|
||||||
|
|
||||||
targetTex = target;
|
targetTex = target;
|
||||||
storedSize = size;
|
storedSize = size;
|
||||||
field_76849_e = size;
|
field_76849_e = size;
|
||||||
field_76847_f = re.func_78341_b(target);
|
field_76847_f = re.func_78341_b(target);
|
||||||
overrideData = image;
|
overrideData = image;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void setup()
|
public void setup()
|
||||||
{
|
{
|
||||||
|
@ -80,16 +80,17 @@ public class ModTextureStatic extends FMLTextureFX
|
||||||
|
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void func_783_a()
|
@Override
|
||||||
|
public void func_76846_a()
|
||||||
{
|
{
|
||||||
if (oldanaglyph != field_76851_c)
|
if (oldanaglyph != field_76851_c)
|
||||||
{
|
{
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
// This makes it so we only apply the texture to the target texture when we need to,
|
// This makes it so we only apply the texture to the target texture when we need to,
|
||||||
//due to the fact that update is called when the Effect is first registered, we actually
|
//due to the fact that update is called when the Effect is first registered, we actually
|
||||||
//need to wait for the next one.
|
//need to wait for the next one.
|
||||||
field_76849_e = (needApply == 0 ? 0 : storedSize);
|
field_76849_e = (needApply == 0 ? 0 : storedSize);
|
||||||
if (needApply > 0)
|
if (needApply > 0)
|
||||||
{
|
{
|
||||||
|
@ -97,11 +98,12 @@ public class ModTextureStatic extends FMLTextureFX
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void func_782_a(RenderEngine p_782_1_)
|
@Override
|
||||||
|
public void func_76845_a(RenderEngine p_76845_1_)
|
||||||
{
|
{
|
||||||
GL11.glBindTexture(GL_TEXTURE_2D, p_782_1_.func_78341_b(targetTex));
|
GL11.glBindTexture(GL_TEXTURE_2D, p_76845_1_.func_78341_b(targetTex));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void update()
|
public void update()
|
||||||
{
|
{
|
||||||
needApply = 2;
|
needApply = 2;
|
||||||
|
@ -126,7 +128,7 @@ public class ModTextureStatic extends FMLTextureFX
|
||||||
|
|
||||||
oldanaglyph = field_76851_c;
|
oldanaglyph = field_76851_c;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Implementation of http://scale2x.sourceforge.net/algorithm.html
|
//Implementation of http://scale2x.sourceforge.net/algorithm.html
|
||||||
public static BufferedImage scale2x(BufferedImage image)
|
public static BufferedImage scale2x(BufferedImage image)
|
||||||
{
|
{
|
||||||
|
@ -170,9 +172,9 @@ public class ModTextureStatic extends FMLTextureFX
|
||||||
return tmp;
|
return tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString()
|
public String toString()
|
||||||
{
|
{
|
||||||
return String.format("ModTextureStatic %s @ %d", targetTex, field_76850_b);
|
return String.format("ModTextureStatic %s @ %d", targetTex, field_76850_b);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue