Advertisement
Guest User

CustomChunkProvider

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