Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.83 KB | None | 0 0
  1. public class SpookyChunkGeneratorEarth extends SmoothNoiseChunkGenerator<OverworldGenSettings> {
  2. private static final float[] field_222576_h = (float[]) Util.make(new float[25], (p_222575_0_) -> {
  3. for(int i = -2; i <= 2; ++i) {
  4. for(int j = -2; j <= 2; ++j) {
  5. float f = 10.0F / MathHelper.sqrt((float)(i * i + j * j) + 0.2F);
  6. p_222575_0_[i + 2 + (j + 2) * 5] = f;
  7. }
  8. }
  9.  
  10. });
  11. private final SimplexOctaveGenerator depthNoise;
  12. private final boolean field_222577_j;
  13. private final PhantomSpawner phantomSpawner = new PhantomSpawner();
  14. private final PatrolSpawner patrolSpawner = new PatrolSpawner();
  15. private final CatSpawner catSpawner = new CatSpawner();
  16. private final VillageSiege field_225495_n = new VillageSiege();
  17.  
  18. public SpookyChunkGeneratorEarth(IWorld worldIn, BiomeProvider provider, OverworldGenSettings settingsIn) {
  19. super(worldIn, provider, 4, 8, 256, settingsIn, true);
  20. this.randomSeed.skip(2620);
  21. this.depthNoise = new SimplexOctaveGenerator(this.randomSeed, 16);
  22. this.field_222577_j = worldIn.getWorldInfo().getGenerator() == WorldType.AMPLIFIED ;
  23. }
  24.  
  25. @Override
  26. public void generateSurface(IChunk iChunk) {
  27.  
  28. }
  29.  
  30. public void spawnMobs(WorldGenRegion region) {
  31. int i = region.getMainChunkX();
  32. int j = region.getMainChunkZ();
  33. Biome biome = region.getChunk(i, j).getBiomes()[0];
  34. SharedSeedRandom sharedseedrandom = new SharedSeedRandom();
  35. sharedseedrandom.setDecorationSeed(region.getSeed(), i << 4, j << 4);
  36. WorldEntitySpawner.performWorldGenSpawning(region, biome, i, j, sharedseedrandom);
  37. }
  38.  
  39. protected void func_222548_a(double[] p_222548_1_, int p_222548_2_, int p_222548_3_) {
  40. double d0 = 684.4119873046875D;
  41. double d1 = 684.4119873046875D;
  42. double d2 = 8.555149841308594D;
  43. double d3 = 4.277574920654297D;
  44. int i = -10;
  45. int j = 3;
  46. this.func_222546_a(p_222548_1_, p_222548_2_, p_222548_3_, d0, d1, d2, d3, j, i);
  47. }
  48.  
  49. protected double func_222545_a(double p_222545_1_, double p_222545_3_, int p_222545_5_) {
  50. double d0 = 8.5D;
  51. double d1 = ((double)p_222545_5_ - (8.5D + p_222545_1_ * 8.5D / 8.0D * 4.0D)) * 12.0D * 128.0D / 256.0D / p_222545_3_;
  52. if (d1 < 0.0D) {
  53. d1 *= 4.0D;
  54. }
  55.  
  56. return d1;
  57. }
  58.  
  59. protected double[] func_222549_a(int p_222549_1_, int p_222549_2_) {
  60. double[] adouble = new double[2];
  61. float f = 0.0F;
  62. float f1 = 0.0F;
  63. float f2 = 0.0F;
  64. boolean i = true;
  65. float f3 = this.biomeProvider.func_222366_b(p_222549_1_, p_222549_2_).getDepth();
  66.  
  67. for(int j = -2; j <= 2; ++j) {
  68. for(int k = -2; k <= 2; ++k) {
  69. Biome biome = this.biomeProvider.func_222366_b(p_222549_1_ + j, p_222549_2_ + k);
  70. float f4 = biome.getDepth();
  71. float f5 = biome.getScale();
  72. if (this.field_222577_j && f4 > 0.0F) {
  73. f4 = 1.0F + f4 * 2.0F;
  74. f5 = 1.0F + f5 * 4.0F;
  75. }
  76.  
  77. float f6 = field_222576_h[j + 2 + (k + 2) * 5] / (f4 + 2.0F);
  78. if (biome.getDepth() > f3) {
  79. f6 /= 2.0F;
  80. }
  81.  
  82. f += f5 * f6;
  83. f1 += f4 * f6;
  84. f2 += f6;
  85. }
  86. }
  87.  
  88. f /= f2;
  89. f1 /= f2;
  90. f = f * 0.9F + 0.1F;
  91. f1 = (f1 * 4.0F - 1.0F) / 8.0F;
  92. adouble[0] = (double)f1 + this.func_222574_c(p_222549_1_, p_222549_2_);
  93. adouble[1] = (double)f;
  94. return adouble;
  95. }
  96.  
  97. private double func_222574_c(int p_222574_1_, int p_222574_2_) {
  98. this.depthNoise.setScale(0.0D);
  99. double d0 = this.depthNoise.noise((double)(p_222574_1_ * 200), 10.0D, (double)(p_222574_2_ * 200), 1.0D, 0.0D, true);
  100. if (d0 < 0.0D) {
  101. d0 = -d0 * 0.3D;
  102. }
  103.  
  104. d0 = d0 * 3.0D - 2.0D;
  105. if (d0 < 0.0D) {
  106. d0 /= 28.0D;
  107. } else {
  108. if (d0 > 1.0D) {
  109. d0 = 1.0D;
  110. }
  111.  
  112. d0 /= 40.0D;
  113. }
  114.  
  115. return d0;
  116. }
  117.  
  118. public List<Biome.SpawnListEntry> getPossibleCreatures(EntityClassification creatureType, BlockPos pos) {
  119. if (Feature.SWAMP_HUT.func_202383_b(this.world, pos)) {
  120. if (creatureType == EntityClassification.MONSTER) {
  121. return Feature.SWAMP_HUT.getSpawnList();
  122. }
  123.  
  124. if (creatureType == EntityClassification.CREATURE) {
  125. return Feature.SWAMP_HUT.getCreatureSpawnList();
  126. }
  127. } else if (creatureType == EntityClassification.MONSTER) {
  128. if (Feature.PILLAGER_OUTPOST.isPositionInStructure(this.world, pos)) {
  129. return Feature.PILLAGER_OUTPOST.getSpawnList();
  130. }
  131.  
  132. if (Feature.OCEAN_MONUMENT.isPositionInStructure(this.world, pos)) {
  133. return Feature.OCEAN_MONUMENT.getSpawnList();
  134. }
  135. }
  136.  
  137. return super.getPossibleCreatures(creatureType, pos);
  138. }
  139.  
  140. @Override
  141. public void makeBase(IWorld iWorld, IChunk iChunk) {
  142.  
  143. }
  144.  
  145. public void spawnMobs(ServerWorld worldIn, boolean spawnHostileMobs, boolean spawnPeacefulMobs) {
  146. this.phantomSpawner.tick(worldIn, spawnHostileMobs, spawnPeacefulMobs);
  147. this.patrolSpawner.tick(worldIn, spawnHostileMobs, spawnPeacefulMobs);
  148. this.catSpawner.tick(worldIn, spawnHostileMobs, spawnPeacefulMobs);
  149. this.field_225495_n.func_225477_a(worldIn, spawnHostileMobs, spawnPeacefulMobs);
  150. }
  151.  
  152. public int getGroundHeight() {
  153. return this.world.getSeaLevel() + 1;
  154. }
  155.  
  156. public int getSeaLevel() {
  157. return 63;
  158. }
  159. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement