Fix flowing oil too..

This commit is contained in:
Christian Weeks 2012-05-25 12:26:07 -04:00
parent 7518eb0212
commit 81b90ed54d

View file

@ -16,83 +16,67 @@ import net.minecraft.src.TextureFX;
import org.lwjgl.opengl.GL11;
public class TextureOilFlowFX extends TextureFX
import cpw.mods.fml.client.FMLTextureFX;
public class TextureOilFlowFX extends FMLTextureFX
{
private int int_numPixels = 256;
private int int_numPixelsMinus1 = 0xFF;
private int int_size = 16;
private int int_sizeMinus1 = 0xF;
public TextureOilFlowFX()
{
super(BuildCraftEnergy.oilMoving.blockIndexInTexture + 1);
try {
Class <? extends Object> sizeClass = Class
.forName("com.pclewis.mcpatcher.mod.TileSize");
int_numPixels = sizeClass.getDeclaredField("int_numPixels").getInt(
sizeClass);
int_numPixelsMinus1 = sizeClass.getDeclaredField(
"int_numPixelsMinus1").getInt(sizeClass);
int_size = sizeClass.getDeclaredField("int_size").getInt(sizeClass);
int_sizeMinus1 = sizeClass.getDeclaredField("int_sizeMinus1")
.getInt(sizeClass);
} catch (Throwable t) {
}
field_1138_g = new float[int_numPixels];
field_1137_h = new float[int_numPixels];
field_1136_i = new float[int_numPixels];
field_1135_j = new float[int_numPixels];
field_1134_k = 0;
tileSize = 2;
}
@Override
protected void setup() {
super.setup();
field_1138_g = new float[tileSizeSquare];
field_1137_h = new float[tileSizeSquare];
field_1136_i = new float[tileSizeSquare];
field_1135_j = new float[tileSizeSquare];
field_1134_k = 0;
}
@Override
public void bindImage(RenderEngine renderengine) {
GL11.glBindTexture(3553 /*GL_TEXTURE_2D*/ /* GL_TEXTURE_2D */,
renderengine.getTexture(BuildCraftCore.customBuildCraftTexture));
GL11.glBindTexture(3553,renderengine.getTexture(BuildCraftCore.customBuildCraftTexture));
}
@Override
public void onTick()
{
field_1134_k++;
for(int i = 0; i < int_size; i++)
for(int k = 0; k < int_size; k++)
for(int i = 0; i < tileSizeBase; i++)
for(int k = 0; k < tileSizeBase; k++)
{
float f = 0.0F;
for(int j1 = k - 2; j1 <= k; j1++)
{
int k1 = i & int_sizeMinus1;
int i2 = j1 & int_sizeMinus1;
f += field_1138_g[k1 + i2 * int_size];
int k1 = i & tileSizeMask;
int i2 = j1 & tileSizeMask;
f += field_1138_g[k1 + i2 * tileSizeBase];
}
field_1137_h[i + k * int_size] = f / 3.2F + field_1136_i[i + k * int_size] * 0.8F;
field_1137_h[i + k * tileSizeBase] = f / 3.2F + field_1136_i[i + k * tileSizeBase] * 0.8F;
}
for(int j = 0; j < int_size; j++)
for(int l = 0; l < int_size; l++)
for(int j = 0; j < tileSizeBase; j++)
for(int l = 0; l < tileSizeBase; l++)
{
field_1136_i[j + l * int_size] += field_1135_j[j + l * int_size] * 0.05F;
if(field_1136_i[j + l * int_size] < 0.0F)
field_1136_i[j + l * int_size] = 0.0F;
field_1135_j[j + l * int_size] -= 0.3F;
field_1136_i[j + l * tileSizeBase] += field_1135_j[j + l * tileSizeBase] * 0.05F;
if(field_1136_i[j + l * tileSizeBase] < 0.0F)
field_1136_i[j + l * tileSizeBase] = 0.0F;
field_1135_j[j + l * tileSizeBase] -= 0.3F;
if(Math.random() < 0.20000000000000001D)
field_1135_j[j + l * int_size] = 0.5F;
field_1135_j[j + l * tileSizeBase] = 0.5F;
}
float af[] = field_1137_h;
field_1137_h = field_1138_g;
field_1138_g = af;
for(int i1 = 0; i1 < int_numPixels; i1++)
for(int i1 = 0; i1 < tileSizeSquare; i1++)
{
float f1 = field_1138_g[i1 - field_1134_k * int_size & int_numPixelsMinus1];
float f1 = field_1138_g[i1 - field_1134_k * tileSizeBase & tileSizeSquareMask];
if(f1 > 1.0F)
f1 = 1.0F;
if(f1 < 0.0F)