Advertisement
Guest User

Untitled

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