Advertisement
Corosus

Untitled

Jan 26th, 2013
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.95 KB | None | 0 0
  1. public void herp() {
  2.        
  3.         int y = 80;
  4.        
  5.         if (worldObj.canBlockSeeTheSky(xCoord, yCoord+1, zCoord)) {
  6.            
  7.             float look = worldObj.getWorldTime() * (10);
  8.             float speed = 0.5F;
  9.             Random rand = new Random();
  10.            
  11.             double motionX = ((double)(-Math.sin((look) / 180.0F * 3.1415927F) * Math.cos(0 / 180.0F * 3.1415927F)) * (speed + (0.1 * rand.nextDouble())));
  12.             double motionZ = ((double)(Math.cos((look) / 180.0F * 3.1415927F) * Math.cos(0 / 180.0F * 3.1415927F)) * (speed + (0.1 * rand.nextDouble())));
  13.            
  14.             EntityAuraCurseFX particle = new EntityAuraCurseFX(worldObj, this.xCoord + 0.5F, y, this.zCoord + 0.5F, motionX, 0.25F, motionZ, 20);
  15.             particles.add(particle);
  16.             Minecraft.getMinecraft().effectRenderer.addEffect(particle);
  17.            
  18.             particle = new EntityAuraCurseFX(worldObj, this.xCoord + 0.5F, y, this.zCoord + 0.5F, -motionX, 0.25F, -motionZ, 30);
  19.             particles.add(particle);
  20.             Minecraft.getMinecraft().effectRenderer.addEffect(particle);
  21.         }
  22.        
  23.         for (int var9 = 0; var9 < this.particles.size(); ++var9)
  24.         {
  25.             EntityAuraCurseFX particle = (EntityAuraCurseFX)this.particles.get(var9);
  26.            
  27.             if (particle != null) {
  28.                 if (particle.isDead) {
  29.                     particles.remove(particle);
  30.                 } else {
  31.                     float vecX = (xCoord + 0.5F) - (float)particle.posX;
  32.                     float vecZ = (zCoord + 0.5F) - (float)particle.posZ;
  33.                     float dist = (float)MathHelper.sqrt_double(vecX * vecX + vecZ * vecZ);
  34.                    
  35.                     float speed = 0.1F;
  36.                     //if (speed < 0) speed = 0;
  37.                     //if (speed > 1) speed = 1;
  38.                    
  39.                     float angle = (float)((Math.atan2(vecZ, vecX) * 180D) / 3.1415927410125732D);
  40.                     float angleAdj = (float)Math.sin((particle.getParticleAge() % 100F) / 20F) * 60;
  41.                    
  42.                     int max = 30;                  
  43.                     if (angleAdj < -max) angleAdj = -max;
  44.                     if (angleAdj > max) angleAdj = max;
  45.                    
  46.                     float angleAdj2 = (float)Math.sin((worldObj.getWorldTime() % 50F) / 20F) * 30;
  47.                     float angleAdj3 = (float)Math.sin((worldObj.getWorldTime() % 200F) / 20F) * 30;
  48.                     angleAdj2 += angleAdj + angleAdj3;
  49.                    
  50.                     float staticAngle = 10;
  51.                    
  52.                     if (particle.direction == 0) {
  53.                         angle += staticAngle + angleAdj2;
  54.                     } else {
  55.                         angle -= staticAngle + angleAdj2;
  56.                     }
  57.                    
  58.                     double rad_angle = angle * 0.01745329F;
  59.                    
  60.                     float newX = (float)Math.cos(rad_angle);
  61.                     float newZ = (float)Math.sin(rad_angle);
  62.                    
  63.                     particle.motionX += newX * speed;
  64.                     particle.motionZ += newZ * speed;
  65.                    
  66.                 }
  67.             }
  68.         }
  69.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement