Tweak textureFx for fml support

This commit is contained in:
Christian Weeks 2012-05-18 20:24:48 -04:00
parent 1559f77695
commit 3244773fea

View file

@ -14,11 +14,6 @@ import net.minecraft.src.TextureFX;
import net.minecraft.src.forge.MinecraftForgeClient; import net.minecraft.src.forge.MinecraftForgeClient;
public class TextureLiquidsFX extends TextureFX { public class TextureLiquidsFX extends TextureFX {
private int int_numPixels = 256;
private int int_size = 16;
private int int_sizeMinus1 = 0xF;
private final int redMin, redMax, greenMin, greenMax, blueMin, blueMax; private final int redMin, redMax, greenMin, greenMax, blueMin, blueMax;
private final String texture; private final String texture;
@ -26,19 +21,6 @@ public class TextureLiquidsFX extends TextureFX {
int blueMin, int blueMax, int spriteIndex, String texture) { int blueMin, int blueMax, int spriteIndex, String texture) {
super(spriteIndex); super(spriteIndex);
try {
Class<? extends Object> sizeClass = Class
.forName("com.pclewis.mcpatcher.mod.TileSize");
int_numPixels = sizeClass.getDeclaredField("int_numPixels").getInt(
sizeClass);
int_size = sizeClass.getDeclaredField("int_size").getInt(sizeClass);
int_sizeMinus1 = sizeClass.getDeclaredField("int_sizeMinus1")
.getInt(sizeClass);
} catch (Throwable t) {
}
this.redMin = redMin; this.redMin = redMin;
this.redMax = redMax; this.redMax = redMax;
this.greenMin = greenMin; this.greenMin = greenMin;
@ -46,11 +28,17 @@ public class TextureLiquidsFX extends TextureFX {
this.blueMin = blueMin; this.blueMin = blueMin;
this.blueMax = blueMax; this.blueMax = blueMax;
this.texture = texture; this.texture = texture;
setup();
}
field_1158_g = new float[int_numPixels]; @Override
field_1157_h = new float[int_numPixels]; public void setup() {
field_1156_i = new float[int_numPixels]; super.setup();
field_1155_j = new float[int_numPixels];
field_1158_g = new float[tileSizeSquare];
field_1157_h = new float[tileSizeSquare];
field_1156_i = new float[tileSizeSquare];
field_1155_j = new float[tileSizeSquare];
} }
@Override @Override
@ -60,33 +48,33 @@ public class TextureLiquidsFX extends TextureFX {
@Override @Override
public void onTick() { public void onTick() {
for (int i = 0; i < int_size; i++) for (int i = 0; i < iconTileSize; i++)
for (int k = 0; k < int_size; k++) { for (int k = 0; k < iconTileSize; k++) {
float f = 0.0F; float f = 0.0F;
for (int j1 = i - 1; j1 <= i + 1; j1++) { for (int j1 = i - 1; j1 <= i + 1; j1++) {
int k1 = j1 & int_sizeMinus1; int k1 = j1 & tileSizeMask;
int i2 = k & int_sizeMinus1; int i2 = k & tileSizeMask;
f += field_1158_g[k1 + i2 * int_size]; f += field_1158_g[k1 + i2 * tileSize];
} }
field_1157_h[i + k * int_size] = f / 3.3F field_1157_h[i + k * tileSize] = f / 3.3F
+ field_1156_i[i + k * int_size] * 0.8F; + field_1156_i[i + k * tileSize] * 0.8F;
} }
for (int j = 0; j < int_size; j++) for (int j = 0; j < tileSize; j++)
for (int l = 0; l < int_size; l++) { for (int l = 0; l < tileSize; l++) {
field_1156_i[j + l * int_size] += field_1155_j[j + l * int_size] * 0.05F; field_1156_i[j + l * tileSize] += field_1155_j[j + l * tileSize] * 0.05F;
if (field_1156_i[j + l * int_size] < 0.0F) if (field_1156_i[j + l * tileSize] < 0.0F)
field_1156_i[j + l * int_size] = 0.0F; field_1156_i[j + l * tileSize] = 0.0F;
field_1155_j[j + l * int_size] -= 0.1F; field_1155_j[j + l * tileSize] -= 0.1F;
if (Math.random() < 0.050000000000000003D) if (Math.random() < 0.050000000000000003D)
field_1155_j[j + l * int_size] = 0.5F; field_1155_j[j + l * tileSize] = 0.5F;
} }
float af[] = field_1157_h; float af[] = field_1157_h;
field_1157_h = field_1158_g; field_1157_h = field_1158_g;
field_1158_g = af; field_1158_g = af;
for (int i1 = 0; i1 < int_numPixels; i1++) { for (int i1 = 0; i1 < tileSizeSquare; i1++) {
float f1 = field_1158_g[i1]; float f1 = field_1158_g[i1];
if (f1 > 1.0F) if (f1 > 1.0F)
f1 = 1.0F; f1 = 1.0F;