Guest User

Untitled

a guest
May 24th, 2014
225
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.41 KB | None | 0 0
  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. //Set to MEStone for custom stone
  220. p_147424_3_[j3 += short1] = Blocks.stonebrick;
  221. }
  222. else if (k2 * 8 + l2 < b0)
  223. {
  224. p_147424_3_[j3 += short1] = Blocks.water;
  225. }
  226. else
  227. {
  228. p_147424_3_[j3 += short1] = null;
  229. }
  230. }
  231.  
  232. d10 += d12;
  233. d11 += d13;
  234. }
  235.  
  236. d1 += d5;
  237. d2 += d6;
  238. d3 += d7;
  239. d4 += d8;
  240. }
  241. }
  242. }
  243. }
  244. }
  245.  
  246. public void replaceBlocksForBiome(int p_147422_1_, int p_147422_2_, Block[] p_147422_3_, byte[] p_147422_4_, BiomeGenBase[] p_147422_5_)
  247. {
  248. ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_147422_1_, p_147422_2_, p_147422_3_, p_147422_4_, p_147422_5_);
  249. MinecraftForge.EVENT_BUS.post(event);
  250. if (event.getResult() == Result.DENY) return;
  251.  
  252. double d0 = 0.03125D;
  253. 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);
  254.  
  255. for (int k = 0; k < 16; ++k)
  256. {
  257. for (int l = 0; l < 16; ++l)
  258. {
  259. BiomeGenBase biomegenbase = p_147422_5_[l + k * 16];
  260. 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]);
  261. }
  262. }
  263. }
  264.  
  265. /**
  266. * loads or generates the chunk at the chunk location specified
  267. */
  268. public Chunk loadChunk(int par1, int par2)
  269. {
  270. return this.provideChunk(par1, par2);
  271. }
  272.  
  273. /**
  274. * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
  275. * specified chunk from the map seed and chunk seed
  276. */
  277. public Chunk provideChunk(int par1, int par2)
  278. {
  279. this.rand.setSeed((long)par1 * 341873128712L + (long)par2 * 132897987541L);
  280. Block[] ablock = new Block[65536];
  281. byte[] abyte = new byte[65536];
  282. this.func_147424_a(par1, par2, ablock);
  283. this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, par1 * 16, par2 * 16, 16, 16);
  284. this.replaceBlocksForBiome(par1, par2, ablock, abyte, this.biomesForGeneration);
  285. this.caveGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);
  286. this.ravineGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);
  287.  
  288. if (this.mapFeaturesEnabled)
  289. {
  290. this.mineshaftGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);
  291. this.villageGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);
  292. this.strongholdGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);
  293. this.scatteredFeatureGenerator.func_151539_a(this, this.worldObj, par1, par2, ablock);
  294. }
  295.  
  296. Chunk chunk = new Chunk(this.worldObj, ablock, abyte, par1, par2);
  297. byte[] abyte1 = chunk.getBiomeArray();
  298.  
  299. for (int k = 0; k < abyte1.length; ++k)
  300. {
  301. abyte1[k] = (byte)this.biomesForGeneration[k].biomeID;
  302. }
  303.  
  304. chunk.generateSkylightMap();
  305. return chunk;
  306. }
  307.  
  308. private void func_147423_a(int p_147423_1_, int p_147423_2_, int p_147423_3_)
  309. {
  310. double d0 = 684.412D;
  311. double d1 = 684.412D;
  312. double d2 = 512.0D;
  313. double d3 = 512.0D;
  314. 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);
  315. 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);
  316. 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);
  317. 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);
  318. boolean flag1 = false;
  319. boolean flag = false;
  320. int l = 0;
  321. int i1 = 0;
  322. double d4 = 8.5D;
  323.  
  324. for (int j1 = 0; j1 < 5; ++j1)
  325. {
  326. for (int k1 = 0; k1 < 5; ++k1)
  327. {
  328. float f = 0.0F;
  329. float f1 = 0.0F;
  330. float f2 = 0.0F;
  331. byte b0 = 2;
  332. BiomeGenBase biomegenbase = this.biomesForGeneration[j1 + 2 + (k1 + 2) * 10];
  333.  
  334. for (int l1 = -b0; l1 <= b0; ++l1)
  335. {
  336. for (int i2 = -b0; i2 <= b0; ++i2)
  337. {
  338. BiomeGenBase biomegenbase1 = this.biomesForGeneration[j1 + l1 + 2 + (k1 + i2 + 2) * 10];
  339. float f3 = biomegenbase1.rootHeight;
  340. float f4 = biomegenbase1.heightVariation;
  341.  
  342. if (this.field_147435_p == WorldType.AMPLIFIED && f3 > 0.0F)
  343. {
  344. f3 = 1.0F + f3 * 2.0F;
  345. f4 = 1.0F + f4 * 4.0F;
  346. }
  347.  
  348. float f5 = this.parabolicField[l1 + 2 + (i2 + 2) * 5] / (f3 + 2.0F);
  349.  
  350. if (biomegenbase1.rootHeight > biomegenbase.rootHeight)
  351. {
  352. f5 /= 2.0F;
  353. }
  354.  
  355. f += f4 * f5;
  356. f1 += f3 * f5;
  357. f2 += f5;
  358. }
  359. }
  360.  
  361. f /= f2;
  362. f1 /= f2;
  363. f = f * 0.9F + 0.1F;
  364. f1 = (f1 * 4.0F - 1.0F) / 8.0F;
  365. double d12 = this.field_147426_g[i1] / 8000.0D;
  366.  
  367. if (d12 < 0.0D)
  368. {
  369. d12 = -d12 * 0.3D;
  370. }
  371.  
  372. d12 = d12 * 3.0D - 2.0D;
  373.  
  374. if (d12 < 0.0D)
  375. {
  376. d12 /= 2.0D;
  377.  
  378. if (d12 < -1.0D)
  379. {
  380. d12 = -1.0D;
  381. }
  382.  
  383. d12 /= 1.4D;
  384. d12 /= 2.0D;
  385. }
  386. else
  387. {
  388. if (d12 > 1.0D)
  389. {
  390. d12 = 1.0D;
  391. }
  392.  
  393. d12 /= 8.0D;
  394. }
  395.  
  396. ++i1;
  397. double d13 = (double)f1;
  398. double d14 = (double)f;
  399. d13 += d12 * 0.2D;
  400. d13 = d13 * 8.5D / 8.0D;
  401. double d5 = 8.5D + d13 * 4.0D;
  402.  
  403. for (int j2 = 0; j2 < 33; ++j2)
  404. {
  405. double d6 = ((double)j2 - d5) * 12.0D * 128.0D / 256.0D / d14;
  406.  
  407. if (d6 < 0.0D)
  408. {
  409. d6 *= 4.0D;
  410. }
  411.  
  412. double d7 = this.field_147428_e[l] / 512.0D;
  413. double d8 = this.field_147425_f[l] / 512.0D;
  414. double d9 = (this.field_147427_d[l] / 10.0D + 1.0D) / 2.0D;
  415. double d10 = MathHelper.denormalizeClamp(d7, d8, d9) - d6;
  416.  
  417. if (j2 > 29)
  418. {
  419. double d11 = (double)((float)(j2 - 29) / 3.0F);
  420. d10 = d10 * (1.0D - d11) + -10.0D * d11;
  421. }
  422.  
  423. this.field_147434_q[l] = d10;
  424. ++l;
  425. }
  426. }
  427. }
  428. }
  429.  
  430. /**
  431. * Checks to see if a chunk exists at x, y
  432. */
  433. public boolean chunkExists(int par1, int par2)
  434. {
  435. return true;
  436. }
  437.  
  438. /**
  439. * Populates chunk with ores etc etc
  440. */
  441. public void populate(IChunkProvider par1IChunkProvider, int par2, int par3)
  442. {
  443. BlockFalling.fallInstantly = true;
  444. int k = par2 * 16;
  445. int l = par3 * 16;
  446. BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(k + 16, l + 16);
  447. this.rand.setSeed(this.worldObj.getSeed());
  448. long i1 = this.rand.nextLong() / 2L * 2L + 1L;
  449. long j1 = this.rand.nextLong() / 2L * 2L + 1L;
  450. this.rand.setSeed((long)par2 * i1 + (long)par3 * j1 ^ this.worldObj.getSeed());
  451. boolean flag = false;
  452.  
  453. MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(par1IChunkProvider, worldObj, rand, par2, par3, flag));
  454.  
  455. if (this.mapFeaturesEnabled)
  456. {
  457. this.mineshaftGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
  458. flag = this.villageGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
  459. this.strongholdGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
  460. this.scatteredFeatureGenerator.generateStructuresInChunk(this.worldObj, this.rand, par2, par3);
  461. }
  462.  
  463. int k1;
  464. int l1;
  465. int i2;
  466.  
  467. if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && !flag && this.rand.nextInt(4) == 0
  468. && TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAKE))
  469. {
  470. k1 = k + this.rand.nextInt(16) + 8;
  471. l1 = this.rand.nextInt(256);
  472. i2 = l + this.rand.nextInt(16) + 8;
  473. (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, k1, l1, i2);
  474. }
  475.  
  476. if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, LAVA) && !flag && this.rand.nextInt(8) == 0)
  477. {
  478. k1 = k + this.rand.nextInt(16) + 8;
  479. l1 = this.rand.nextInt(this.rand.nextInt(248) + 8);
  480. i2 = l + this.rand.nextInt(16) + 8;
  481.  
  482. if (l1 < 63 || this.rand.nextInt(10) == 0)
  483. {
  484. (new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, k1, l1, i2);
  485. }
  486. }
  487.  
  488. boolean doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, DUNGEON);
  489. for (k1 = 0; doGen && k1 < 8; ++k1)
  490. {
  491. l1 = k + this.rand.nextInt(16) + 8;
  492. i2 = this.rand.nextInt(256);
  493. int j2 = l + this.rand.nextInt(16) + 8;
  494. (new WorldGenDungeons()).generate(this.worldObj, this.rand, l1, i2, j2);
  495. }
  496.  
  497. biomegenbase.decorate(this.worldObj, this.rand, k, l);
  498. if (TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ANIMALS))
  499. {
  500. SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, k + 8, l + 8, 16, 16, this.rand);
  501. }
  502. k += 8;
  503. l += 8;
  504.  
  505. doGen = TerrainGen.populate(par1IChunkProvider, worldObj, rand, par2, par3, flag, ICE);
  506. for (k1 = 0; doGen && k1 < 16; ++k1)
  507. {
  508. for (l1 = 0; l1 < 16; ++l1)
  509. {
  510. i2 = this.worldObj.getPrecipitationHeight(k + k1, l + l1);
  511.  
  512. if (this.worldObj.isBlockFreezable(k1 + k, i2 - 1, l1 + l))
  513. {
  514. this.worldObj.setBlock(k1 + k, i2 - 1, l1 + l, Blocks.ice, 0, 2);
  515. }
  516.  
  517. if (this.worldObj.func_147478_e(k1 + k, i2, l1 + l, true))
  518. {
  519. this.worldObj.setBlock(k1 + k, i2, l1 + l, Blocks.snow_layer, 0, 2);
  520. }
  521. }
  522. }
  523.  
  524. MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(par1IChunkProvider, worldObj, rand, par2, par3, flag));
  525.  
  526. BlockFalling.fallInstantly = false;
  527. }
  528.  
  529. /**
  530. * Two modes of operation: if passed true, save all Chunks in one go. If passed false, save up to two chunks.
  531. * Return true if all chunks have been saved.
  532. */
  533. public boolean saveChunks(boolean par1, IProgressUpdate par2IProgressUpdate)
  534. {
  535. return true;
  536. }
  537.  
  538. /**
  539. * Save extra data not associated with any Chunk. Not saved during autosave, only during world unload. Currently
  540. * unimplemented.
  541. */
  542. public void saveExtraData() {}
  543.  
  544. /**
  545. * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.
  546. */
  547. public boolean unloadQueuedChunks()
  548. {
  549. return false;
  550. }
  551.  
  552. /**
  553. * Returns if the IChunkProvider supports saving.
  554. */
  555. public boolean canSave()
  556. {
  557. return true;
  558. }
  559.  
  560. /**
  561. * Converts the instance data to a readable string.
  562. */
  563. public String makeString()
  564. {
  565. return "RandomLevelSource";
  566. }
  567.  
  568. /**
  569. * Returns a list of creatures of the specified type that can spawn at the given location.
  570. */
  571. public List getPossibleCreatures(EnumCreatureType par1EnumCreatureType, int par2, int par3, int par4)
  572. {
  573. BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(par2, par4);
  574. return par1EnumCreatureType == EnumCreatureType.monster && this.scatteredFeatureGenerator.func_143030_a(par2, par3, par4) ? this.scatteredFeatureGenerator.getScatteredFeatureSpawnList() : biomegenbase.getSpawnableList(par1EnumCreatureType);
  575. }
  576.  
  577. 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_)
  578. {
  579. 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;
  580. }
  581.  
  582. public int getLoadedChunkCount()
  583. {
  584. return 0;
  585. }
  586.  
  587. public void recreateStructures(int par1, int par2)
  588. {
  589. if (this.mapFeaturesEnabled)
  590. {
  591. this.mineshaftGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null);
  592. this.villageGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null);
  593. this.strongholdGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null);
  594. this.scatteredFeatureGenerator.func_151539_a(this, this.worldObj, par1, par2, (Block[])null);
  595. }
  596. }
  597. }
Advertisement
Add Comment
Please, Sign In to add comment