Guest User

Untitled

a guest
May 24th, 2014
292
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. =================================BiomeGenBaseME======================================
  2. package com.raoul.minecraftexpension.world;
  3.  
  4. import java.util.Random;
  5.  
  6. import com.raoul.minecraftexpension.init.BlocksInit;
  7.  
  8. import net.minecraft.block.Block;
  9. import net.minecraft.block.BlockStone;
  10. import net.minecraft.block.material.Material;
  11. import net.minecraft.init.Blocks;
  12. import net.minecraft.world.World;
  13. import net.minecraft.world.biome.BiomeGenBase;
  14.  
  15. public class BiomeGenBaseME extends BiomeGenBase
  16. {
  17. public BiomeGenBaseME(int par1)
  18. {
  19. super(par1);
  20. this.topBlock = Blocks.grass;
  21. this.fillerBlock = Blocks.dirt;
  22. }
  23. }
  24.  
  25.  
  26. ============================ChunkProviderME=====================================
  27.  
  28.  
  29. package com.raoul.minecraftexpension.world;
  30.  
  31. import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE;
  32. import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT;
  33. import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE;
  34. import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE;
  35. import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD;
  36. import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE;
  37. import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS;
  38. import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON;
  39. import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE;
  40. import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE;
  41. import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA;
  42.  
  43. import java.util.List;
  44. import java.util.Random;
  45.  
  46. import com.raoul.minecraftexpension.init.BlocksInit;
  47.  
  48. import cpw.mods.fml.common.eventhandler.Event.Result;
  49. import net.minecraft.block.Block;
  50. import net.minecraft.block.BlockFalling;
  51. import net.minecraft.entity.EnumCreatureType;
  52. import net.minecraft.init.Blocks;
  53. import net.minecraft.util.IProgressUpdate;
  54. import net.minecraft.util.MathHelper;
  55. import net.minecraft.world.ChunkPosition;
  56. import net.minecraft.world.SpawnerAnimals;
  57. import net.minecraft.world.World;
  58. import net.minecraft.world.WorldType;
  59. import net.minecraft.world.biome.BiomeGenBase;
  60. import net.minecraft.world.chunk.Chunk;
  61. import net.minecraft.world.chunk.IChunkProvider;
  62. import net.minecraft.world.gen.MapGenBase;
  63. import net.minecraft.world.gen.MapGenCaves;
  64. import net.minecraft.world.gen.MapGenRavine;
  65. import net.minecraft.world.gen.NoiseGenerator;
  66. import net.minecraft.world.gen.NoiseGeneratorOctaves;
  67. import net.minecraft.world.gen.NoiseGeneratorPerlin;
  68. import net.minecraft.world.gen.feature.WorldGenDungeons;
  69. import net.minecraft.world.gen.feature.WorldGenLakes;
  70. import net.minecraft.world.gen.structure.MapGenMineshaft;
  71. import net.minecraft.world.gen.structure.MapGenScatteredFeature;
  72. import net.minecraft.world.gen.structure.MapGenStronghold;
  73. import net.minecraft.world.gen.structure.MapGenVillage;
  74. import net.minecraftforge.common.MinecraftForge;
  75. import net.minecraftforge.event.terraingen.ChunkProviderEvent;
  76. import net.minecraftforge.event.terraingen.PopulateChunkEvent;
  77. import net.minecraftforge.event.terraingen.TerrainGen;
  78.  
  79. public class ChunkProviderME implements IChunkProvider
  80. {
  81. //TODO Customize the World
  82. //TODO Add Custom Ore Generation
  83.  
  84. /** RNG. */
  85. private Random rand;
  86. private NoiseGeneratorOctaves field_147431_j;
  87. private NoiseGeneratorOctaves field_147432_k;
  88. private NoiseGeneratorOctaves field_147429_l;
  89. private NoiseGeneratorPerlin field_147430_m;
  90. /** A NoiseGeneratorOctaves used in generating terrain */
  91. public NoiseGeneratorOctaves noiseGen5;
  92. /** A NoiseGeneratorOctaves used in generating terrain */
  93. public NoiseGeneratorOctaves noiseGen6;
  94. public NoiseGeneratorOctaves mobSpawnerNoise;
  95. /** Reference to the World object. */
  96. private World worldObj;
  97. /** are map structures going to be generated (e.g. strongholds) */
  98. private final boolean mapFeaturesEnabled;
  99. private WorldType field_147435_p;
  100. private final double[] field_147434_q;
  101. private final float[] parabolicField;
  102. private double[] stoneNoise = new double[256];
  103. private MapGenBase caveGenerator = new MapGenCaves();
  104. /** Holds Stronghold Generator */
  105. private MapGenStronghold strongholdGenerator = new MapGenStronghold();
  106. /** Holds Village Generator */
  107. private MapGenVillage villageGenerator = new MapGenVillage();
  108. /** Holds Mineshaft Generator */
  109. private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft();
  110. private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature();
  111. /** Holds ravine generator */
  112. private MapGenBase ravineGenerator = new MapGenRavine();
  113. /** The biomes that are used to generate the chunk */
  114. private BiomeGenBase[] biomesForGeneration;
  115. double[] field_147427_d;
  116. double[] field_147428_e;
  117. double[] field_147425_f;
  118. double[] field_147426_g;
  119. int[][] field_73219_j = new int[32][32];
  120. private static final String __OBFID = "CL_00000396";
  121.  
  122. {
  123. caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE);
  124. strongholdGenerator = (MapGenStronghold) TerrainGen.getModdedMapGen(strongholdGenerator, STRONGHOLD);
  125. villageGenerator = (MapGenVillage) TerrainGen.getModdedMapGen(villageGenerator, VILLAGE);
  126. mineshaftGenerator = (MapGenMineshaft) TerrainGen.getModdedMapGen(mineshaftGenerator, MINESHAFT);
  127. scatteredFeatureGenerator = (MapGenScatteredFeature) TerrainGen.getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE);
  128. ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, RAVINE);
  129. }
  130.  
  131. public ChunkProviderME(World par1World, long par2, boolean par4)
  132. {
  133. this.worldObj = par1World;
  134. this.mapFeaturesEnabled = par4;
  135. this.field_147435_p = par1World.getWorldInfo().getTerrainType();
  136. this.rand = new Random(par2);
  137. this.field_147431_j = new NoiseGeneratorOctaves(this.rand, 16);
  138. this.field_147432_k = new NoiseGeneratorOctaves(this.rand, 16);
  139. this.field_147429_l = new NoiseGeneratorOctaves(this.rand, 8);
  140. this.field_147430_m = new NoiseGeneratorPerlin(this.rand, 4);
  141. this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10);
  142. this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16);
  143. this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8);
  144. this.field_147434_q = new double[825];
  145. this.parabolicField = new float[25];
  146.  
  147. for (int j = -2; j <= 2; ++j)
  148. {
  149. for (int k = -2; k <= 2; ++k)
  150. {
  151. float f = 10.0F / MathHelper.sqrt_float((float)(j * j + k * k) + 0.2F);
  152. this.parabolicField[j + 2 + (k + 2) * 5] = f;
  153. }
  154. }
  155.  
  156. NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, noiseGen5, noiseGen6, mobSpawnerNoise};
  157. noiseGens = TerrainGen.getModdedNoiseGenerators(par1World, this.rand, noiseGens);
  158. this.field_147431_j = (NoiseGeneratorOctaves)noiseGens[0];
  159. this.field_147432_k = (NoiseGeneratorOctaves)noiseGens[1];
  160. this.field_147429_l = (NoiseGeneratorOctaves)noiseGens[2];
  161. this.field_147430_m = (NoiseGeneratorPerlin)noiseGens[3];
  162. this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4];
  163. this.noiseGen6 = (NoiseGeneratorOctaves)noiseGens[5];
  164. this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6];
  165. }
  166.  
  167.  
  168. public void func_147424_a(int p_147424_1_, int p_147424_2_, Block[] p_147424_3_)
  169. {
  170. byte b0 = 63;
  171. this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, p_147424_1_ * 4 - 2, p_147424_2_ * 4 - 2, 10, 10);
  172. this.func_147423_a(p_147424_1_ * 4, 0, p_147424_2_ * 4);
  173.  
  174. for (int k = 0; k < 4; ++k)
  175. {
  176. int l = k * 5;
  177. int i1 = (k + 1) * 5;
  178.  
  179. for (int j1 = 0; j1 < 4; ++j1)
  180. {
  181. int k1 = (l + j1) * 33;
  182. int l1 = (l + j1 + 1) * 33;
  183. int i2 = (i1 + j1) * 33;
  184. int j2 = (i1 + j1 + 1) * 33;
  185.  
  186. for (int k2 = 0; k2 < 32; ++k2)
  187. {
  188. double d0 = 0.125D;
  189. double d1 = this.field_147434_q[k1 + k2];
  190. double d2 = this.field_147434_q[l1 + k2];
  191. double d3 = this.field_147434_q[i2 + k2];
  192. double d4 = this.field_147434_q[j2 + k2];
  193. double d5 = (this.field_147434_q[k1 + k2 + 1] - d1) * d0;
  194. double d6 = (this.field_147434_q[l1 + k2 + 1] - d2) * d0;
  195. double d7 = (this.field_147434_q[i2 + k2 + 1] - d3) * d0;
  196. double d8 = (this.field_147434_q[j2 + k2 + 1] - d4) * d0;
  197.  
  198. for (int l2 = 0; l2 < 8; ++l2)
  199. {
  200. double d9 = 0.25D;
  201. double d10 = d1;
  202. double d11 = d2;
  203. double d12 = (d3 - d1) * d9;
  204. double d13 = (d4 - d2) * d9;
  205.  
  206. for (int i3 = 0; i3 < 4; ++i3)
  207. {
  208. int j3 = i3 + k * 4 << 12 | 0 + j1 * 4 << 8 | k2 * 8 + l2;
  209. short short1 = 256;
  210. j3 -= short1;
  211. double d14 = 0.25D;
  212. double d16 = (d11 - d10) * d14;
  213. double d15 = d10 - d16;
  214.  
  215. for (int k3 = 0; k3 < 4; ++k3)
  216. {
  217. if ((d15 += d16) > 0.0D)
  218. {
  219. p_147424_3_[j3 += short1] = Blocks.stone;
  220. }
  221. else if (k2 * 8 + l2 < b0)
  222. {
  223. p_147424_3_[j3 += short1] = Blocks.water;
  224. }
  225. else
  226. {
  227. p_147424_3_[j3 += short1] = null;
  228. }
  229. }
  230.  
  231. d10 += d12;
  232. d11 += d13;
  233. }
  234.  
  235. d1 += d5;
  236. d2 += d6;
  237. d3 += d7;
  238. d4 += d8;
  239. }
  240. }
  241. }
  242. }
  243. }
  244.  
  245. public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] p_147422_3_, byte[] p_147422_4_, BiomeGenBase[] p_147422_5_)
  246. {
  247. ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147422_1_, p_147422_2_, p_147422_3_, p_147422_4_, p_147422_5_);
  248. MinecraftForge.EVENT_BUS.post(event);
  249. if (event.getResult() == Result.DENY) return;
  250.  
  251. double d0 = 0.03125D;
  252. this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_147422_1_ * 16), (double)(p_147422_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);
  253.  
  254. for (int k = 0; k < 16; ++k)
  255. {
  256. for (int l = 0; l < 16; ++l)
  257. {
  258. BiomeGenBase biomegenbase = p_147422_5_[l + k * 16];
  259. biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_147422_3_, p_147422_4_, p_147422_1_ * 16 + k, p_147422_2_ * 16 + l, this.stoneNoise[l + k * 16]);
  260. }
  261. }
  262. }
  263.  
  264. /**
  265. * loads or generates the chunk at the chunk location specified
  266. */
  267. public Chunk loadChunk(int par1, int par2)
  268. {
  269. return this.provideChunk(par1, par2);
  270. }
  271.  
  272. /**
  273. * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
  274. * specified chunk from the map seed and chunk seed
  275. */
  276. public Chunk provideChunk(int par1, int par2)
  277. {
  278. this.rand.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);
  279. Block[] ablock = new Block[65536];
  280. byte[] abyte = new byte[65536];
  281. this.func_147424_a(par1, par2, ablock);
  282. this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16);
  283. this.replaceBlocksForBiome(par1, par2, ablock, abyte, this.biomesForGeneration);
  284. this.caveGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);
  285. this.ravineGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);
  286.  
  287. if (this.mapFeaturesEnabled)
  288. {
  289. this.mineshaftGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);
  290. this.villageGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);
  291. this.strongholdGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);
  292. this.scatteredFeatureGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);
  293. }
  294.  
  295. Chunk chunk = new Chunk(this.worldObj, ablock, abyte, par1, par2);
  296. byte[] abyte1 = chunk.getBiomeArray();
  297.  
  298. for (int k = 0; k < abyte1.length; ++k)
  299. {
  300. abyte1[k] = (byte)this.biomesForGeneration[k].biomeID;
  301. }
  302.  
  303. chunk.generateSkylightMap();
  304. return chunk;
  305. }
  306.  
  307. private void func_147423_a(int p_147423_1_, int p_147423_2_, int p_147423_3_)
  308. {
  309. double d0 = 684.412D;
  310. double d1 = 684.412D;
  311. double d2 = 512.0D;
  312. double d3 = 512.0D;
  313. this.field_147426_g = this.noiseGen6.generateNoiseOctaves(this.field_147426_g, p_147423_1_, p_147423_3_, 5, 5, 200.0D, 200.0D, 0.5D);
  314. this.field_147427_d = this.field_147429_l.generateNoiseOctaves(this.field_147427_d, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, 8.555150000000001D, 4.277575000000001D, 8.555150000000001D);
  315. this.field_147428_e = this.field_147431_j.generateNoiseOctaves(this.field_147428_e, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, 684.412D, 684.412D, 684.412D);
  316. this.field_147425_f = this.field_147432_k.generateNoiseOctaves(this.field_147425_f, p_147423_1_, p_147423_2_, p_147423_3_, 5, 33, 5, 684.412D, 684.412D, 684.412D);
  317. boolean flag1 = false;
  318. boolean flag = false;
  319. int l = 0;
  320. int i1 = 0;
  321. double d4 = 8.5D;
  322.  
  323. for (int j1 = 0; j1 < 5; ++j1)
  324. {
  325. for (int k1 = 0; k1 < 5; ++k1)
  326. {
  327. float f = 0.0F;
  328. float f1 = 0.0F;
  329. float f2 = 0.0F;
  330. byte b0 = 2;
  331. BiomeGenBase biomegenbase = this.biomesForGeneration[j1 + 2 + (k1 + 2) * 10];
  332.  
  333. for (int l1 = -b0; l1 <= b0; ++l1)
  334. {
  335. for (int i2 = -b0; i2 <= b0; ++i2)
  336. {
  337. BiomeGenBase biomegenbase1 = this.biomesForGeneration[j1 + l1 + 2 + (k1 + i2 + 2) * 10];
  338. float f3 = biomegenbase1.rootHeight;
  339. float f4 = biomegenbase1.heightVariation;
  340.  
  341. if (this.field_147435_p == WorldType.AMPLIFIED && f3 > 0.0F)
  342. {
  343. f3 = 1.0F + f3 * 2.0F;
  344. f4 = 1.0F + f4 * 4.0F;
  345. }
  346.  
  347. float f5 = this.parabolicField[l1 + 2 + (i2 + 2) * 5] / (f3 + 2.0F);
  348.  
  349. if (biomegenbase1.rootHeight > biomegenbase.rootHeight)
  350. {
  351. f5 /= 2.0F;
  352. }
  353.  
  354. f += f4 * f5;
  355. f1 += f3 * f5;
  356. f2 += f5;
  357. }
  358. }
  359.  
  360. f /= f2;
  361. f1 /= f2;
  362. f = f * 0.9F + 0.1F;
  363. f1 = (f1 * 4.0F - 1.0F) / 8.0F;
  364. double d12 = this.field_147426_g[i1] / 8000.0D;
  365.  
  366. if (d12 < 0.0D)
  367. {
  368. d12 = -d12 * 0.3D;
  369. }
  370.  
  371. d12 = d12 * 3.0D - 2.0D;
  372.  
  373. if (d12 < 0.0D)
  374. {
  375. d12 /= 2.0D;
  376.  
  377. if (d12 < -1.0D)
  378. {
  379. d12 = -1.0D;
  380. }
  381.  
  382. d12 /= 1.4D;
  383. d12 /= 2.0D;
  384. }
  385. else
  386. {
  387. if (d12 > 1.0D)
  388. {
  389. d12 = 1.0D;
  390. }
  391.  
  392. d12 /= 8.0D;
  393. }
  394.  
  395. ++i1;
  396. double d13 = (double)f1;
  397. double d14 = (double)f;
  398. d13 += d12 * 0.2D;
  399. d13 = d13 * 8.5D / 8.0D;
  400. double d5 = 8.5D + d13 * 4.0D;
  401.  
  402. for (int j2 = 0; j2 < 33; ++j2)
  403. {
  404. double d6 = ((double)j2 - d5) * 12.0D * 128.0D / 256.0D / d14;
  405.  
  406. if (d6 < 0.0D)
  407. {
  408. d6 *= 4.0D;
  409. }
  410.  
  411. double d7 = this.field_147428_e[l] / 512.0D;
  412. double d8 = this.field_147425_f[l] / 512.0D;
  413. double d9 = (this.field_147427_d[l] / 10.0D + 1.0D) / 2.0D;
  414. double d10 = MathHelper.denormalizeClamp(d7, d8, d9) - d6;
  415.  
  416. if (j2 > 29)
  417. {
  418. double d11 = (double)((float)(j2 - 29) / 3.0F);
  419. d10 = d10 * (1.0D - d11) + -10.0D * d11;
  420. }
  421.  
  422. this.field_147434_q[l] = d10;
  423. ++l;
  424. }
  425. }
  426. }
  427. }
  428.  
  429. /**
  430. * Checks to see if a chunk exists at x, y
  431. */
  432. public boolean chunkExists(int par1, int par2)
  433. {
  434. return true;
  435. }
  436.  
  437. /**
  438. * Populates chunk with ores etc etc
  439. */
  440. public void populate(IChunkProvider par1IChunkProvider, int par2, int par3)
  441. {
  442. BlockFalling.fallInstantly = true;
  443. int k = par2 * 16;
  444. int l = par3 * 16;
  445. BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
  446. this.rand.setSeed(this.worldObj.getSeed());
  447. long i1 = this.rand.nextLong() / 2L * 2L + 1L;
  448. long j1 = this.rand.nextLong() / 2L * 2L + 1L;
  449. this.rand.setSeed((long)par2 * i1 + (long)par3 * j1 ^ this.worldObj.getSeed());
  450. boolean flag = false;
  451.  
  452. MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag));
  453.  
  454. if (this.mapFeaturesEnabled)
  455. {
  456. this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
  457. flag = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
  458. this.strongholdGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
  459. this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
  460. }
  461.  
  462. int k1;
  463. int l1;
  464. int i2;
  465.  
  466. if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && !flag && this.rand.nextInt(4) == 0
  467. && TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAKE))
  468. {
  469. k1 = k + this.rand.nextInt(16) + 8;
  470. l1 = this.rand.nextInt(256);
  471. i2 = l + this.rand.nextInt(16) + 8;
  472. (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2);
  473. }
  474.  
  475. if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAVA) && !flag && this.rand.nextInt(8) == 0)
  476. {
  477. k1 = k + this.rand.nextInt(16) + 8;
  478. l1 = this.rand.nextInt(this.rand.nextInt(248) + 8);
  479. i2 = l + this.rand.nextInt(16) + 8;
  480.  
  481. if (l1 < 63 || this.rand.nextInt(10) == 0)
  482. {
  483. (new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, k1, l1, i2);
  484. }
  485. }
  486.  
  487. boolean doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, DUNGEON);
  488. for (k1 = 0; doGen && k1 < 8; ++k1)
  489. {
  490. l1 = k + this.rand.nextInt(16) + 8;
  491. i2 = this.rand.nextInt(256);
  492. int j2 = l + this.rand.nextInt(16) + 8;
  493. (new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2);
  494. }
  495.  
  496. biomegenbase.decorate(this.worldObj, this.rand, k, l);
  497. if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ANIMALS))
  498. {
  499. SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
  500. }
  501. k += 8;
  502. l += 8;
  503.  
  504. doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ICE);
  505. for (k1 = 0; doGen && k1 < 16; ++k1)
  506. {
  507. for (l1 = 0; l1 < 16; ++l1)
  508. {
  509. i2 = this.worldObj.getPrecipitationHeight(k + k1, l + l1);
  510.  
  511. if (this.worldObj.isBlockFreezable(k1 + k, i2 - 1, l1 + l))
  512. {
  513. this.worldObj.setBlock(k1 + k, i2 - 1, l1 + l, Blocks.ice, 0, 2);
  514. }
  515.  
  516. if (this.worldObj.func_147478_e(k1 + k, i2, l1 + l, true))
  517. {
  518. this.worldObj.setBlock(k1 + k, i2, l1 + l, Blocks.snow_layer, 0, 2);
  519. }
  520. }
  521. }
  522.  
  523. MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag));
  524.  
  525. BlockFalling.fallInstantly = false;
  526. }
  527.  
  528. /**
  529. * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks.
  530. * Return true if all chunks have been saved.
  531. */
  532. public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate)
  533. {
  534. return true;
  535. }
  536.  
  537. /**
  538. * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently
  539. * unimplemented.
  540. */
  541. public void saveExtraData() {}
  542.  
  543. /**
  544. * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.
  545. */
  546. public boolean unloadQueuedChunks()
  547. {
  548. return false;
  549. }
  550.  
  551. /**
  552. * Returns if the IChunkProvider supports saving.
  553. */
  554. public boolean canSave()
  555. {
  556. return true;
  557. }
  558.  
  559. /**
  560. * Converts the instance data to a readable string.
  561. */
  562. public String makeString()
  563. {
  564. return "RandomLevelSource";
  565. }
  566.  
  567. /**
  568. * Returns a list of creatures of the specified type that can spawn at the given location.
  569. */
  570. public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4)
  571. {
  572. BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(par2, par4);
  573. return par1EnumCreatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.func_143030_a(par2, par3, par4) ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() : biomegenbase.getSpawnableList(par1EnumCreatureType);
  574. }
  575.  
  576. public ChunkPosition func_147416_a(World p_147416_1_, String p_147416_2_, int p_147416_3_, int p_147416_4_, int p_147416_5_)
  577. {
  578. return "Stronghold".equals(p_147416_2_) && this.strongholdGenerator != null ? this.strongholdGenerator.func_151545_a(p_147416_1_, p_147416_3_, p_147416_4_, p_147416_5_) : null;
  579. }
  580.  
  581. public int getLoadedChunkCount()
  582. {
  583. return 0;
  584. }
  585.  
  586. public void recreateStructures(int par1, int par2)
  587. {
  588. if (this.mapFeaturesEnabled)
  589. {
  590. this.mineshaftGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null);
  591. this.villageGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null);
  592. this.strongholdGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null);
  593. this.scatteredFeatureGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null);
  594. }
  595. }
  596. }
Advertisement
Add Comment
Please, Sign In to add comment