Advertisement
Guest User

CustomChunkProvider

a guest
Jul 23rd, 2015
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.57 KB | None | 0 0
  1. package com.yakman3.mod.dimension;
  2.  
  3. import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.CAVE;
  4. import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.MINESHAFT;
  5. import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.RAVINE;
  6. import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.SCATTERED_FEATURE;
  7. import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.STRONGHOLD;
  8. import static net.minecraftforge.event.terraingen.InitMapGenEvent.EventType.VILLAGE;
  9. import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ANIMALS;
  10. import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.DUNGEON;
  11. import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.ICE;
  12. import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAKE;
  13. import static net.minecraftforge.event.terraingen.PopulateChunkEvent.Populate.EventType.LAVA;
  14.  
  15. import java.util.List;
  16. import java.util.Random;
  17.  
  18. import net.minecraft.block.Block;
  19. import net.minecraft.block.BlockFalling;
  20. import net.minecraft.entity.EnumCreatureType;
  21. import net.minecraft.init.Blocks;
  22. import net.minecraft.util.BlockPos;
  23. import net.minecraft.util.IProgressUpdate;
  24. import net.minecraft.util.MathHelper;
  25. import net.minecraft.world.ChunkCoordIntPair;
  26. import net.minecraft.world.SpawnerAnimals;
  27. import net.minecraft.world.World;
  28. import net.minecraft.world.WorldType;
  29. import net.minecraft.world.biome.BiomeGenBase;
  30. import net.minecraft.world.chunk.Chunk;
  31. import net.minecraft.world.chunk.ChunkPrimer;
  32. import net.minecraft.world.chunk.IChunkProvider;
  33. import net.minecraft.world.gen.ChunkProviderSettings;
  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.MapGenMineshaft;
  43. import net.minecraft.world.gen.structure.MapGenScatteredFeature;
  44. import net.minecraft.world.gen.structure.MapGenStronghold;
  45. import net.minecraft.world.gen.structure.MapGenVillage;
  46. import net.minecraft.world.gen.structure.StructureOceanMonument;
  47. import net.minecraftforge.common.MinecraftForge;
  48. import net.minecraftforge.event.terraingen.ChunkProviderEvent;
  49. import net.minecraftforge.event.terraingen.PopulateChunkEvent;
  50. import net.minecraftforge.event.terraingen.TerrainGen;
  51. import net.minecraftforge.fml.common.eventhandler.Event.Result;
  52.  
  53. public class CustomChunkProvider implements IChunkProvider
  54. {
  55. private Random rand;
  56. private NoiseGeneratorOctaves field_147431_j;
  57. private NoiseGeneratorOctaves field_147432_k;
  58. private NoiseGeneratorOctaves field_147429_l;
  59. private NoiseGeneratorPerlin field_147430_m;
  60. public NoiseGeneratorOctaves noiseGen5;
  61. public NoiseGeneratorOctaves noiseGen6;
  62. public NoiseGeneratorOctaves mobSpawnerNoise;
  63. private World worldObj;
  64. private final boolean mapFeaturesEnabled;
  65. private WorldType field_177475_o;
  66. private final double[] field_147434_q;
  67. private final float[] parabolicField;
  68. private ChunkProviderSettings settings;
  69. private Block field_177476_s;
  70. private double[] stoneNoise;
  71. private MapGenBase caveGenerator;
  72. private MapGenStronghold strongholdGenerator;
  73. private MapGenVillage villageGenerator;
  74. private MapGenMineshaft mineshaftGenerator;
  75. private MapGenScatteredFeature scatteredFeatureGenerator;
  76. private MapGenBase ravineGenerator;
  77. private StructureOceanMonument oceanMonumentGenerator;
  78. private BiomeGenBase[] biomesForGeneration;
  79. double[] field_147427_d;
  80. double[] field_147428_e;
  81. double[] field_147425_f;
  82. double[] field_147426_g;
  83. private static final String __OBFID = "CL_00000396";
  84.  
  85. {
  86. caveGenerator = TerrainGen.getModdedMapGen(caveGenerator, CAVE);
  87. strongholdGenerator = (MapGenStronghold) TerrainGen.getModdedMapGen(strongholdGenerator, STRONGHOLD);
  88. villageGenerator = (MapGenVillage) TerrainGen.getModdedMapGen(villageGenerator, VILLAGE);
  89. mineshaftGenerator = (MapGenMineshaft) TerrainGen.getModdedMapGen(mineshaftGenerator, MINESHAFT);
  90. scatteredFeatureGenerator = (MapGenScatteredFeature) TerrainGen.getModdedMapGen(scatteredFeatureGenerator, SCATTERED_FEATURE);
  91. ravineGenerator = TerrainGen.getModdedMapGen(ravineGenerator, RAVINE);
  92. }
  93.  
  94. public CustomChunkProvider(World worldIn, long p_i45636_2_, boolean p_i45636_4_, String p_i45636_5_)
  95. {
  96. this.field_177476_s = Blocks.water;
  97. this.stoneNoise = new double[256];
  98. this.caveGenerator = new MapGenCaves();
  99. this.strongholdGenerator = new MapGenStronghold();
  100. this.villageGenerator = new MapGenVillage();
  101. this.mineshaftGenerator = new MapGenMineshaft();
  102. this.scatteredFeatureGenerator = new MapGenScatteredFeature();
  103. this.ravineGenerator = new MapGenRavine();
  104. this.oceanMonumentGenerator = new StructureOceanMonument();
  105. this.worldObj = worldIn;
  106. this.mapFeaturesEnabled = p_i45636_4_;
  107. this.field_177475_o = worldIn.getWorldInfo().getTerrainType();
  108. this.rand = new Random(p_i45636_2_);
  109. this.field_147431_j = new NoiseGeneratorOctaves(this.rand, 16);
  110. this.field_147432_k = new NoiseGeneratorOctaves(this.rand, 16);
  111. this.field_147429_l = new NoiseGeneratorOctaves(this.rand, 8);
  112. this.field_147430_m = new NoiseGeneratorPerlin(this.rand, 4);
  113. this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10);
  114. this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16);
  115. this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8);
  116. this.field_147434_q = new double[825];
  117. this.parabolicField = new float[25];
  118.  
  119. for (int j = -2; j <= 2; ++j)
  120. {
  121. for (int k = -2; k <= 2; ++k)
  122. {
  123. float f = 10.0F / MathHelper.sqrt_float((float)(j * j + k * k) + 0.2F);
  124. this.parabolicField[j + 2 + (k + 2) * 5] = f;
  125. }
  126. }
  127.  
  128. if (p_i45636_5_ != null)
  129. {
  130. this.settings = ChunkProviderSettings.Factory.func_177865_a(p_i45636_5_).func_177864_b();
  131. this.field_177476_s = this.settings.useLavaOceans ? Blocks.lava : Blocks.water;
  132. }
  133.  
  134. NoiseGenerator[] noiseGens = {field_147431_j, field_147432_k, field_147429_l, field_147430_m, noiseGen5, noiseGen6, mobSpawnerNoise};
  135. noiseGens = TerrainGen.getModdedNoiseGenerators(worldIn, this.rand, noiseGens);
  136. this.field_147431_j = (NoiseGeneratorOctaves)noiseGens[0];
  137. this.field_147432_k = (NoiseGeneratorOctaves)noiseGens[1];
  138. this.field_147429_l = (NoiseGeneratorOctaves)noiseGens[2];
  139. this.field_147430_m = (NoiseGeneratorPerlin)noiseGens[3];
  140. this.noiseGen5 = (NoiseGeneratorOctaves)noiseGens[4];
  141. this.noiseGen6 = (NoiseGeneratorOctaves)noiseGens[5];
  142. this.mobSpawnerNoise = (NoiseGeneratorOctaves)noiseGens[6];
  143. }
  144.  
  145. public void setBlocksInChunk(int p_180518_1_, int p_180518_2_, ChunkPrimer p_180518_3_)
  146. {
  147. this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, p_180518_2_ * 4 - 2, p_180518_2_ * 4 - 2, 10, 10);
  148. this.func_147423_a(p_180518_2_ * 4, 0, p_180518_2_ * 4);
  149.  
  150. for (int k = 0; k < 4; ++k)
  151. {
  152. int l = k * 5;
  153. int i1 = (k + 1) * 5;
  154.  
  155. for (int j1 = 0; j1 < 4; ++j1)
  156. {
  157. int k1 = (l + j1) * 33;
  158. int l1 = (l + j1 + 1) * 33;
  159. int i2 = (i1 + j1) * 33;
  160. int j2 = (i1 + j1 + 1) * 33;
  161.  
  162. for (int k2 = 0; k2 < 32; ++k2)
  163. {
  164. double d0 = 0.125D;
  165. double d1 = this.field_147434_q[k1 + k2];
  166. double d2 = this.field_147434_q[l1 + k2];
  167. double d3 = this.field_147434_q[i2 + k2];
  168. double d4 = this.field_147434_q[j2 + k2];
  169. double d5 = (this.field_147434_q[k1 + k2 + 1] - d1) * d0;
  170. double d6 = (this.field_147434_q[l1 + k2 + 1] - d2) * d0;
  171. double d7 = (this.field_147434_q[i2 + k2 + 1] - d3) * d0;
  172. double d8 = (this.field_147434_q[j2 + k2 + 1] - d4) * d0;
  173.  
  174. for (int l2 = 0; l2 < 8; ++l2)
  175. {
  176. double d9 = 0.25D;
  177. double d10 = d1;
  178. double d11 = d2;
  179. double d12 = (d3 - d1) * d9;
  180. double d13 = (d4 - d2) * d9;
  181.  
  182. for (int i3 = 0; i3 < 4; ++i3)
  183. {
  184. double d14 = 0.25D;
  185. double d16 = (d11 - d10) * d14;
  186. double d15 = d10 - d16;
  187.  
  188. for (int j3 = 0; j3 < 4; ++j3)
  189. {
  190. if ((d15 += d16) > 0.0D)
  191. {
  192. p_180518_3_.setBlockState(k * 4 + i3, k2 * 8 + l2, j1 * 4 + j3, Blocks.stone.getDefaultState());
  193. }
  194. else if (k2 * 8 + l2 < this.settings.seaLevel)
  195. {
  196. p_180518_3_.setBlockState(k * 4 + i3, k2 * 8 + l2, j1 * 4 + j3, this.field_177476_s.getDefaultState());
  197. }
  198. }
  199.  
  200. d10 += d12;
  201. d11 += d13;
  202. }
  203.  
  204. d1 += d5;
  205. d2 += d6;
  206. d3 += d7;
  207. d4 += d8;
  208. }
  209. }
  210. }
  211. }
  212. }
  213.  
  214. public void func_180517_a(int p_180517_1_, int p_180517_2_, ChunkPrimer p_180517_3_, BiomeGenBase[] p_180517_4_)
  215. {
  216. ChunkProviderEvent.ReplaceBiomeBlocks event = new ChunkProviderEvent.ReplaceBiomeBlocks(this, p_180517_1_, p_180517_2_, p_180517_3_, this.worldObj);
  217. MinecraftForge.EVENT_BUS.post(event);
  218. if (event.getResult() == Result.DENY) return;
  219.  
  220. double d0 = 0.03125D;
  221. this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(p_180517_1_ * 16), (double)(p_180517_2_ * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);
  222.  
  223. for (int k = 0; k < 16; ++k)
  224. {
  225. for (int l = 0; l < 16; ++l)
  226. {
  227. BiomeGenBase biomegenbase = p_180517_4_[l + k * 16];
  228. biomegenbase.genTerrainBlocks(this.worldObj, this.rand, p_180517_3_, p_180517_1_ * 16 + k, p_180517_2_ * 16 + l, this.stoneNoise[l + k * 16]);
  229. }
  230. }
  231. }
  232.  
  233. public Chunk provideChunk(int x, int z)
  234. {
  235. this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
  236. ChunkPrimer chunkprimer = new ChunkPrimer();
  237. this.setBlocksInChunk(x, z, chunkprimer);
  238. this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16);
  239. this.func_180517_a(x, z, chunkprimer, this.biomesForGeneration);
  240.  
  241.  
  242.  
  243. if (this.settings.useRavines)
  244. {
  245. this.ravineGenerator.func_175792_a(this, this.worldObj, x, z, chunkprimer);
  246. }
  247.  
  248. if (this.settings.useMineShafts && this.mapFeaturesEnabled)
  249. {
  250. this.mineshaftGenerator.func_175792_a(this, this.worldObj, x, z, chunkprimer);
  251. }
  252.  
  253.  
  254.  
  255.  
  256. if (this.settings.useTemples && this.mapFeaturesEnabled)
  257. {
  258. this.scatteredFeatureGenerator.func_175792_a(this, this.worldObj, x, z, chunkprimer);
  259. }
  260.  
  261. if (this.settings.useMonuments && this.mapFeaturesEnabled)
  262. {
  263. this.oceanMonumentGenerator.func_175792_a(this, this.worldObj, x, z, chunkprimer);
  264. }
  265.  
  266. Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
  267. byte[] abyte = chunk.getBiomeArray();
  268.  
  269. for (int k = 0; k < abyte.length; ++k)
  270. {
  271. abyte[k] = (byte)this.biomesForGeneration[k].biomeID;
  272. }
  273.  
  274. chunk.generateSkylightMap();
  275. return chunk;
  276. }
  277.  
  278. private void func_147423_a(int p_147423_1_, int p_147423_2_, int p_147423_3_)
  279. {
  280. this.field_147426_g = this.noiseGen6.generateNoiseOctaves(this.field_147426_g, p_147423_1_, p_147423_3_, 5, 5, (double)this.settings.depthNoiseScaleX, (double)this.settings.depthNoiseScaleZ, (double)this.settings.depthNoiseScaleExponent);
  281. float f = this.settings.coordinateScale;
  282. float f1 = this.settings.heightScale;
  283. 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, (double)(f / this.settings.mainNoiseScaleX), (double)(f1 / this.settings.mainNoiseScaleY), (double)(f / this.settings.mainNoiseScaleZ));
  284. 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, (double)f, (double)f1, (double)f);
  285. 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, (double)f, (double)f1, (double)f);
  286. boolean flag1 = false;
  287. boolean flag = false;
  288. int l = 0;
  289. int i1 = 0;
  290.  
  291. for (int j1 = 0; j1 < 5; ++j1)
  292. {
  293. for (int k1 = 0; k1 < 5; ++k1)
  294. {
  295. float f2 = 0.0F;
  296. float f3 = 0.0F;
  297. float f4 = 0.0F;
  298. byte b0 = 2;
  299. BiomeGenBase biomegenbase = this.biomesForGeneration[j1 + 2 + (k1 + 2) * 10];
  300.  
  301. for (int l1 = -b0; l1 <= b0; ++l1)
  302. {
  303. for (int i2 = -b0; i2 <= b0; ++i2)
  304. {
  305. BiomeGenBase biomegenbase1 = this.biomesForGeneration[j1 + l1 + 2 + (k1 + i2 + 2) * 10];
  306. float f5 = this.settings.biomeDepthOffSet + biomegenbase1.minHeight * this.settings.biomeDepthWeight;
  307. float f6 = this.settings.biomeScaleOffset + biomegenbase1.maxHeight * this.settings.biomeScaleWeight;
  308.  
  309. if (this.field_177475_o == WorldType.AMPLIFIED && f5 > 0.0F)
  310. {
  311. f5 = 1.0F + f5 * 2.0F;
  312. f6 = 1.0F + f6 * 4.0F;
  313. }
  314.  
  315. float f7 = this.parabolicField[l1 + 2 + (i2 + 2) * 5] / (f5 + 2.0F);
  316.  
  317. if (biomegenbase1.minHeight > biomegenbase.minHeight)
  318. {
  319. f7 /= 2.0F;
  320. }
  321.  
  322. f2 += f6 * f7;
  323. f3 += f5 * f7;
  324. f4 += f7;
  325. }
  326. }
  327.  
  328. f2 /= f4;
  329. f3 /= f4;
  330. f2 = f2 * 0.9F + 0.1F;
  331. f3 = (f3 * 4.0F - 1.0F) / 8.0F;
  332. double d7 = this.field_147426_g[i1] / 8000.0D;
  333.  
  334. if (d7 < 0.0D)
  335. {
  336. d7 = -d7 * 0.3D;
  337. }
  338.  
  339. d7 = d7 * 3.0D - 2.0D;
  340.  
  341. if (d7 < 0.0D)
  342. {
  343. d7 /= 2.0D;
  344.  
  345. if (d7 < -1.0D)
  346. {
  347. d7 = -1.0D;
  348. }
  349.  
  350. d7 /= 1.4D;
  351. d7 /= 2.0D;
  352. }
  353. else
  354. {
  355. if (d7 > 1.0D)
  356. {
  357. d7 = 1.0D;
  358. }
  359.  
  360. d7 /= 8.0D;
  361. }
  362.  
  363. ++i1;
  364. double d8 = (double)f3;
  365. double d9 = (double)f2;
  366. d8 += d7 * 0.2D;
  367. d8 = d8 * (double)this.settings.baseSize / 8.0D;
  368. double d0 = (double)this.settings.baseSize + d8 * 4.0D;
  369.  
  370. for (int j2 = 0; j2 < 33; ++j2)
  371. {
  372. double d1 = ((double)j2 - d0) * (double)this.settings.stretchY * 128.0D / 256.0D / d9;
  373.  
  374. if (d1 < 0.0D)
  375. {
  376. d1 *= 4.0D;
  377. }
  378.  
  379. double d2 = this.field_147428_e[l] / (double)this.settings.lowerLimitScale;
  380. double d3 = this.field_147425_f[l] / (double)this.settings.upperLimitScale;
  381. double d4 = (this.field_147427_d[l] / 10.0D + 1.0D) / 2.0D;
  382. double d5 = MathHelper.denormalizeClamp(d2, d3, d4) - d1;
  383.  
  384. if (j2 > 29)
  385. {
  386. double d6 = (double)((float)(j2 - 29) / 3.0F);
  387. d5 = d5 * (1.0D - d6) + -10.0D * d6;
  388. }
  389.  
  390. this.field_147434_q[l] = d5;
  391. ++l;
  392. }
  393. }
  394. }
  395. }
  396.  
  397. public boolean chunkExists(int x, int z)
  398. {
  399. return true;
  400. }
  401.  
  402. public void populate(IChunkProvider p_73153_1_, int p_73153_2_, int p_73153_3_)
  403. {
  404. BlockFalling.fallInstantly = true;
  405. int k = p_73153_2_ * 16;
  406. int l = p_73153_3_ * 16;
  407. BlockPos blockpos = new BlockPos(k, 0, l);
  408. BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos.add(16, 0, 16));
  409. this.rand.setSeed(this.worldObj.getSeed());
  410. long i1 = this.rand.nextLong() / 2L * 2L + 1L;
  411. long j1 = this.rand.nextLong() / 2L * 2L + 1L;
  412. this.rand.setSeed((long)p_73153_2_ * i1 + (long)p_73153_3_ * j1 ^ this.worldObj.getSeed());
  413. boolean flag = false;
  414. ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(p_73153_2_, p_73153_3_);
  415.  
  416. MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Pre(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag));
  417.  
  418. if (this.settings.useMineShafts && this.mapFeaturesEnabled)
  419. {
  420. this.mineshaftGenerator.func_175794_a(this.worldObj, this.rand, chunkcoordintpair);
  421. }
  422.  
  423.  
  424.  
  425.  
  426.  
  427.  
  428.  
  429. int k1;
  430. int l1;
  431. int i2;
  432.  
  433. if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0
  434. && TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAKE))
  435. {
  436. k1 = this.rand.nextInt(16) + 8;
  437. l1 = this.rand.nextInt(256);
  438. i2 = this.rand.nextInt(16) + 8;
  439. (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, blockpos.add(k1, l1, i2));
  440. }
  441.  
  442. if (TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, LAVA) && !flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes)
  443. {
  444. k1 = this.rand.nextInt(16) + 8;
  445. l1 = this.rand.nextInt(this.rand.nextInt(248) + 8);
  446. i2 = this.rand.nextInt(16) + 8;
  447.  
  448. if (l1 < 63 || this.rand.nextInt(this.settings.lavaLakeChance / 8) == 0)
  449. {
  450. (new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, blockpos.add(k1, l1, i2));
  451. }
  452. }
  453.  
  454. if (this.settings.useDungeons)
  455. {
  456. boolean doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, DUNGEON);
  457. for (k1 = 0; doGen && k1 < this.settings.dungeonChance; ++k1)
  458. {
  459. l1 = this.rand.nextInt(16) + 8;
  460. i2 = this.rand.nextInt(256);
  461. int j2 = this.rand.nextInt(16) + 8;
  462. (new WorldGenDungeons()).generate(this.worldObj, this.rand, blockpos.add(l1, i2, j2));
  463. }
  464. }
  465.  
  466. biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(k, 0, l));
  467.  
  468. blockpos = blockpos.add(8, 0, 8);
  469.  
  470. boolean doGen = TerrainGen.populate(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag, ICE);
  471. for (k1 = 0; doGen && k1 < 16; ++k1)
  472. {
  473. for (l1 = 0; l1 < 16; ++l1)
  474. {
  475. BlockPos blockpos1 = this.worldObj.getPrecipitationHeight(blockpos.add(k1, 0, l1));
  476. BlockPos blockpos2 = blockpos1.down();
  477.  
  478. if (this.worldObj.func_175675_v(blockpos2))
  479. {
  480. this.worldObj.setBlockState(blockpos2, Blocks.ice.getDefaultState(), 2);
  481. }
  482.  
  483. if (this.worldObj.canSnowAt(blockpos1, true))
  484. {
  485. this.worldObj.setBlockState(blockpos1, Blocks.snow_layer.getDefaultState(), 2);
  486. }
  487. }
  488. }
  489.  
  490. MinecraftForge.EVENT_BUS.post(new PopulateChunkEvent.Post(p_73153_1_, worldObj, rand, p_73153_2_, p_73153_3_, flag));
  491.  
  492. BlockFalling.fallInstantly = false;
  493. }
  494.  
  495. public boolean func_177460_a(IChunkProvider p_177460_1_, Chunk p_177460_2_, int p_177460_3_, int p_177460_4_)
  496. {
  497. boolean flag = false;
  498.  
  499. if (this.settings.useMonuments && this.mapFeaturesEnabled && p_177460_2_.getInhabitedTime() < 3600L)
  500. {
  501. flag |= this.oceanMonumentGenerator.func_175794_a(this.worldObj, this.rand, new ChunkCoordIntPair(p_177460_3_, p_177460_4_));
  502. }
  503.  
  504. return flag;
  505. }
  506.  
  507. public boolean saveChunks(boolean p_73151_1_, IProgressUpdate p_73151_2_)
  508. {
  509. return true;
  510. }
  511.  
  512. public void saveExtraData() {}
  513.  
  514. public boolean unloadQueuedChunks()
  515. {
  516. return false;
  517. }
  518.  
  519. public boolean canSave()
  520. {
  521. return true;
  522. }
  523.  
  524. public String makeString()
  525. {
  526. return "RandomLevelSource";
  527. }
  528.  
  529. public List func_177458_a(EnumCreatureType p_177458_1_, BlockPos p_177458_2_)
  530. {
  531. BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(p_177458_2_);
  532.  
  533. if (this.mapFeaturesEnabled)
  534. {
  535. if (p_177458_1_ == EnumCreatureType.MONSTER && this.scatteredFeatureGenerator.func_175798_a(p_177458_2_))
  536. {
  537. return this.scatteredFeatureGenerator.getScatteredFeatureSpawnList();
  538. }
  539.  
  540. if (p_177458_1_ == EnumCreatureType.MONSTER && this.settings.useMonuments && this.oceanMonumentGenerator.func_175796_a(this.worldObj, p_177458_2_))
  541. {
  542. return this.oceanMonumentGenerator.func_175799_b();
  543. }
  544. }
  545.  
  546. return biomegenbase.getSpawnableList(p_177458_1_);
  547. }
  548.  
  549. public BlockPos getStrongholdGen(World worldIn, String p_180513_2_, BlockPos p_180513_3_)
  550. {
  551. return "Stronghold".equals(p_180513_2_) && this.strongholdGenerator != null ? this.strongholdGenerator.getClosestStrongholdPos(worldIn, p_180513_3_) : null;
  552. }
  553.  
  554. public int getLoadedChunkCount()
  555. {
  556. return 0;
  557. }
  558.  
  559. public void recreateStructures(Chunk p_180514_1_, int p_180514_2_, int p_180514_3_)
  560. {
  561. if (this.settings.useMineShafts && this.mapFeaturesEnabled)
  562. {
  563. this.mineshaftGenerator.func_175792_a(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
  564. }
  565.  
  566. if (this.settings.useVillages && this.mapFeaturesEnabled)
  567. {
  568. this.villageGenerator.func_175792_a(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
  569. }
  570.  
  571. if (this.settings.useStrongholds && this.mapFeaturesEnabled)
  572. {
  573. this.strongholdGenerator.func_175792_a(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
  574. }
  575.  
  576. if (this.settings.useTemples && this.mapFeaturesEnabled)
  577. {
  578. this.scatteredFeatureGenerator.func_175792_a(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
  579. }
  580.  
  581. if (this.settings.useMonuments && this.mapFeaturesEnabled)
  582. {
  583. this.oceanMonumentGenerator.func_175792_a(this, this.worldObj, p_180514_2_, p_180514_3_, (ChunkPrimer)null);
  584. }
  585. }
  586.  
  587. public Chunk provideChunk(BlockPos blockPosIn)
  588. {
  589. return this.provideChunk(blockPosIn.getX() >> 4, blockPosIn.getZ() >> 4);
  590. }
  591. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement