Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- This method generates a bell curve type of statistical distribution along a given axis based on a percentage input
- */
- public int mPCalculateDensity(int oreDistance, float oreDensity) // returns the density value
- {
- int loopCount = 0;
- int densityValuePassInner = 0;
- int densityValuePass = 0;
- oreDensity = oreDensity * .01F;
- oreDensity = (oreDensity * (oreDistance >> 1)) + 1F;// establishes number of times to loop
- loopCount = (int)(oreDensity); //stores number of times to loop
- densityValuePassInner = ((oreDistance/loopCount)); // distance devided by number of times it will loop, establishes the number for randomization
- densityValuePassInner += (((oreDistance - (densityValuePassInner*loopCount))/loopCount));
- densityValuePass = 0;
- while (loopCount > 0) // loops to acumulate random values
- {
- densityValuePass = densityValuePass + rand.nextInt(densityValuePassInner); // acumulate randoms
- loopCount = loopCount - 1; // decriment loop
- }
- return densityValuePass; // return proccesed random value
- }
- */
- This method generates veins in a branching manner from a single source location until a threshold of blocks is generated.
- /*
- public boolean BODgenerateVein(World world, Random rand, int parX, int parY, int parZ, int xyz)
- {
- //==========================================mp mod
- int posX = parX;
- int posY = parY;
- int posZ = parZ;
- int tempPosX =0;
- int tempPosY =0;
- int tempPosZ =0;
- int posX2 = 0;
- int posY2 = 0;
- int posZ2 = 0;
- int directionX =0;
- int directionY =0;
- int directionZ =0;
- int directionX2 = 0;
- int directionY2 = 0;
- int directionZ2 = 0;
- int directionX3 =0;
- int directionY3 =0;
- int directionZ3 =0;
- int directionChange =0;
- int directionChange2 =0;
- int blocksToUse = xyz;//input number of blocks per vein
- int blocksToUse2 =0;
- for(int blocksMade=0; blocksMade <= blocksToUse;) // make veins
- {
- blocksToUse2 = 1 + (blocksToUse/30);
- directionChange = rand.nextInt(6);
- directionX = rand.nextInt(2);
- directionY = rand.nextInt(2);
- directionZ = rand.nextInt(2);
- for(int blocksMade1 = 0; blocksMade1 <= blocksToUse2; ) // make branch
- {
- if(directionX == 0 && directionChange != 1){posX = posX + rand.nextInt(2);}
- if(directionX == 1 && directionChange != 1){posX = posX - rand.nextInt(2);}
- if(directionY == 0 && directionChange != 2){posY = posY + rand.nextInt(2);}
- if(directionY == 1 && directionChange != 2){posY = posY - rand.nextInt(2);}
- if(directionZ == 0 && directionChange != 3){posZ = posZ + rand.nextInt(2);}
- if(directionZ == 1 && directionChange != 3){posZ = posZ - rand.nextInt(2);}
- if(rand.nextInt(4) == 0){
- posX2 = posX2 + rand.nextInt(2);
- posY2 = posY2 + rand.nextInt(2);
- posZ2 = posZ2 + rand.nextInt(2);
- posX2 = posX2 - rand.nextInt(2);
- posY2 = posY2 - rand.nextInt(2);
- posZ2 = posZ2 - rand.nextInt(2);
- }
- if(rand.nextInt(3) == 0) // make sub-branch
- {
- posX2 = posX;
- posY2 = posY;
- posZ2 = posZ;
- directionX2 = rand.nextInt(2);
- directionY2 = rand.nextInt(2);
- directionZ2 = rand.nextInt(2);
- directionChange2 = rand.nextInt(6);
- if(directionX2 == 0 && directionChange2 != 0){posX2 = posX2 + rand.nextInt(2);}
- if(directionY2 == 0 && directionChange2 != 1){posY2 = posY2 + rand.nextInt(2);}
- if(directionZ2 == 0 && directionChange2 != 2){posZ2 = posZ2 + rand.nextInt(2);}
- if(directionX2 == 1 && directionChange2 != 0){posX2 = posX2 - rand.nextInt(2);}
- if(directionY2 == 1 && directionChange2 != 1){posY2 = posY2 - rand.nextInt(2);}
- if(directionZ2 == 1 && directionChange2 != 2){posZ2 = posZ2 - rand.nextInt(2);}
- for(int blocksMade2 = 0; blocksMade2 <= (1 +(blocksToUse2/5)); )
- {
- if(directionX2 == 0 && directionChange2 != 0){posX2 = posX2 + rand.nextInt(2);}
- if(directionY2 == 0 && directionChange2 != 1){posY2 = posY2 + rand.nextInt(2);}
- if(directionZ2 == 0 && directionChange2 != 2){posZ2 = posZ2 + rand.nextInt(2);}
- if(directionX2 == 1 && directionChange2 != 0){posX2 = posX2 - rand.nextInt(2);}
- if(directionY2 == 1 && directionChange2 != 1){posY2 = posY2 - rand.nextInt(2);}
- if(directionZ2 == 1 && directionChange2 != 2){posZ2 = posZ2 - rand.nextInt(2);}
- if(world.getBlockId(posX, posY, posZ) == Block.stone.blockID || world.getBlockId(posX, posY, posZ) == 87)
- {
- world.setBlock(posX, posY, posZ, MPBlockID, minableBlockMeta, 2);
- }
- blocksMade++;
- blocksMade1++;
- blocksMade2++;
- }
- }
- if(world.getBlockId(posX, posY, posZ) == Block.stone.blockID || world.getBlockId(posX, posY, posZ) == 87) // only if it is stone
- {
- world.setBlock(posX, posY, posZ, MPBlockID, minableBlockMeta, 2); // place block in world
- }
- blocksMade++;
- blocksMade1++;
- }
- parX = parX + (rand.nextInt(3) - 1);
- parY = parY + (rand.nextInt(3) - 1);
- parZ = parZ + (rand.nextInt(3) - 1);
- posX = parX;
- posY = parY;
- posZ = parZ;
- }
- return true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement