Files
CodeChickenCore/codechicken/lib/render/TextureFX.java
T

59 lines
1.6 KiB
Java
Raw Normal View History

2013-07-16 17:58:02 +10:00
package codechicken.lib.render;
import codechicken.lib.render.SpriteSheetManager.SpriteSheet;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
@SideOnly(Side.CLIENT)
public class TextureFX
{
public int[] imageData;
public int tileSizeBase = 16;
public int tileSizeSquare = 256;
public int tileSizeMask = 15;
public int tileSizeSquareMask = 255;
2014-04-07 14:02:47 +10:00
2013-07-16 17:58:02 +10:00
public boolean anaglyphEnabled;
public TextureSpecial texture;
2014-04-07 14:02:47 +10:00
public TextureFX(int spriteIndex, SpriteSheet sheet) {
2013-09-04 13:56:47 +10:00
texture = sheet.bindTextureFX(spriteIndex, this);
2013-07-16 17:58:02 +10:00
}
2014-04-07 14:02:47 +10:00
public TextureFX(int size, String name) {
2013-07-16 17:58:02 +10:00
texture = new TextureSpecial(name).blank(size).selfRegister().addTextureFX(this);
}
2014-04-07 14:02:47 +10:00
public TextureFX setAtlas(int index) {
2013-07-16 17:58:02 +10:00
texture.atlasIndex = index;
return this;
}
2014-04-07 14:02:47 +10:00
public void setup() {
2013-07-16 17:58:02 +10:00
imageData = new int[tileSizeSquare];
}
2014-04-07 14:02:47 +10:00
public void onTextureDimensionsUpdate(int width, int height) {
if (width != height)
throw new IllegalArgumentException("Non-Square textureFX not supported (" + width + ":" + height + ")");
2013-07-16 17:58:02 +10:00
tileSizeBase = width;
tileSizeSquare = tileSizeBase * tileSizeBase;
tileSizeMask = tileSizeBase - 1;
tileSizeSquareMask = tileSizeSquare - 1;
setup();
}
2014-04-07 14:02:47 +10:00
public void update() {
2013-07-16 17:58:02 +10:00
anaglyphEnabled = Minecraft.getMinecraft().gameSettings.anaglyph;
onTick();
}
2014-04-07 14:02:47 +10:00
public void onTick() {
2013-07-16 17:58:02 +10:00
}
2014-04-07 14:02:47 +10:00
public boolean changed() {
2013-07-16 17:58:02 +10:00
return true;
}
}