Guest User

Untitled

a guest
Aug 28th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 18.46 KB | None | 0 0
  1. package com.halestormxv.worldALT;
  2.  
  3. import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE;
  4. import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE;
  5. import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE;
  6. import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS;
  7. import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON;
  8. import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE;
  9. import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE;
  10. import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA;
  11.  
  12. import java.util.List;
  13. import java.util.Random;
  14. import java.util.logging.Level;
  15.  
  16.  
  17. import com.halestormxv.blocks.CelestialCraft_blocks;
  18. import com.halestormxv.utilities.GameLogHelper;
  19. import com.halestormxv.worldALT.biomes.ModBiomes;
  20.  
  21. import net.minecraft.block.Block;
  22. import net.minecraft.block.BlockFalling;
  23. import net.minecraft.entity.EnumCreatureType;
  24. import net.minecraft.init.Blocks;
  25. import net.minecraft.util.IProgressUpdate;
  26. import net.minecraft.util.MathHelper;
  27. import net.minecraft.world.ChunkPosition;
  28. import net.minecraft.world.SpawnerAnimals;
  29. import net.minecraft.world.World;
  30. import net.minecraft.world.WorldType;
  31. import net.minecraft.world.biome.BiomeGenBase;
  32. import net.minecraft.world.chunk.Chunk;
  33. import net.minecraft.world.chunk.IChunkProvider;
  34. import net.minecraft.world.gen.MapGenBase;
  35. import net.minecraft.world.gen.MapGenCaves;
  36. import net.minecraft.world.gen.MapGenRavine;
  37. import net.minecraft.world.gen.NoiseGenerator;
  38. import net.minecraft.world.gen.NoiseGeneratorOctaves;
  39. import net.minecraft.world.gen.NoiseGeneratorPerlin;
  40. import net.minecraft.world.gen.feature.WorldGenDungeons;
  41. import net.minecraft.world.gen.feature.WorldGenLakes;
  42. import net.minecraft.world.gen.structure.MapGenScatteredFeature;
  43. import net.minecraftforge.common.MinecraftForge;
  44. import net.minecraftforge.event.terraingen.ChunkProviderEvent;
  45. import net.minecraftforge.event.terraingen.PopulateChunkEvent;
  46. import net.minecraftforge.event.terraingen.TerrainGen;
  47. import cpw.mods.fml.common.eventhandler.Event.Result;
  48.  
  49. public class ChunkProviderForest implements IChunkProvider {
  50.  
  51.     /** RNG. */
  52.     private Random rand;
  53.  
  54.     /** A NoiseGeneratorOctaves used in generating terrain */
  55.     private NoiseGeneratorOctaves noiseGen1;
  56.     private NoiseGeneratorOctaves noiseGen2;
  57.     private NoiseGeneratorOctaves noiseGen3;
  58.     private NoiseGeneratorPerlin noisePerl;
  59.  
  60.     /** A NoiseGeneratorOctaves used in generating terrain */
  61.     public NoiseGeneratorOctaves noiseGen5;
  62.  
  63.     /** A NoiseGeneratorOctaves used in generating terrain */
  64.     public NoiseGeneratorOctaves noiseGen6;
  65.     public NoiseGeneratorOctaves mobSpawnerNoise;
  66.  
  67.     /** Reference to the World object. */
  68.     private World worldObj;
  69.  
  70.     /** are map structures going to be generated (e.g. strongholds) */
  71.     private final boolean mapFeaturesEnabled;
  72.  
  73.     private WorldType worldType;
  74.     private final double[] noiseArray;
  75.     private final float[] parabolicField;
  76.     private double[] stoneNoise = new double[256];
  77.     private MapGenBase caveGenerator = new MapGenCaves();
  78.  
  79.     private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature();
  80.  
  81.     /** Holds ravine generator */
  82.     private MapGenBase ravineGenerator = new MapGenRavine();
  83.  
  84.     /** The biomes that are used to generate the chunk */
  85.     private BiomeGenBase[] biomesForGeneration;
  86.  
  87.     /** A double array that hold terrain noise */
  88.     double[] noise3;
  89.     double[] noise1;
  90.     double[] noise2;
  91.     double[] noise5;
  92.     int[][] field_73219_j = new int[32][32];
  93.  
  94.     {
  95.         caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE);
  96.         scatteredFeatureGenerator = (MapGenScatteredFeature) TerrainGen.getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE);
  97.         ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, RAVINE);
  98.     }
  99.  
  100.     public ChunkProviderForest(World world, long seed, boolean mapFeaturesEnabled)
  101.     {
  102.         GameLogHelper.writeToLog(Level.INFO, "Loading Chunk Provider for dmension.");
  103.         this.worldObj = world;
  104.         this.mapFeaturesEnabled = mapFeaturesEnabled;
  105.         this.worldType = world.getWorldInfo().getTerrainType();
  106.         this.rand = new Random(seed);
  107.         this.noiseGen1 = new NoiseGeneratorOctaves(this.rand, 16);
  108.         this.noiseGen2 = new NoiseGeneratorOctaves(this.rand, 16);
  109.         this.noiseGen3 = new NoiseGeneratorOctaves(this.rand, 8);
  110.         this.noisePerl = new NoiseGeneratorPerlin(this.rand, 4);
  111.         this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10);
  112.         this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16);
  113.         this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8);
  114.         this.noiseArray = new double[825];
  115.         this.parabolicField = new float[25];
  116.         for (int j = -2; j <= 2; ++j) {
  117.             for (int k = -2; k <= 2; ++k) {
  118.                 float f = 10.0F / MathHelper.sqrt_float((float)(j * j + k * k) + 0.2F);
  119.                 this.parabolicField[j + 2 + (k + 2) * 5] = f;
  120.             }
  121.         }
  122.         NoiseGenerator[] noiseGens = {noiseGen1, noiseGen2, noiseGen3, noisePerl, noiseGen5, noiseGen6, mobSpawnerNoise};
  123.         noiseGens = TerrainGen.getModdedNoiseGenerators(world, this.rand, noiseGens);
  124.         this.noiseGen1 = (NoiseGeneratorOctaves)noiseGens[0];
  125.         this.noiseGen2 = (NoiseGeneratorOctaves)noiseGens[1];
  126.         this.noiseGen3 = (NoiseGeneratorOctaves)noiseGens[2];
  127.         this.noisePerl = (NoiseGeneratorPerlin)noiseGens[3];
  128.         this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4];
  129.         this.noiseGen6 = (NoiseGeneratorOctaves)noiseGens[5];
  130.         this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6];
  131.     }
  132.  
  133.     /**
  134.      * Generates the shape of the terrain for the chunk though its all stone
  135.      * though the water is frozen if the temperature is low enough
  136.      */
  137.     // TODO: generateTerrain?
  138.     public void func_147424_a(int par1, int par2, Block[] blocks) {
  139.        
  140.         //DONT EDIT THS METHOD UNLES YOU KNOW WHAT UR DOING OR MAKE A COPY INCASE U MESS IT UP....
  141.         //YOU HAVE BE WARNED !!!!!
  142.  
  143.         byte b0 = 63;
  144.         this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, par1 * 4 - 2, par2 * 4 - 2, 10, 10);
  145.         this.func_147423_a(par1 * 4, 0, par2 * 4);
  146.         for (int k = 0; k < 4; ++k) {
  147.             int l = k * 5;
  148.             int i1 = (k + 1) * 5;
  149.             for (int j1 = 0; j1 < 4; ++j1) {
  150.                 int k1 = (l + j1) * 33;
  151.                 int l1 = (l + j1 + 1) * 33;
  152.                 int i2 = (i1 + j1) * 33;
  153.                 int j2 = (i1 + j1 + 1) * 33;
  154.                 for (int k2 = 0; k2 < 32; ++k2) {
  155.                     double d0 = 0.125D;
  156.                     double d1 = this.noiseArray[k1 + k2];
  157.                     double d2 = this.noiseArray[l1 + k2];
  158.                     double d3 = this.noiseArray[i2 + k2];
  159.                     double d4 = this.noiseArray[j2 + k2];
  160.                     double d5 = (this.noiseArray[k1 + k2 + 1] - d1) * d0;
  161.                     double d6 = (this.noiseArray[l1 + k2 + 1] - d2) * d0;
  162.                     double d7 = (this.noiseArray[i2 + k2 + 1] - d3) * d0;
  163.                     double d8 = (this.noiseArray[j2 + k2 + 1] - d4) * d0;
  164.                     for (int l2 = 0; l2 < 8; ++l2) {
  165.                         double d9 = 0.25D;
  166.                         double d10 = d1;
  167.                         double d11 = d2;
  168.                         double d12 = (d3 - d1) * d9;
  169.                         double d13 = (d4 - d2) * d9;
  170.                         for (int i3 = 0; i3 < 4; ++i3) {
  171.                             int j3 = i3 + k * 4 << 12 | 0 + j1 * 4 << 8 | k2 * 8 + l2;
  172.                             short short1 = 256;
  173.                             j3 -= short1;
  174.                             double d14 = 0.25D;
  175.                             double d16 = (d11 - d10) * d14;
  176.                             double d15 = d10 - d16;
  177.                             for (int k3 = 0; k3 < 4; ++k3) {
  178.                                 if ((d15 += d16) > 0.0D) {
  179.                                     blocks[j3 += short1] = CelestialCraft_blocks.CelFillStone;//these can be set to custom blocks
  180.                                 } else if (k2 * 8 + l2 < b0) {
  181.                                     blocks[j3 += short1] = Blocks.water;//these can be set to custom blocks
  182.                                 } else {
  183.                                     blocks[j3 += short1] = null;//this is the air block i think.
  184.                                 }
  185.                             }
  186.                             d10 += d12;
  187.                             d11 += d13;
  188.                         }
  189.                         d1 += d5;
  190.                         d2 += d6;
  191.                         d3 += d7;
  192.                         d4 += d8;
  193.                     }
  194.                 }
  195.             }
  196.         }
  197.     }
  198.  
  199.     public void replaceBlocksForBiome(int par1, int par2, Block[] blocks, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase) {
  200.         GameLogHelper.writeToLog(Level.INFO, "Replacing block for biome.");
  201.         @SuppressWarnings("deprecation")
  202.         ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, par1, par2, blocks, par3ArrayOfByte, par4ArrayOfBiomeGenBase);
  203.         MinecraftForge.EVENT_BUS.post(event);
  204.         if (event.getResult() == Result.DENY) return;
  205.         double d0 = 0.03125D;
  206.         this.stoneNoise = this.noisePerl.func_151599_a(this.stoneNoise, (double)(par1 * 16), (double)(par2 * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);
  207.         for (int k = 0; k < 16; ++k) {
  208.             for (int l = 0; l < 16; ++l) {
  209.                 ModBiomes biomegenbase = (ModBiomes) par4ArrayOfBiomeGenBase[l + k * 16];
  210.                 biomegenbase.genTerrainBlocks(this.worldObj, this.rand, blocks, par3ArrayOfByte, par1 * 16 + k, par2 * 16 + l, this.stoneNoise[l + k * 16]);
  211.             }
  212.         }
  213.     }
  214.  
  215.     /**
  216.      * loads or generates the chunk at the chunk location specified
  217.      */
  218.     @Override
  219.     public Chunk loadChunk(int par1, int par2) {
  220.         return this.provideChunk(par1, par2);
  221.     }
  222.  
  223.     /**
  224.      * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
  225.      * specified chunk from the map seed and chunk seed
  226.      */
  227.     @Override
  228.     public Chunk provideChunk(int par1, int par2) {
  229.         this.rand.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);
  230.         Block[] ablock = new Block[65536];
  231.         byte[] abyte = new byte[65536];
  232.         this.func_147424_a(par1, par2, ablock);
  233.         this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16);
  234.         this.replaceBlocksForBiome(par1, par2, ablock, abyte, this.biomesForGeneration);
  235.         this.caveGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);
  236.         this.ravineGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);
  237.         if (this.mapFeaturesEnabled) {
  238.             this.scatteredFeatureGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);
  239.         }
  240.         Chunk chunk = new Chunk(this.worldObj, ablock, abyte, par1, par2);
  241.         byte[] abyte1 = chunk.getBiomeArray();
  242.         for (int k = 0; k < abyte1.length; ++k){
  243.             abyte1[k] = (byte)this.biomesForGeneration[k].biomeID;
  244.         }
  245.         chunk.generateSkylightMap();
  246.         return chunk;
  247.     }
  248.  
  249.     /**
  250.      * generates a subset of the level's terrain data. Takes 7 arguments: the
  251.      * [empty] noise array, the position, and the size.
  252.      */
  253.     // TODO: initializeNoiseField?
  254.     private void func_147423_a(int p_147423_1_, int p_147423_2_, int p_147423_3_) {
  255.  
  256.         //DONT EDIT THS METHOD UNLES YOU KNOW WHAT UR DOING OR MAKE A COPY INCASE U MESS IT UP....
  257.         //YOU HAVE BE WARNED !!!!!
  258.  
  259.         this.noise5 = this.noiseGen6.generateNoiseOctaves(this.noise5, p_147423_1_, p_147423_3_, 5, 5, 200.0D, 200.0D, 0.5D);
  260.         this.noise3 = this.noiseGen3.generateNoiseOctaves(this.noise3, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, 8.555150000000001D, 4.277575000000001D, 8.555150000000001D);
  261.         this.noise1 = this.noiseGen1.generateNoiseOctaves(this.noise1, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, 684.412D, 684.412D, 684.412D);
  262.         this.noise2 = this.noiseGen2.generateNoiseOctaves(this.noise2, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, 684.412D, 684.412D, 684.412D);
  263.         int l = 0;
  264.         int i1 = 0;
  265.         for (int j1 = 0; j1 < 5; ++j1) {
  266.             for (int k1 = 0; k1 < 5; ++k1) {
  267.                 float f = 0.0F;
  268.                 float f1 = 0.0F;
  269.                 float f2 = 0.0F;
  270.                 byte b0 = 2;
  271.                 BiomeGenBase biomegenbase = this.biomesForGeneration[j1 + 2 + (k1 + 2) * 10];
  272.                 for (int l1 = -b0; l1 <= b0; ++l1) {
  273.                     for (int i2 = -b0; i2 <= b0; ++i2) {
  274.                         BiomeGenBase biomegenbase1 = this.biomesForGeneration[j1 + l1 + 2 + (k1 + i2 + 2) * 10];
  275.                         float f3 = biomegenbase1.rootHeight;
  276.                         float f4 = biomegenbase1.heightVariation;
  277.                         if (this.worldType == WorldType.AMPLIFIED && f3 > 0.0F) {
  278.                             f3 = 1.0F + f3 * 2.0F;
  279.                             f4 = 1.0F + f4 * 4.0F;
  280.                         }
  281.                         float f5 = this.parabolicField[l1 + 2 + (i2 + 2) * 5] / (f3 + 2.0F);
  282.                         if (biomegenbase1.rootHeight > biomegenbase.rootHeight) {
  283.                             f5 /= 2.0F;
  284.                         }
  285.                         f += f4 * f5;
  286.                         f1 += f3 * f5;
  287.                         f2 += f5;
  288.                     }
  289.                 }
  290.                 f /= f2;
  291.                 f1 /= f2;
  292.                 f = f * 0.9F + 0.1F;
  293.                 f1 = (f1 * 4.0F - 1.0F) / 8.0F;
  294.                 double d12 = this.noise5[i1] / 8000.0D;
  295.                 if (d12 < 0.0D) {
  296.                     d12 = -d12 * 0.3D;
  297.                 }
  298.                 d12 = d12 * 3.0D - 2.0D;
  299.                 if (d12 < 0.0D) {
  300.                     d12 /= 2.0D;
  301.                     if (d12 < -1.0D) {
  302.                         d12 = -1.0D;
  303.                     }
  304.                     d12 /= 1.4D;
  305.                     d12 /= 2.0D;
  306.                 } else {
  307.                     if (d12 > 1.0D) {
  308.                         d12 = 1.0D;
  309.                     }
  310.                     d12 /= 8.0D;
  311.                 }
  312.                 ++i1;
  313.                 double d13 = (double)f1;
  314.                 double d14 = (double)f;
  315.                 d13 += d12 * 0.2D;
  316.                 d13 = d13 * 8.5D / 8.0D;
  317.                 double d5 = 8.5D + d13 * 4.0D;
  318.                 for (int j2 = 0; j2 < 33; ++j2) {
  319.                     double d6 = ((double)j2 - d5) * 12.0D * 128.0D / 256.0D / d14;
  320.                     if (d6 < 0.0D) {
  321.                         d6 *= 4.0D;
  322.                     }
  323.                     double d7 = this.noise1[l] / 512.0D;
  324.                     double d8 = this.noise2[l] / 512.0D;
  325.                     double d9 = (this.noise3[l] / 10.0D + 1.0D) / 2.0D;
  326.                     double d10 = MathHelper.denormalizeClamp(d7, d8, d9) - d6;
  327.                     if (j2 > 29) {
  328.                         double d11 = (double)((float)(j2 - 29) / 3.0F);
  329.                         d10 = d10 * (1.0D - d11) + -10.0D * d11;
  330.                     }
  331.                     this.noiseArray[l] = d10;
  332.                     ++l;
  333.                 }
  334.             }
  335.         }
  336.     }
  337.  
  338.     /**
  339.      * Checks to see if a chunk exists at x, y
  340.      */
  341.     @Override
  342.     public boolean chunkExists(int par1, int par2)  {
  343.         return true;
  344.     }
  345.  
  346.     /**
  347.      * Populates chunk with ores etc etc
  348.      */
  349.     @Override
  350.     public void populate(IChunkProvider par1IChunkProvider, int par2, int par3) {
  351.         BlockFalling.fallInstantly = true;
  352.         int k = par2 * 16;
  353.         int l = par3 * 16;
  354.         BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
  355.         this.rand.setSeed(this.worldObj.getSeed());
  356.         long i1 = this.rand.nextLong() / 2L * 2L + 1L;
  357.         long j1 = this.rand.nextLong() / 2L * 2L + 1L;
  358.         this.rand.setSeed((long)par2 * i1 + (long)par3 * j1 ^ this.worldObj.getSeed());
  359.         boolean flag = false;
  360.         MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag));
  361.  
  362.         //Enable map features ??
  363.         if (this.mapFeaturesEnabled) {
  364.             this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
  365.         }
  366.         int k1;
  367.         int l1;
  368.         int i2;
  369.  
  370.         //Add Lakes ??
  371.         if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && !flag && this.rand.nextInt(4) == 0
  372.                 && TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAKE)) {
  373.             k1 = k + this.rand.nextInt(16) + 8;
  374.             l1 = this.rand.nextInt(256);
  375.             i2 = l + this.rand.nextInt(16) + 8;
  376.             (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2);
  377.         }
  378.  
  379.         //Add Lakes ??
  380.         if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAVA) && !flag && this.rand.nextInt(8) == 0) {
  381.             k1 = k + this.rand.nextInt(16) + 8;
  382.             l1 = this.rand.nextInt(this.rand.nextInt(248) + 8);
  383.             i2 = l + this.rand.nextInt(16) + 8;
  384.  
  385.             if (l1 < 63 || this.rand.nextInt(10) == 0)  {
  386.                 (new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, k1, l1, i2);
  387.             }
  388.         }
  389.  
  390.         //Add Dungeons ??
  391.         boolean doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, DUNGEON);
  392.         for (k1 = 0; doGen && k1 < 8; ++k1) {
  393.             l1 = k + this.rand.nextInt(16) + 8;
  394.             i2 = this.rand.nextInt(256);
  395.             int j2 = l + this.rand.nextInt(16) + 8;
  396.             (new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2);
  397.         }
  398.  
  399.         //Add Animals ??
  400.         biomegenbase.decorate(this.worldObj, this.rand, k, l);
  401.         if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ANIMALS)) {
  402.             SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
  403.         }
  404.         k += 8;
  405.         l += 8;
  406.  
  407.         //Creates snow and ice in world.
  408.         doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ICE);
  409.         for (k1 = 0; doGen && k1 < 16; ++k1) {
  410.             for (l1 = 0; l1 < 16; ++l1) {
  411.                 i2 = this.worldObj.getPrecipitationHeight(k + k1, l + l1);
  412.  
  413.                 if (this.worldObj.isBlockFreezable(k1 + k, i2 - 1, l1 + l)) {
  414.                     this.worldObj.setBlock(k1 + k, i2 - 1, l1 + l, Blocks.ice, 0, 2);
  415.                 }
  416.  
  417.                 if (this.worldObj.func_147478_e(k1 + k, i2, l1 + l, true)) {
  418.                     this.worldObj.setBlock(k1 + k, i2, l1 + l, Blocks.snow_layer, 0, 2);
  419.                 }
  420.             }
  421.         }
  422.         MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag));
  423.         BlockFalling.fallInstantly = false;
  424.     }
  425.  
  426.     /**
  427.      * Two modes of operation: if passed true, save all Chunks in one go.  If passed false, save up to two chunks.
  428.      * Return true if all chunks have been saved.
  429.      */
  430.     @Override
  431.     public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate) {
  432.         return true;
  433.     }
  434.  
  435.     /**
  436.      * Save extra data not associated with any Chunk.  Not saved during autosave, only during world unload.  Currently
  437.      * unimplemented.
  438.      */
  439.     @Override
  440.     public void saveExtraData() {}
  441.  
  442.     /**
  443.      * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.
  444.      */
  445.     @Override
  446.     public boolean unloadQueuedChunks() {
  447.         return false;
  448.     }
  449.  
  450.     /**
  451.      * Returns if the IChunkProvider supports saving.
  452.      */
  453.     @Override
  454.     public boolean canSave() {
  455.         return true;
  456.     }
  457.  
  458.     /**
  459.      * Converts the instance data to a readable string.
  460.      */
  461.     @Override
  462.     public String makeString() {
  463.         return "RandomLevelSource";
  464.     }
  465.  
  466.     /**
  467.      * Returns a list of creatures of the specified type that can spawn at the given location.
  468.      */
  469.     @SuppressWarnings("rawtypes")
  470.     @Override
  471.     public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4) {
  472.         BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(par2, par4);
  473.         return par1EnumCreatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.func_143030_a(par2, par3, par4) ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() : biomegenbase.getSpawnableList(par1EnumCreatureType);
  474.     }
  475.  
  476.     @Override
  477.     public int getLoadedChunkCount() {
  478.         return 0;
  479.     }
  480.  
  481.     @Override
  482.     public void recreateStructures(int par1, int par2) {
  483.         if (this.mapFeaturesEnabled) {
  484.             //this.scatteredFeatureGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null);
  485.         }
  486.     }
  487.  
  488.     /**
  489.      * Returns the location of the closest structure of the specified type. If
  490.      * not found returns null.
  491.      */
  492.     @Override
  493.     // TODO:            findClosestStructure
  494.     public ChunkPosition func_147416_a(World world, String arg1, int arg2, int arg3, int arg4) {
  495.         return null;
  496.     }
  497. }
Advertisement
Add Comment
Please, Sign In to add comment