Thutmose_I

Untitled

Apr 28th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.30 KB | None | 0 0
  1. public class ExplosionCustom implements Runnable {
  2.    
  3.     public final static double sqrt3 = Math.sqrt(3);
  4.     public static boolean busyLock = false;
  5.     List<Thread> waitingThreads = new Vector<Thread>();
  6.    
  7.    
  8.     public static void doExplosion(final Entity exploder,final double r0,final boolean drop, final String type){
  9.    
  10.    
  11.         System.out.println("Starting Explosion");
  12.         final double A = 5*100; //This is a constant that corresponds to blast strength.
  13.         final double B = 1; //This corresponds to strength of blast at max range. 1 means will damage leaves.
  14.         final World worldObj = exploder.worldObj;
  15.         final int rMax = Math.min((int)(Math.sqrt(A*r0/B)),128); //Maximium radius of damage  (r0*A/B, 1/E)
  16.         int realRMax = (int)(Math.sqrt(A*r0/B));
  17.         System.out.println("Max Radius "+rMax);
  18.         final int x0 = (int) exploder.posX;
  19.         final int y0 = (int) exploder.posY;
  20.         final int z0 = (int) exploder.posZ;
  21.         final double[] centreD = {exploder.posX,exploder.posZ,exploder.posY};
  22.         EntityExplosionFireball fireball = new EntityExplosionFireball(exploder.worldObj,centreD,r0);
  23.         exploder.worldObj.spawnEntityInWorld(fireball);
  24.     //*
  25.        
  26.        
  27.         new Thread( new Runnable(){public void run(){
  28.            
  29.                 sphereSmartV2(exploder,r0, drop, A, B, rMax);
  30.                
  31.                 System.out.println("Finished Explosion");
  32.         }} ).start();
  33.        
  34.        
  35.        
  36.     }
Advertisement
Add Comment
Please, Sign In to add comment