Fix vat particles to fit new model

This commit is contained in:
tterrag1098 committed 2015-05-21 13:44:39 -04:00
1 parent 13122027a6
commit 0e852e4a94
1 file changed
+23 -25
@@ -2,6 +2,11 @@ package crazypants.enderio.machine.vat;
import java.util.Random;
import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityReddustFX;
import net.minecraft.client.particle.EntitySmokeFX;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
@@ -179,34 +184,27 @@ public class BlockVat extends AbstractMachineBlock<TileVat> {
@SideOnly(Side.CLIENT)
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
// If active, randomly throw some smoke around
if(isActive(world, x, y, z)) {
float startX = x;
float startY = y + 0.35F;
float startZ = z;
for (int k = 0; k < 2; k++) {
int ran2adn5 = (int) Math.round((Math.random() * 3) + 2);
ForgeDirection dir = ForgeDirection.VALID_DIRECTIONS[ran2adn5];
if(dir.offsetY == 0) {
for (int i = 0; i < 2; i++) {
if (isActive(world, x, y, z)) {
TileVat te = (TileVat) world.getTileEntity(x, y, z);
float pX = x + 0.5f;
float pY = y + 0.7f;
float pZ = z + 0.5f;
ForgeDirection dir = te.getFacingDir();
pX += 0.6f * dir.offsetX;
pZ += 0.6f * dir.offsetZ;
float xOffset = 0.52f * (1 - dir.offsetX) + (dir.offsetX * (-0.1F + rand.nextFloat() * 0.2F));
float yOffset = -0.1F + rand.nextFloat() * 0.2F;
float zOffset = 0.52f * (1 - dir.offsetZ) + (dir.offsetZ * (-0.1F + rand.nextFloat() * 0.2F));
double velX = ((rand.nextDouble() * 0.075) + 0.025) * dir.offsetX;
double velZ = ((rand.nextDouble() * 0.075) + 0.025) * dir.offsetZ;
if(rand.nextFloat() > 0.5) {
VertexRotation vr = new VertexRotation(Math.PI/4, new Vector3d(0,1,0), new Vector3d(0.5,0.25,0.5));
Vector3d vec = new Vector3d(xOffset, yOffset, zOffset);
vr.apply(vec);
xOffset = (float)vec.x;
yOffset = (float)vec.y;
zOffset = (float)vec.z;
}
world.spawnParticle("smoke", startX + xOffset, startY + yOffset, startZ + zOffset, 0.0D, 0.0D, 0.0D);
}
}
int num = rand.nextInt(4) + 2;
for (int k = 0; k < num; k++) {
EffectRenderer er = Minecraft.getMinecraft().effectRenderer;
EntitySmokeFX fx = new EntitySmokeFX(world, pX, pY, pZ, 1, 1, 1);
fx.setRBGColorF(1 - (rand.nextFloat() * 0.2f), 1 - (rand.nextFloat() * 0.1f), 1 - (rand.nextFloat() * 0.2f));
fx.setVelocity(velX, -0.06, velZ);
er.addEffect(fx);
}
}
}
}