Advertisement
marcopolo1613

Untitled

Sep 19th, 2012
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 27.37 KB | None | 0 0
  1. //world gen minable
  2. package net.minecraft.src;
  3. import java.io.*;
  4. import java.util.*;
  5. import net.minecraft.client.Minecraft; // remove for multiplayer server
  6. import java.util.Random;
  7.  
  8. // Referenced classes of package net.minecraft.src:
  9. //                      WorldGenerator, MathHelper, World, Block
  10.  
  11. public class WorldGenMinable extends WorldGenerator
  12. {
  13.  
  14.         public WorldGenMinable(int i, int j)
  15.         {
  16.             minableBlockId = i;
  17.         }
  18.  
  19.         public WorldGenMinable(int id, int meta, int number)
  20.         {
  21.             this(id, number);
  22.             minableBlockMeta = meta;
  23.         }
  24.        
  25.         public boolean generate(World world, Random random, int i, int j, int k)//obsorb default system
  26.         {
  27.             // System.out.println(" 1: call "+minableBlockId+":"+minableBlockMeta); // for debugging
  28.                                 randomOut = random;     // pad the seed so it's the same as vannila
  29.                                 randomOut.nextFloat(); //   |
  30.                                 randomOut.nextInt(3);  //   |                          
  31.                                 randomOut.nextInt(3);  //   |
  32.                                 randomOut.nextDouble();//   |
  33.                 if (minableBlockId==3)// this makes sure everything is on a once per ore gen basis, because dirt generates first it sets everything up
  34.                 {      
  35.                     //System.out.println(" 1.2: found dirt, setting up"); /// for debugging
  36.                         MPChunk_X =((i / 16) * 16);// set output chunk x // snap to grid
  37.                         MPChunk_Z =((k / 16) * 16);// set output chunk z    
  38.                        
  39.             /*----*/    Random randomz = new Random(world.getSeed()); // setup a random for BOD
  40.                         long l = (randomz.nextLong() / 2L) * 2L + 1L;                       // |
  41.                         long l1 = (randomz.nextLong() / 2L) * 2L + 1L;                      // |
  42.                         randomz.setSeed((long)i * l + (long)j * l1 ^ world.getSeed());      // |
  43.             /*----*/    rand = randomz;
  44.            
  45.                         worldObj = world; // set world
  46.                         mineCount = 0; // this is a new chunk, so list gets set to the beginning
  47.                        
  48.                         for (int loopCount2 = 0; loopCount2 < 40; loopCount2++)  // zeros out array // mpblockid != mpprevid stops dirt and general cases, this will stop exceptions
  49.                         {  
  50.                             aOreCheck[loopCount2]=0;
  51.                         }
  52.                        
  53.                 }
  54.                         MPBlockID = minableBlockId;// set output block ID
  55.                         genBeforeCheck = false; // ore has not generated before unless told otherwise
  56.                         if (MPBlockID != MPPrevID || minableBlockMeta != MPPrevMeta) // only check for new ore
  57.                         {
  58.                             boolean metaOreBefore = false;
  59.                             for (int loopCount = 0; loopCount < 79; loopCount++) // check if ore has generated before, and tatle if so
  60.                             {
  61.                                 if (aOreCheck[loopCount] == MPBlockID) // if the current ID matches any recorded for this chunk, prevent generation
  62.                                 {
  63.                                     for(int loopCount2 = 0; loopCount2 < 15; loopCount2++)
  64.                                     {
  65.                                         if(metaOreCheck[loopCount2] == minableBlockMeta)
  66.                                         {
  67.                                             genBeforeCheck = true;
  68.                                             //System.out.println(" 1.3: found the ore before"); /// for debugging
  69.                                         }
  70.                                     }
  71.                                     metaOreBefore = true; // if this block is generated before, save the meta cache list
  72.                                 }
  73.                                 else
  74.                                 {
  75.                                     metaOreBefore = false; // else it will be removed
  76.                                 }
  77.                                 if(metaOreBefore == false)// clear list no more of this blockID will be called this chunk
  78.                                 {
  79.                                     for (int loopCount2 = 0; loopCount2 < 15; loopCount2++)  // zeros out array // mpblockid != mpprevid stops dirt and general cases, this will stop exceptions
  80.                                     {  
  81.                                         metaOreCheck[loopCount2]=20;// dump a clear value inside
  82.                                     }
  83.                                 }
  84.                             }
  85.                         }
  86.                         else
  87.                         {
  88.                             genBeforeCheck = true;
  89.                         }
  90.                 if(MPChunk_X != MPPrevX || MPChunk_Z != MPPrevZ || MPPrevID != 3 )// if it is a new x or y chunk, then generate // blockID stops dirt
  91.                 {
  92.                     //System.out.println(" 2: allowed ore chunk prev test"); /// for debugging
  93.                     //if (genBeforeCheck == true){System.out.println(" checked and genned before!");} /// for debugging}
  94.                     if (genBeforeCheck == false)
  95.                     {
  96.                         //System.out.println(" 2.2: procede with gen"); /// for debugging
  97.                         MPPrevX = MPChunk_X;
  98.                         MPPrevZ = MPChunk_Z;
  99.                         x_Chunk = MPChunk_X;
  100.                         z_Chunk = MPChunk_Z;
  101.                         MPPrevID = MPBlockID;
  102.                         MPPrevMeta = minableBlockMeta;
  103.                         mineGen = 1;
  104.                         subMineGen = 1;
  105.                        
  106.                         BODFile = new File(Minecraft.getMinecraftDir() + "/BODprops/(V2.5)BOD-Mine[1.1].txt");
  107.                         BODFileOres = BODFile;
  108.                         BODbiomesFile = new File(Minecraft.getMinecraftDir() + "/BODprops/(V2.5)BODbiomes-Mine[1.1].txt");
  109.                         File f=new File(Minecraft.getMinecraftDir() + "/BODprops"); // remove minecraft directy portion for multiplayer
  110.                         if(f.exists()==false)
  111.                         {
  112.                             f.mkdirs();
  113.                         }
  114.  
  115.                         if(BODFile.exists()==false)
  116.                         {
  117.                             writeBOD(BODFile);
  118.                             //System.out.println("write BODprops"); /// for debugging
  119.                         }
  120.                         if(BODbiomesFile.exists()==false)
  121.                         {
  122.                             writeBODbiomes(BODbiomesFile);
  123.                             //System.out.println("write BODbiomes"); /// for debugging
  124.                         }  
  125.                            
  126.                         while(BODFile.exists())
  127.                         {
  128.                             //System.out.println(" 2.3: bod file exists, checking rarity random"); /// for debugging
  129.                             betterOreDistribution(x_Chunk, z_Chunk, MPBlockID, minableBlockMeta); // gather ore gen values from .txt
  130.                            
  131.                             if (rarity > 0){rarity = mPBiomeRarity(rarity, x_Chunk, z_Chunk, MPBlockID);} // retrieve rarity for this ore in this biome
  132.                             if (rarity == 1 || rarity > 0 && rand.nextInt(rarity) == 0 ) // use values
  133.                             {
  134.                                 //System.out.println(" 2.3.1: rarity passed"); /// for debugging
  135.                                 while(BODFile.exists())
  136.                                 {                  
  137.                                     //System.out.println(" 2.3.2: other bod file works"); /// for debugging
  138.                                     betterOreDistribution(x_Chunk, z_Chunk, MPBlockID, minableBlockMeta); // gather ore gen values from .txt
  139.                                          // System.out.println("at " + (MPChunk_X / 16) + "," + (MPChunk_Z / 16) + ", id " + MPBlockID /*+ "-" + MPPrevID2 + "-" + MPPrevID3 + "-" + MPPrevID4*/ + ", R " + rarity + ", VS " + veinSi + ", VA " + veinAm + ", H " + height + ", D " + diameter + ", VD " + vDens + ", HD " + hDens); // used for debugging
  140.                                     //System.out.println("generate veins"); /// for debugging
  141.                                     for(int loopCount = 0; loopCount < veinAm; loopCount++)
  142.                                     {
  143.                                             int temp1 = mPCalculateDensity(diameter, hDens);
  144.                                             int temp2 = mineHeight + mPCalculateDensity(height, vDens);
  145.                                             int temp3 = mPCalculateDensity(diameter, hDens);
  146.                                             int l5 = x_Chunk + temp1;
  147.                                             int i9 = temp2;
  148.                                             int k13 = z_Chunk + temp3;
  149.                                             BODgenerate(worldObj, rand, l5, i9, k13, veinSi); // generate based on values
  150.                                                        
  151.                                     }
  152.                            
  153.                                     subMineGen++;
  154.                                     BODFile = new File(Minecraft.getMinecraftDir() + "/BODprops/(V2.5)BOD-Mine["+ mineGen +"."+ subMineGen +"].txt");
  155.                                 }
  156.                             }
  157.                             subMineGen = 1;
  158.                             mineGen++;
  159.                             BODFile = new File(Minecraft.getMinecraftDir() + "/BODprops/(V2.5)BOD-Mine["+ mineGen +"."+ subMineGen +"].txt");
  160.                         }
  161.                         //System.out.println(" 2.4: end of generation attempt"); /// for debugging
  162.                         if(aOreCheck[mineCount] != MPBlockID)
  163.                         {
  164.                             aOreCheck[mineCount] = MPBlockID; // add this ore to the list of ores for this chunk// note: regardless of it actually generating, this makes sure it only gets one attempt
  165.                             mineCount++; // increase number for array, so the next ID is in its own slot
  166.                         }
  167.                         metaOreCheck[minableBlockMeta] = minableBlockMeta;
  168.                     }
  169.                 }
  170.                 return true;
  171.         }
  172.        
  173.         public int mPCalculateDensity(int oreDistance, float oreDensity) // returns the density value
  174.         {
  175.    
  176.                         int loopCount = 0;
  177.                         int densityValuePassInner = 0;
  178.                         int densityValuePass = 0;
  179.                         oreDensity = oreDensity * .01F;
  180.                         oreDensity = (oreDensity * (oreDistance >> 1)) + 1F;// establishes number of times to loop
  181.                         loopCount = (int)(oreDensity); //stores number of times to loop
  182.                         densityValuePassInner = (int)((oreDistance/oreDensity)+.5F); // distance devided by number of times it will loop, establishes the number for randomization
  183.                         densityValuePass = 0;
  184.                         while (loopCount > 0) // loops to acumulate random values
  185.                         {
  186.                                         densityValuePass = densityValuePass + rand.nextInt(densityValuePassInner); // acumulate randoms
  187.                                         loopCount = loopCount - 1; // decriment loop
  188.                         }
  189.                         return densityValuePass; // return proccesed random value
  190.         }
  191.        
  192.         public int mPBiomeRarity(int biomeRar, int xChunkBio, int zChunkBio, int MPMinableBlockId)
  193.         {
  194.             worldChunkManager = worldObj.getWorldChunkManager();
  195.             BiomeGenBase biomegenbase = worldChunkManager.getBiomeGenAt(xChunkBio, zChunkBio);
  196.             Properties props = new Properties();
  197.             int biomeVals = rarity;
  198.             String valPass = "1";
  199.             String valPassB = "1";
  200.             int inc1 = 1;
  201.             try
  202.                 {
  203.                     BODbiomesFile = new File(Minecraft.getMinecraftDir() + "/BODprops/(V2.5)BODbiomes-Mine["+ mineGen +"."+ subMineGen +"].txt"); // setup file // remove  the minecraft directory portion for multiplayer
  204.                     if(BODbiomesFile.exists())
  205.                     {
  206.                         props.load(new FileInputStream(BODbiomesFile));
  207.  
  208.                         valPass = String.valueOf("OreID[" + MPMinableBlockId + ":" + minableBlockMeta + "]-BiomeID[" + biomegenbase.biomeID + "]");
  209.  
  210.                         if (props.getProperty(valPass)!= null) // make sure it exists first
  211.                         {
  212.                             valPassB = props.getProperty(valPass); // get new rarity value
  213.                             biomeVals = Integer.valueOf(valPassB);
  214.                         }
  215.                     }
  216.                 }
  217.             catch(IOException j)
  218.             {
  219.                 System.out.println("couldnt load BODbiomes"); /// for debugging
  220.             }
  221.                     /*try
  222.                         {
  223.                             File List = new File(Minecraft.getMinecraftDir() + "/BODprops/(V2.4)BiomesList.txt"); // setup file // remove  the minecraft directory portion for multiplayer
  224.                             props.load(new FileInputStream(List));
  225.                         }
  226.                     catch(IOException g)
  227.                     {
  228.                         try // Write Biome ID reference
  229.                             {
  230.                                 BufferedWriter out = new BufferedWriter(new FileWriter(BODFile));
  231.                                 inc1 = 0;
  232.                                 out.write("This file acts as a reference to all Biomes used currently." + "\r\n"  + "To refresh this list, delete this text file, and a new one will be made with updated biomes when new generation takes place");
  233.                                 while (inc1 <= 255)
  234.                                 {
  235.                                 if(biomegenbase.biomeList[inc1] == null){ out.write("ID" + inc1 + ": unused ID" + "\r\n");}
  236.                                 else
  237.                                     {
  238.                                         out.write("Biome ID " + inc1 + ": " + biomegenbase.biomeList[inc1] + "\r\n");
  239.                                     }
  240.                                 inc1++;
  241.                                 }
  242.                                 out.close();
  243.                             }
  244.                         catch(IOException k){}
  245.                     }*/
  246.             if( valPass != null){biomeRar =  biomeVals ;}
  247.             else {biomeRar = rarity;}
  248.  
  249.    
  250.             return biomeRar;
  251.         }
  252.        
  253.         public boolean betterOreDistribution(int xChunk, int zChunk, int MPMinableBlockId, int MPMinableBlockMeta)
  254.         {
  255.             //System.out.println("assigning variables"); /// for debugging
  256.             rarity = 2;
  257.             veinSi = 2;
  258.             veinAm = 2;
  259.             height = 2;
  260.             mineHeight = 2;
  261.             diameter = 2;
  262.             vDens = 2;
  263.             hDens = 2;
  264.             String valPass = "1";
  265.  
  266.                         Properties props = new Properties();
  267.                         //try retrieve data from file
  268.                         try
  269.                         {
  270.                            
  271.                             BODFile = new File(Minecraft.getMinecraftDir() + "/BODprops/(V2.5)BOD-Mine["+ mineGen +"."+ subMineGen +"].txt");
  272.                             if(BODFile.exists())
  273.                             {
  274.                                     props.load(new FileInputStream(BODFile));
  275.                                         // assign value to ore variable only if it is not null
  276.  
  277.                                         String valPass1 = String.valueOf(MPMinableBlockId + "." + MPMinableBlockMeta + "Rarity");
  278.                                         String valPass2 = String.valueOf(MPMinableBlockId + "." + MPMinableBlockMeta + "VeinSize");
  279.                                         String valPass3 = String.valueOf(MPMinableBlockId + "." + MPMinableBlockMeta + "VeinAmount");
  280.                                         String valPass4 = String.valueOf(MPMinableBlockId + "." + MPMinableBlockMeta + "Height");
  281.                                         String valPass8 = String.valueOf(MPMinableBlockId + "." + MPMinableBlockMeta + "MineHeight");
  282.                                         String valPass5 = String.valueOf(MPMinableBlockId + "." + MPMinableBlockMeta + "Diameter");
  283.                                         String valPass6 = String.valueOf(MPMinableBlockId + "." + MPMinableBlockMeta + "VerticalDensity");
  284.                                         String valPass7 = String.valueOf(MPMinableBlockId + "." + MPMinableBlockMeta + "HorizontalDensity");
  285.                                         //System.out.println(MPMinableBlockId + "." + MPMinableBlockMeta + "HorizontalDensity"); /// for debugging
  286.  
  287.                                             if(mineGen == 1 && subMineGen == 1 )
  288.                                             {
  289.                                                 if (props.getProperty(valPass1)== null || props.getProperty(valPass2)== null || props.getProperty(valPass3)== null || props.getProperty(valPass4)== null || props.getProperty(valPass5)== null || props.getProperty(valPass6)== null || props.getProperty(valPass7)== null)
  290.                                                 {
  291.                                                     try
  292.                                                     {
  293.  
  294.                                                         BufferedWriter out = new BufferedWriter(new FileWriter(BODFile,true));
  295.                                                         out.write("#NewBlock" + MPMinableBlockId + "\r\n");
  296.                                                         out.write(MPMinableBlockId + "." + MPMinableBlockMeta + "Rarity=50" + "\r\n");
  297.                                                         out.write(MPMinableBlockId + "." + MPMinableBlockMeta + "VeinSize=10" + "\r\n");
  298.                                                         out.write(MPMinableBlockId + "." + MPMinableBlockMeta + "VeinAmount=70" + "\r\n");
  299.                                                         out.write(MPMinableBlockId + "." + MPMinableBlockMeta + "Height=95" + "\r\n");
  300.                                                         out.write(MPMinableBlockId + "." + MPMinableBlockMeta + "MineHeight=0" + "\r\n");
  301.                                                         out.write(MPMinableBlockId + "." + MPMinableBlockMeta + "Diameter=48" + "\r\n");
  302.                                                         out.write(MPMinableBlockId + "." + MPMinableBlockMeta + "VerticalDensity=10" + "\r\n");
  303.                                                         out.write(MPMinableBlockId + "." + MPMinableBlockMeta + "HorizontalDensity=10" + "\r\n" + "\r\n");
  304.                                                         out.close();
  305.                                                         //System.out.println(MPMinableBlockId + "." + MPMinableBlockMeta + "HorizontalDensity=10"); /// for debugging
  306.                                                     }
  307.                                                     catch (IOException h)
  308.                                                     {
  309.                                                         System.out.println("couldnt write in new ore settings for ore" + MPMinableBlockId + "." + MPMinableBlockMeta); /// for debugging
  310.                                                     }
  311.                                                 }
  312.                                             }
  313.                                             if (props.getProperty(valPass1)!= null){
  314.                                             valPass = props.getProperty(valPass1); // rarity
  315.                                             rarity = Integer.valueOf(valPass) ; }
  316.                                            
  317.                                             if (props.getProperty(valPass2) != null){
  318.                                             valPass = props.getProperty(valPass2); // size
  319.                                             veinSi = Integer.valueOf(valPass) ; }
  320.                                            
  321.                                             if (props.getProperty(valPass3) != null){
  322.                                             valPass = props.getProperty(valPass3); // amount
  323.                                             veinAm = Integer.valueOf(valPass) ;      }
  324.                                            
  325.                                             if (props.getProperty(valPass4) != null){
  326.                                             valPass = props.getProperty(valPass4); // height
  327.                                             height = Integer.valueOf(valPass) ;      }
  328.                                            
  329.                                             if (props.getProperty(valPass8) != null){
  330.                                             valPass = props.getProperty(valPass8); // mineHeight
  331.                                             mineHeight = Integer.valueOf(valPass) ;      }
  332.                                            
  333.                                             if (props.getProperty(valPass5) != null){
  334.                                             valPass = props.getProperty(valPass5); // diameter
  335.                                             diameter = Integer.valueOf(valPass) ; }
  336.                                            
  337.                                             if (props.getProperty(valPass6) != null){
  338.                                             valPass = props.getProperty(valPass6); // vertical dense.
  339.                                             vDens = Integer.valueOf(valPass) ; }
  340.                                            
  341.                                             if (props.getProperty(valPass7) != null){
  342.                                             valPass = props.getProperty(valPass7); // horiz. dense.
  343.                                             hDens = Integer.valueOf(valPass) ; }
  344.                             }
  345.                             //else{System.out.println("couldnt assign variables, BODfile doesnt exist");} /// for debugging}
  346.                         }              
  347.        
  348.                         //catch exception in case properties file does not exist
  349.                         catch(IOException e)
  350.                         {
  351.                             System.out.println("assigning variables had an exception!!!"); /// for debugging
  352.                         }  
  353.                  // all variables set, continue to generate
  354.                         return true;
  355.         }
  356.        
  357.         public boolean BODgenerate(World world, Random rand, int par3, int par4, int par5, int xyz)
  358.         {
  359.  
  360.                 //==========================================mp mod
  361.                 numberOfBlocks = xyz; //input number of blocks per vein
  362.  
  363.                 //==========================================mp mod
  364.             float var6 = rand.nextFloat() * (float)Math.PI;
  365.             double var7 = (double)((float)(par3 + 8) + MathHelper.sin(var6) * (float)numberOfBlocks / 8.0F);
  366.             double var9 = (double)((float)(par3 + 8) - MathHelper.sin(var6) * (float)numberOfBlocks / 8.0F);
  367.             double var11 = (double)((float)(par5 + 8) + MathHelper.cos(var6) * (float)numberOfBlocks / 8.0F);
  368.             double var13 = (double)((float)(par5 + 8) - MathHelper.cos(var6) * (float)numberOfBlocks / 8.0F);
  369.             double var15 = (double)(par4 + rand.nextInt(3) - 2);
  370.             double var17 = (double)(par4 + rand.nextInt(3) - 2);
  371.  
  372.             for (int var19 = 0; var19 <= numberOfBlocks; ++var19)
  373.             {
  374.                 double var20 = var7 + (var9 - var7) * (double)var19 / (double)numberOfBlocks;
  375.                 double var22 = var15 + (var17 - var15) * (double)var19 / (double)numberOfBlocks;
  376.                 double var24 = var11 + (var13 - var11) * (double)var19 / (double)numberOfBlocks;
  377.                 double var26 = rand.nextDouble() * (double)this.numberOfBlocks / 16.0D;
  378.                 double var28 = (double)(MathHelper.sin((float)var19 * (float)Math.PI / (float)numberOfBlocks) + 1.0F) * var26 + 1.0D;
  379.                 double var30 = (double)(MathHelper.sin((float)var19 * (float)Math.PI / (float)numberOfBlocks) + 1.0F) * var26 + 1.0D;
  380.                 int var32 = MathHelper.floor_double(var20 - var28 / 2.0D);
  381.                 int var33 = MathHelper.floor_double(var22 - var30 / 2.0D);
  382.                 int var34 = MathHelper.floor_double(var24 - var28 / 2.0D);
  383.                 int var35 = MathHelper.floor_double(var20 + var28 / 2.0D);
  384.                 int var36 = MathHelper.floor_double(var22 + var30 / 2.0D);
  385.                 int var37 = MathHelper.floor_double(var24 + var28 / 2.0D);
  386.  
  387.                 for (int var38 = var32; var38 <= var35; ++var38)
  388.                 {
  389.                     double var39 = ((double)var38 + 0.5D - var20) / (var28 / 2.0D);
  390.  
  391.                     if (var39 * var39 < 1.0D)
  392.                     {
  393.                         for (int var41 = var33; var41 <= var36; ++var41)
  394.                         {
  395.                             double var42 = ((double)var41 + 0.5D - var22) / (var30 / 2.0D);
  396.  
  397.                             if (var39 * var39 + var42 * var42 < 1.0D)
  398.                             {
  399.                                 for (int var44 = var34; var44 <= var37; ++var44)
  400.                                 {
  401.                                     double var45 = ((double)var44 + 0.5D - var24) / (var28 / 2.0D);
  402.  
  403.                                     Block block = Block.blocksList[world.getBlockId(var38, var41, var44)];
  404.                                     if (var39 * var39 + var42 * var42 + var45 * var45 < 1.0D && (block != null && world.getBlockId(var38, var41, var44) == Block.stone.blockID))
  405.                                     {
  406.                                         world.setBlockAndMetadata(var38, var41, var44, minableBlockId, minableBlockMeta);
  407.                                         //System.out.println("block at " + var38 +" "+var41+" "+var44); /// for debugging
  408.                                     }
  409.                                 }
  410.                             }
  411.                         }
  412.                     }
  413.                 }
  414.             }
  415.             //System.out.println("a vein was placed " + minableBlockId + "." + minableBlockMeta+ " at " + par3 +" "+par4+" "+par5); /// for debugging
  416.             return true;
  417.         }
  418.  
  419.         public boolean writeBOD(File writeTo)
  420.         {
  421.             try // write BOD(<version>).txt
  422.             {
  423.                 BufferedWriter out = new BufferedWriter(new FileWriter(writeTo));
  424.                     out.write("#Dirt" + "\r\n"); // dirt
  425.                     out.write("3.0Rarity=50" + "\r\n");
  426.                     out.write("3.0VeinSize=30" + "\r\n");
  427.                     out.write("3.0VeinAmount=17" + "\r\n");
  428.                     out.write("3.0Height=128" + "\r\n");
  429.                     out.write("3.0MineHeight=0" + "\r\n");
  430.                     out.write("3.0Diameter=32" + "\r\n");
  431.                     out.write("3.0VerticalDensity=15" + "\r\n");
  432.                     out.write("3.0HorizontalDensity=10" + "\r\n" + "\r\n");
  433.                                                                                                                    
  434.                     out.write("#Gravel" + "\r\n"); // gravel
  435.                     out.write("13.0Rarity=50" + "\r\n");
  436.                     out.write("13.0VeinSize=30" + "\r\n");
  437.                     out.write("13.0VeinAmount=17" + "\r\n");
  438.                     out.write("13.0Height=128" + "\r\n");
  439.                     out.write("13.0MineHeight=0" + "\r\n");
  440.                     out.write("13.0Diameter=32" + "\r\n");
  441.                     out.write("13.0VerticalDensity=15" + "\r\n");
  442.                     out.write("13.0HorizontalDensity=10" + "\r\n" + "\r\n");
  443.                                                                                                                    
  444.                     out.write("#Gold" + "\r\n"); // gold
  445.                     out.write("14.0Rarity=140" + "\r\n");
  446.                     out.write("14.0VeinSize=8" + "\r\n");
  447.                     out.write("14.0VeinAmount=135" + "\r\n");
  448.                     out.write("14.0Height=80" + "\r\n");
  449.                     out.write("14.0MineHeight=0" + "\r\n");
  450.                     out.write("14.0Diameter=60" + "\r\n");
  451.                     out.write("14.0VerticalDensity=20" + "\r\n");
  452.                     out.write("14.0HorizontalDensity=10" + "\r\n" + "\r\n");
  453.                                                                                                                    
  454.                     out.write("#Iron" + "\r\n"); // Iron
  455.                     out.write("15.0Rarity=75" + "\r\n");
  456.                     out.write("15.0VeinSize=8" + "\r\n");
  457.                     out.write("15.0VeinAmount=220" + "\r\n");
  458.                     out.write("15.0Height=80" + "\r\n");
  459.                     out.write("15.0MineHeight=0" + "\r\n");
  460.                     out.write("15.0Diameter=65" + "\r\n");
  461.                     out.write("15.0VerticalDensity=15" + "\r\n");
  462.                     out.write("15.0HorizontalDensity=15" + "\r\n" + "\r\n");
  463.                                                                                                                    
  464.                     out.write("#Coal" + "\r\n"); // coal
  465.                     out.write("16.0Rarity=95" + "\r\n");
  466.                     out.write("16.0VeinSize=14" + "\r\n");
  467.                     out.write("16.0VeinAmount=150" + "\r\n");
  468.                     out.write("16.0Height=90" + "\r\n");
  469.                     out.write("16.0MineHeight=0" + "\r\n");
  470.                     out.write("16.0Diameter=70" + "\r\n");
  471.                     out.write("16.0VerticalDensity=30" + "\r\n");
  472.                     out.write("16.0HorizontalDensity=10" + "\r\n" + "\r\n");
  473.                                                                                                                    
  474.                     out.write("#Lapis" + "\r\n"); // lapis
  475.                     out.write("21.0Rarity=225" + "\r\n");
  476.                     out.write("21.0VeinSize=8" + "\r\n");
  477.                     out.write("21.0VeinAmount=200" + "\r\n");
  478.                     out.write("21.0Height=50" + "\r\n");
  479.                     out.write("21.0MineHeight=0" + "\r\n");
  480.                     out.write("21.0Diameter=70" + "\r\n");
  481.                     out.write("21.0VerticalDensity=20" + "\r\n");
  482.                     out.write("21.0HorizontalDensity=10" + "\r\n" + "\r\n");
  483.                                                                                                                    
  484.                     out.write("#Diamond" + "\r\n"); // daimond
  485.                     out.write("56.0Rarity=160" + "\r\n");
  486.                     out.write("56.0VeinSize=8" + "\r\n");
  487.                     out.write("56.0VeinAmount=220" + "\r\n");
  488.                     out.write("56.0Height=70" + "\r\n");
  489.                     out.write("56.0MineHeight=0" + "\r\n");
  490.                     out.write("56.0Diameter=70" + "\r\n");
  491.                     out.write("56.0VerticalDensity=20" + "\r\n");
  492.                     out.write("56.0HorizontalDensity=10" + "\r\n" + "\r\n");
  493.                                                                                                                    
  494.                     out.write("#Redstone" + "\r\n"); // redstone
  495.                     out.write("73.0Rarity=110" + "\r\n");
  496.                     out.write("73.0VeinSize=12" + "\r\n");
  497.                     out.write("73.0VeinAmount=160" + "\r\n");
  498.                     out.write("73.0Height=12" + "\r\n");
  499.                     out.write("73.0MineHeight=0" + "\r\n");
  500.                     out.write("73.0Diameter=160" + "\r\n");
  501.                     out.write("73.0VerticalDensity=20" + "\r\n");
  502.                     out.write("73.0HorizontalDensity=5" + "\r\n" + "\r\n");
  503.                 out.close();
  504.             }
  505.             catch (IOException f)
  506.             {
  507.                 System.out.println("could not write BODprops"); /// for debugging
  508.             }
  509.             return true;
  510.         }
  511.        
  512.         public boolean writeBODbiomes(File writeTo)
  513.         {
  514.             try
  515.             {
  516.                 BufferedWriter out = new BufferedWriter(new FileWriter(writeTo));
  517.                 out.write("# 3.0=dirt, 13.0=gravel, 14.0=gold, 15.0=iron, 16.0=coal, 21.0=lapis, 56.0=diamond, 73.0=redstone" + "\r\n");
  518.                 out.write("\r\n");
  519.                 out.write("# ------------------------------------------------------------"+"\r\n");
  520.                 out.write("# format is OreID[X.Xo]-BiomeID[Y]=Z" + "\r\n");
  521.                 out.write("# X = Ore ID"+"\r\n");
  522.                 out.write("# Xo = meta data for Ore ID"+"\r\n");
  523.                 out.write("# Y = Biome ID"+"\r\n");
  524.                 out.write("# Z = the rarity you want for that ore in that biome"+"\r\n");
  525.                 out.write("# ------------------------------------------------------------"+"\r\n");
  526.                 out.write("\r\n");
  527.                 out.write("#-----------Ocean 0" + "\r\n");
  528.                 out.write("OreID[21.0]-BiomeID[0]=75" + "\r\n");
  529.                 out.write("\r\n");
  530.                
  531.                 out.write("#-----------Plains 1" + "\r\n");
  532.                 out.write("OreID[3.0]-BiomeID[1]=25" + "\r\n");
  533.                 out.write("\r\n");
  534.                
  535.                 out.write("#-----------Desert 2" + "\r\n");
  536.                 out.write("OreID[15.0]-BiomeID[2]=37" + "\r\n");
  537.                 out.write("\r\n");
  538.                
  539.                 out.write("#-----------extremeHills 3" + "\r\n");
  540.                 out.write("OreID[14.0]-BiomeID[3]=70" + "\r\n");
  541.                 out.write("\r\n");
  542.                
  543.                 out.write("#-----------Forest 4" + "\r\n");
  544.                 out.write("OreID[15.0]-BiomeID[4]=37" + "\r\n");
  545.                 out.write("\r\n");
  546.                
  547.                 out.write("#-----------Taiga 5" + "\r\n");
  548.                 out.write("OreID[16.0]-BiomeID[5]=42" + "\r\n");
  549.                 out.write("\r\n");
  550.                
  551.                 out.write("#-----------Swampland 6" + "\r\n");
  552.                 out.write("OreID[73.0]-BiomeID[6]=55" + "\r\n");
  553.                 out.write("\r\n");
  554.                
  555.                 out.write("#-----------River 7" + "\r\n");
  556.                 out.write("OreID[14.0]-BiomeID[7]=70" + "\r\n");
  557.                 out.write("\r\n");
  558.                
  559.                 out.write("#-----------FrozenOcean 10" + "\r\n");
  560.                 out.write("\r\n");
  561.                
  562.                 out.write("#-----------FrozenRiver 11" + "\r\n");
  563.                 out.write("\r\n");
  564.                
  565.                 out.write("#-----------IcePlains 12" + "\r\n");
  566.                 out.write("\r\n");
  567.                
  568.                 out.write("#-----------IceMountain 13" + "\r\n");
  569.                 out.write("\r\n");
  570.                
  571.                 out.write("#-----------MushroomIsland 14" + "\r\n");
  572.                 out.write("OreID[13.0]-BiomeID[14]=40" + "\r\n");
  573.                 out.write("OreID[14.0]-BiomeID[14]=50" + "\r\n");
  574.                 out.write("OreID[15.0]-BiomeID[14]=50" + "\r\n");
  575.                 out.write("OreID[16.0]-BiomeID[14]=50" + "\r\n");
  576.                 out.write("OreID[21.0]-BiomeID[14]=50" + "\r\n");
  577.                 out.write("OreID[56.0]-BiomeID[14]=50" + "\r\n");
  578.                 out.write("OreID[73.0]-BiomeID[14]=50" + "\r\n");
  579.                 out.write("\r\n");
  580.                 out.write("#-----------mushroomshore 15" + "\r\n");
  581.                 out.write("\r\n");
  582.                 out.write("#-----------Beach 16" + "\r\n");
  583.                 out.write("\r\n");
  584.                 out.write("#-----------DesertHills 17" + "\r\n");
  585.                 out.write("\r\n");
  586.                 out.write("#-----------ForestHills 18" + "\r\n");
  587.                 out.write("\r\n");
  588.                 out.write("#-----------taigaHills 19" + "\r\n");
  589.                 out.write("\r\n");
  590.                 out.write("#-----------ExtremeHillsEdge 20" + "\r\n");
  591.                 out.write("\r\n");
  592.                 out.write("#-----------Jungle 21" + "\r\n");
  593.                 out.write("\r\n");
  594.                 out.write("#-----------JungleHills 22" + "\r\n");
  595.                 out.write("\r\n");
  596.                
  597.                 out.close();
  598.             }
  599.             catch(IOException i)
  600.             {
  601.                 System.out.println("could not write BODbiomes!!!"); /// for debugging
  602.             }
  603.             return true;
  604.         }
  605.  
  606.         //==========================================mp mod
  607.         private static int[] aOreCheck = new int[80];// setup array to store oreIDs for this chunk // has to be static to survive instance calls                
  608.         private static int[] metaOreCheck = new int[16];// this is used to check the metaIDs of a given ore ID
  609.         public static int MPChunk_X;
  610.         public static int MPChunk_Z;
  611.         private int x_Chunk;
  612.         private int z_Chunk;
  613.         public int MPBlockID;
  614.         private int minableBlockMeta = 0;
  615.         public static int MPPrevX;
  616.         public static int MPPrevZ;
  617.         public static int MPPrevID;
  618.         public static int MPPrevMeta;
  619.         //public static int MPPrevID3;
  620.         //public static int MPPrevID4;
  621.         private static boolean genBeforeCheck;
  622.         public static int mineCount;
  623.         public static int mineCountM;
  624.        
  625.         private static Random randomOut;
  626.         private static Random rand;
  627.         private static World worldObj;
  628.         private File BODFileOres;
  629.                 static File BODFile;
  630.                 static File BODbiomesFile;
  631.         private static WorldChunkManager worldChunkManager;
  632.                        
  633.         private int mineGen = 1;
  634.         private int subMineGen = 1;
  635.         private int rarity = 2;
  636.         private int veinSi = 2;
  637.         private int veinAm = 2;
  638.         private int height = 2;
  639.         private int mineHeight = 2;
  640.         private int diameter = 2;
  641.         private int vDens = 2;
  642.         private int hDens = 2;
  643.        
  644.         //==========================================mp mod
  645.         private int minableBlockId;
  646.         private int numberOfBlocks;
  647. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement