From 0e852e4a9467104a382fb0333dddb571dda97997 Mon Sep 17 00:00:00 2001 From: tterrag1098 Date: Thu, 21 May 2015 13:44:39 -0400 Subject: [PATCH] Fix vat particles to fit new model --- .../enderio/machine/vat/BlockVat.java | 48 +++++++++---------- 1 file changed, 23 insertions(+), 25 deletions(-) diff --git a/src/main/java/crazypants/enderio/machine/vat/BlockVat.java b/src/main/java/crazypants/enderio/machine/vat/BlockVat.java index 00d8188a..1f4bba6e 100644 --- a/src/main/java/crazypants/enderio/machine/vat/BlockVat.java +++ b/src/main/java/crazypants/enderio/machine/vat/BlockVat.java @@ -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 { @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); } } } - }