ChunkProviderGenerate .java

net.minecraft.world.gen.ChunkProviderGenerate (class): members: scatteredFeatureGenerator, oceanMonumentGenerator, replaceBlocksForBiome, setBlocksInChunk.

net.minecraft.world.genclass603 linescommon22.3 KB

Implements

API Surface (16)

void setBlocksInChunk(int x, int z, ChunkPrimer primer)
void replaceBlocksForBiome(int x, int z, ChunkPrimer primer, BiomeGenBase[] biomeGens)
Chunk provideChunk(int x, int z)
boolean chunkExists(int x, int z)
void populate(IChunkProvider chunkProvider, int x, int z)
boolean populateChunk(IChunkProvider chunkProvider, Chunk chunkIn, int x, int z)
boolean saveChunks(boolean saveAllChunks, IProgressUpdate progressCallback)
void saveExtraData()
boolean unloadQueuedChunks()
boolean canSave()
String makeString()
List<BiomeGenBase.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position)
int getLoadedChunkCount()
void recreateStructures(Chunk chunkIn, int x, int z)
Chunk provideChunk(BlockPos blockPosIn)

Fields & Constants (28)

rand
field_147431_j
field_147432_k
field_147429_l
field_147430_m
noiseGen5
noiseGen6
mobSpawnerNoise
worldObj
mapFeaturesEnabled
field_177475_o
field_147434_q
parabolicField
settings
oceanBlockTmpl
stoneNoise
caveGenerator
strongholdGenerator
villageGenerator
mineshaftGenerator
scatteredFeatureGenerator
ravineGenerator
oceanMonumentGenerator
biomesForGeneration

…and 4 more (see full source).

String literals (2)

"RandomLevelSource"
"Stronghold"

Full Source

ChunkProviderGenerate.java603 lines · MCP 1.8.9 · verbatimOriginal ↗
1
package net.minecraft.world.gen;
2
3
import java.util.List;
4
import java.util.Random;
5
import net.minecraft.block.Block;
6
import net.minecraft.block.BlockFalling;
7
import net.minecraft.entity.EnumCreatureType;
8
import net.minecraft.init.Blocks;
9
import net.minecraft.util.BlockPos;
10
import net.minecraft.util.IProgressUpdate;
11
import net.minecraft.util.MathHelper;
12
import net.minecraft.world.ChunkCoordIntPair;
13
import net.minecraft.world.SpawnerAnimals;
14
import net.minecraft.world.World;
15
import net.minecraft.world.WorldType;
16
import net.minecraft.world.biome.BiomeGenBase;
17
import net.minecraft.world.chunk.Chunk;
18
import net.minecraft.world.chunk.ChunkPrimer;
19
import net.minecraft.world.chunk.IChunkProvider;
20
import net.minecraft.world.gen.feature.WorldGenDungeons;
21
import net.minecraft.world.gen.feature.WorldGenLakes;
22
import net.minecraft.world.gen.structure.MapGenMineshaft;
23
import net.minecraft.world.gen.structure.MapGenScatteredFeature;
24
import net.minecraft.world.gen.structure.MapGenStronghold;
25
import net.minecraft.world.gen.structure.MapGenVillage;
26
import net.minecraft.world.gen.structure.StructureOceanMonument;
27
28
public class ChunkProviderGenerate implements IChunkProvider
29
{
30
    /** RNG. */
31
    private Random rand;
32
    private NoiseGeneratorOctaves field_147431_j;
33
    private NoiseGeneratorOctaves field_147432_k;
34
    private NoiseGeneratorOctaves field_147429_l;
35
    private NoiseGeneratorPerlin field_147430_m;
36
37
    /** A NoiseGeneratorOctaves used in generating terrain */
38
    public NoiseGeneratorOctaves noiseGen5;
39
40
    /** A NoiseGeneratorOctaves used in generating terrain */
41
    public NoiseGeneratorOctaves noiseGen6;
42
    public NoiseGeneratorOctaves mobSpawnerNoise;
43
44
    /** Reference to the World object. */
45
    private World worldObj;
46
47
    /** are map structures going to be generated (e.g. strongholds) */
48
    private final boolean mapFeaturesEnabled;
49
    private WorldType field_177475_o;
50
    private final double[] field_147434_q;
51
    private final float[] parabolicField;
52
    private ChunkProviderSettings settings;
53
    private Block oceanBlockTmpl = Blocks.water;
54
    private double[] stoneNoise = new double[256];
55
    private MapGenBase caveGenerator = new MapGenCaves();
56
57
    /** Holds Stronghold Generator */
58
    private MapGenStronghold strongholdGenerator = new MapGenStronghold();
59
60
    /** Holds Village Generator */
61
    private MapGenVillage villageGenerator = new MapGenVillage();
62
63
    /** Holds Mineshaft Generator */
64
    private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft();
65
    private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature();
66
67
    /** Holds ravine generator */
68
    private MapGenBase ravineGenerator = new MapGenRavine();
69
    private StructureOceanMonument oceanMonumentGenerator = new StructureOceanMonument();
70
71
    /** The biomes that are used to generate the chunk */
72
    private BiomeGenBase[] biomesForGeneration;
73
    double[] mainNoiseArray;
74
    double[] lowerLimitNoiseArray;
75
    double[] upperLimitNoiseArray;
76
    double[] depthNoiseArray;
77
78
    public ChunkProviderGenerate(World worldIn, long seed, boolean generateStructures, String structuresJson)
79
    {
80
        this.worldObj = worldIn;
81
        this.mapFeaturesEnabled = generateStructures;
82
        this.field_177475_o = worldIn.getWorldInfo().getTerrainType();
83
        this.rand = new Random(seed);
84
        this.field_147431_j = new NoiseGeneratorOctaves(this.rand, 16);
85
        this.field_147432_k = new NoiseGeneratorOctaves(this.rand, 16);
86
        this.field_147429_l = new NoiseGeneratorOctaves(this.rand, 8);
87
        this.field_147430_m = new NoiseGeneratorPerlin(this.rand, 4);
88
        this.noiseGen5 = new NoiseGeneratorOctaves(this.rand, 10);
89
        this.noiseGen6 = new NoiseGeneratorOctaves(this.rand, 16);
90
        this.mobSpawnerNoise = new NoiseGeneratorOctaves(this.rand, 8);
91
        this.field_147434_q = new double[825];
92
        this.parabolicField = new float[25];
93
94
        for (int i = -2; i <= 2; ++i)
95
        {
96
            for (int j = -2; j <= 2; ++j)
97
            {
98
                float f = 10.0F / MathHelper.sqrt_float((float)(i * i + j * j) + 0.2F);
99
                this.parabolicField[i + 2 + (j + 2) * 5] = f;
100
            }
101
        }
102
103
        if (structuresJson != null)
104
        {
105
            this.settings = ChunkProviderSettings.Factory.jsonToFactory(structuresJson).func_177864_b();
106
            this.oceanBlockTmpl = this.settings.useLavaOceans ? Blocks.lava : Blocks.water;
107
            worldIn.setSeaLevel(this.settings.seaLevel);
108
        }
109
    }
110
111
    /**
112
     * Generates a bare-bones chunk of nothing but stone or ocean blocks, formed, but featureless.
113
     */
114
    public void setBlocksInChunk(int x, int z, ChunkPrimer primer)
115
    {
116
        this.biomesForGeneration = this.worldObj.getWorldChunkManager().getBiomesForGeneration(this.biomesForGeneration, x * 4 - 2, z * 4 - 2, 10, 10);
117
        this.func_147423_a(x * 4, 0, z * 4);
118
119
        for (int i = 0; i < 4; ++i)
120
        {
121
            int j = i * 5;
122
            int k = (i + 1) * 5;
123
124
            for (int l = 0; l < 4; ++l)
125
            {
126
                int i1 = (j + l) * 33;
127
                int j1 = (j + l + 1) * 33;
128
                int k1 = (k + l) * 33;
129
                int l1 = (k + l + 1) * 33;
130
131
                for (int i2 = 0; i2 < 32; ++i2)
132
                {
133
                    double d0 = 0.125D;
134
                    double d1 = this.field_147434_q[i1 + i2];
135
                    double d2 = this.field_147434_q[j1 + i2];
136
                    double d3 = this.field_147434_q[k1 + i2];
137
                    double d4 = this.field_147434_q[l1 + i2];
138
                    double d5 = (this.field_147434_q[i1 + i2 + 1] - d1) * d0;
139
                    double d6 = (this.field_147434_q[j1 + i2 + 1] - d2) * d0;
140
                    double d7 = (this.field_147434_q[k1 + i2 + 1] - d3) * d0;
141
                    double d8 = (this.field_147434_q[l1 + i2 + 1] - d4) * d0;
142
143
                    for (int j2 = 0; j2 < 8; ++j2)
144
                    {
145
                        double d9 = 0.25D;
146
                        double d10 = d1;
147
                        double d11 = d2;
148
                        double d12 = (d3 - d1) * d9;
149
                        double d13 = (d4 - d2) * d9;
150
151
                        for (int k2 = 0; k2 < 4; ++k2)
152
                        {
153
                            double d14 = 0.25D;
154
                            double d16 = (d11 - d10) * d14;
155
                            double lvt_45_1_ = d10 - d16;
156
157
                            for (int l2 = 0; l2 < 4; ++l2)
158
                            {
159
                                if ((lvt_45_1_ += d16) > 0.0D)
160
                                {
161
                                    primer.setBlockState(i * 4 + k2, i2 * 8 + j2, l * 4 + l2, Blocks.stone.getDefaultState());
162
                                }
163
                                else if (i2 * 8 + j2 < this.settings.seaLevel)
164
                                {
165
                                    primer.setBlockState(i * 4 + k2, i2 * 8 + j2, l * 4 + l2, this.oceanBlockTmpl.getDefaultState());
166
                                }
167
                            }
168
169
                            d10 += d12;
170
                            d11 += d13;
171
                        }
172
173
                        d1 += d5;
174
                        d2 += d6;
175
                        d3 += d7;
176
                        d4 += d8;
177
                    }
178
                }
179
            }
180
        }
181
    }
182
183
    /**
184
     * Possibly reshapes the biome if appropriate for the biome type, and replaces some stone with things like dirt,
185
     * grass, gravel, ice
186
     */
187
    public void replaceBlocksForBiome(int x, int z, ChunkPrimer primer, BiomeGenBase[] biomeGens)
188
    {
189
        double d0 = 0.03125D;
190
        this.stoneNoise = this.field_147430_m.func_151599_a(this.stoneNoise, (double)(x * 16), (double)(z * 16), 16, 16, d0 * 2.0D, d0 * 2.0D, 1.0D);
191
192
        for (int i = 0; i < 16; ++i)
193
        {
194
            for (int j = 0; j < 16; ++j)
195
            {
196
                BiomeGenBase biomegenbase = biomeGens[j + i * 16];
197
                biomegenbase.genTerrainBlocks(this.worldObj, this.rand, primer, x * 16 + i, z * 16 + j, this.stoneNoise[j + i * 16]);
198
            }
199
        }
200
    }
201
202
    /**
203
     * Will return back a chunk, if it doesn't exist and its not a MP client it will generates all the blocks for the
204
     * specified chunk from the map seed and chunk seed
205
     */
206
    public Chunk provideChunk(int x, int z)
207
    {
208
        this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L);
209
        ChunkPrimer chunkprimer = new ChunkPrimer();
210
        this.setBlocksInChunk(x, z, chunkprimer);
211
        this.biomesForGeneration = this.worldObj.getWorldChunkManager().loadBlockGeneratorData(this.biomesForGeneration, x * 16, z * 16, 16, 16);
212
        this.replaceBlocksForBiome(x, z, chunkprimer, this.biomesForGeneration);
213
214
        if (this.settings.useCaves)
215
        {
216
            this.caveGenerator.generate(this, this.worldObj, x, z, chunkprimer);
217
        }
218
219
        if (this.settings.useRavines)
220
        {
221
            this.ravineGenerator.generate(this, this.worldObj, x, z, chunkprimer);
222
        }
223
224
        if (this.settings.useMineShafts && this.mapFeaturesEnabled)
225
        {
226
            this.mineshaftGenerator.generate(this, this.worldObj, x, z, chunkprimer);
227
        }
228
229
        if (this.settings.useVillages && this.mapFeaturesEnabled)
230
        {
231
            this.villageGenerator.generate(this, this.worldObj, x, z, chunkprimer);
232
        }
233
234
        if (this.settings.useStrongholds && this.mapFeaturesEnabled)
235
        {
236
            this.strongholdGenerator.generate(this, this.worldObj, x, z, chunkprimer);
237
        }
238
239
        if (this.settings.useTemples && this.mapFeaturesEnabled)
240
        {
241
            this.scatteredFeatureGenerator.generate(this, this.worldObj, x, z, chunkprimer);
242
        }
243
244
        if (this.settings.useMonuments && this.mapFeaturesEnabled)
245
        {
246
            this.oceanMonumentGenerator.generate(this, this.worldObj, x, z, chunkprimer);
247
        }
248
249
        Chunk chunk = new Chunk(this.worldObj, chunkprimer, x, z);
250
        byte[] abyte = chunk.getBiomeArray();
251
252
        for (int i = 0; i < abyte.length; ++i)
253
        {
254
            abyte[i] = (byte)this.biomesForGeneration[i].biomeID;
255
        }
256
257
        chunk.generateSkylightMap();
258
        return chunk;
259
    }
260
261
    private void func_147423_a(int x, int y, int z)
262
    {
263
        this.depthNoiseArray = this.noiseGen6.generateNoiseOctaves(this.depthNoiseArray, x, z, 5, 5, (double)this.settings.depthNoiseScaleX, (double)this.settings.depthNoiseScaleZ, (double)this.settings.depthNoiseScaleExponent);
264
        float f = this.settings.coordinateScale;
265
        float f1 = this.settings.heightScale;
266
        this.mainNoiseArray = this.field_147429_l.generateNoiseOctaves(this.mainNoiseArray, x, y, z, 5, 33, 5, (double)(f / this.settings.mainNoiseScaleX), (double)(f1 / this.settings.mainNoiseScaleY), (double)(f / this.settings.mainNoiseScaleZ));
267
        this.lowerLimitNoiseArray = this.field_147431_j.generateNoiseOctaves(this.lowerLimitNoiseArray, x, y, z, 5, 33, 5, (double)f, (double)f1, (double)f);
268
        this.upperLimitNoiseArray = this.field_147432_k.generateNoiseOctaves(this.upperLimitNoiseArray, x, y, z, 5, 33, 5, (double)f, (double)f1, (double)f);
269
        z = 0;
270
        x = 0;
271
        int i = 0;
272
        int j = 0;
273
274
        for (int k = 0; k < 5; ++k)
275
        {
276
            for (int l = 0; l < 5; ++l)
277
            {
278
                float f2 = 0.0F;
279
                float f3 = 0.0F;
280
                float f4 = 0.0F;
281
                int i1 = 2;
282
                BiomeGenBase biomegenbase = this.biomesForGeneration[k + 2 + (l + 2) * 10];
283
284
                for (int j1 = -i1; j1 <= i1; ++j1)
285
                {
286
                    for (int k1 = -i1; k1 <= i1; ++k1)
287
                    {
288
                        BiomeGenBase biomegenbase1 = this.biomesForGeneration[k + j1 + 2 + (l + k1 + 2) * 10];
289
                        float f5 = this.settings.biomeDepthOffSet + biomegenbase1.minHeight * this.settings.biomeDepthWeight;
290
                        float f6 = this.settings.biomeScaleOffset + biomegenbase1.maxHeight * this.settings.biomeScaleWeight;
291
292
                        if (this.field_177475_o == WorldType.AMPLIFIED && f5 > 0.0F)
293
                        {
294
                            f5 = 1.0F + f5 * 2.0F;
295
                            f6 = 1.0F + f6 * 4.0F;
296
                        }
297
298
                        float f7 = this.parabolicField[j1 + 2 + (k1 + 2) * 5] / (f5 + 2.0F);
299
300
                        if (biomegenbase1.minHeight > biomegenbase.minHeight)
301
                        {
302
                            f7 /= 2.0F;
303
                        }
304
305
                        f2 += f6 * f7;
306
                        f3 += f5 * f7;
307
                        f4 += f7;
308
                    }
309
                }
310
311
                f2 = f2 / f4;
312
                f3 = f3 / f4;
313
                f2 = f2 * 0.9F + 0.1F;
314
                f3 = (f3 * 4.0F - 1.0F) / 8.0F;
315
                double d7 = this.depthNoiseArray[j] / 8000.0D;
316
317
                if (d7 < 0.0D)
318
                {
319
                    d7 = -d7 * 0.3D;
320
                }
321
322
                d7 = d7 * 3.0D - 2.0D;
323
324
                if (d7 < 0.0D)
325
                {
326
                    d7 = d7 / 2.0D;
327
328
                    if (d7 < -1.0D)
329
                    {
330
                        d7 = -1.0D;
331
                    }
332
333
                    d7 = d7 / 1.4D;
334
                    d7 = d7 / 2.0D;
335
                }
336
                else
337
                {
338
                    if (d7 > 1.0D)
339
                    {
340
                        d7 = 1.0D;
341
                    }
342
343
                    d7 = d7 / 8.0D;
344
                }
345
346
                ++j;
347
                double d8 = (double)f3;
348
                double d9 = (double)f2;
349
                d8 = d8 + d7 * 0.2D;
350
                d8 = d8 * (double)this.settings.baseSize / 8.0D;
351
                double d0 = (double)this.settings.baseSize + d8 * 4.0D;
352
353
                for (int l1 = 0; l1 < 33; ++l1)
354
                {
355
                    double d1 = ((double)l1 - d0) * (double)this.settings.stretchY * 128.0D / 256.0D / d9;
356
357
                    if (d1 < 0.0D)
358
                    {
359
                        d1 *= 4.0D;
360
                    }
361
362
                    double d2 = this.lowerLimitNoiseArray[i] / (double)this.settings.lowerLimitScale;
363
                    double d3 = this.upperLimitNoiseArray[i] / (double)this.settings.upperLimitScale;
364
                    double d4 = (this.mainNoiseArray[i] / 10.0D + 1.0D) / 2.0D;
365
                    double d5 = MathHelper.denormalizeClamp(d2, d3, d4) - d1;
366
367
                    if (l1 > 29)
368
                    {
369
                        double d6 = (double)((float)(l1 - 29) / 3.0F);
370
                        d5 = d5 * (1.0D - d6) + -10.0D * d6;
371
                    }
372
373
                    this.field_147434_q[i] = d5;
374
                    ++i;
375
                }
376
            }
377
        }
378
    }
379
380
    /**
381
     * Checks to see if a chunk exists at x, z
382
     */
383
    public boolean chunkExists(int x, int z)
384
    {
385
        return true;
386
    }
387
388
    /**
389
     * Populates chunk with ores etc etc
390
     */
391
    public void populate(IChunkProvider chunkProvider, int x, int z)
392
    {
393
        BlockFalling.fallInstantly = true;
394
        int i = x * 16;
395
        int j = z * 16;
396
        BlockPos blockpos = new BlockPos(i, 0, j);
397
        BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(blockpos.add(16, 0, 16));
398
        this.rand.setSeed(this.worldObj.getSeed());
399
        long k = this.rand.nextLong() / 2L * 2L + 1L;
400
        long l = this.rand.nextLong() / 2L * 2L + 1L;
401
        this.rand.setSeed((long)x * k + (long)z * l ^ this.worldObj.getSeed());
402
        boolean flag = false;
403
        ChunkCoordIntPair chunkcoordintpair = new ChunkCoordIntPair(x, z);
404
405
        if (this.settings.useMineShafts && this.mapFeaturesEnabled)
406
        {
407
            this.mineshaftGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair);
408
        }
409
410
        if (this.settings.useVillages && this.mapFeaturesEnabled)
411
        {
412
            flag = this.villageGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair);
413
        }
414
415
        if (this.settings.useStrongholds && this.mapFeaturesEnabled)
416
        {
417
            this.strongholdGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair);
418
        }
419
420
        if (this.settings.useTemples && this.mapFeaturesEnabled)
421
        {
422
            this.scatteredFeatureGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair);
423
        }
424
425
        if (this.settings.useMonuments && this.mapFeaturesEnabled)
426
        {
427
            this.oceanMonumentGenerator.generateStructure(this.worldObj, this.rand, chunkcoordintpair);
428
        }
429
430
        if (biomegenbase != BiomeGenBase.desert && biomegenbase != BiomeGenBase.desertHills && this.settings.useWaterLakes && !flag && this.rand.nextInt(this.settings.waterLakeChance) == 0)
431
        {
432
            int i1 = this.rand.nextInt(16) + 8;
433
            int j1 = this.rand.nextInt(256);
434
            int k1 = this.rand.nextInt(16) + 8;
435
            (new WorldGenLakes(Blocks.water)).generate(this.worldObj, this.rand, blockpos.add(i1, j1, k1));
436
        }
437
438
        if (!flag && this.rand.nextInt(this.settings.lavaLakeChance / 10) == 0 && this.settings.useLavaLakes)
439
        {
440
            int i2 = this.rand.nextInt(16) + 8;
441
            int l2 = this.rand.nextInt(this.rand.nextInt(248) + 8);
442
            int k3 = this.rand.nextInt(16) + 8;
443
444
            if (l2 < this.worldObj.getSeaLevel() || this.rand.nextInt(this.settings.lavaLakeChance / 8) == 0)
445
            {
446
                (new WorldGenLakes(Blocks.lava)).generate(this.worldObj, this.rand, blockpos.add(i2, l2, k3));
447
            }
448
        }
449
450
        if (this.settings.useDungeons)
451
        {
452
            for (int j2 = 0; j2 < this.settings.dungeonChance; ++j2)
453
            {
454
                int i3 = this.rand.nextInt(16) + 8;
455
                int l3 = this.rand.nextInt(256);
456
                int l1 = this.rand.nextInt(16) + 8;
457
                (new WorldGenDungeons()).generate(this.worldObj, this.rand, blockpos.add(i3, l3, l1));
458
            }
459
        }
460
461
        biomegenbase.decorate(this.worldObj, this.rand, new BlockPos(i, 0, j));
462
        SpawnerAnimals.performWorldGenSpawning(this.worldObj, biomegenbase, i + 8, j + 8, 16, 16, this.rand);
463
        blockpos = blockpos.add(8, 0, 8);
464
465
        for (int k2 = 0; k2 < 16; ++k2)
466
        {
467
            for (int j3 = 0; j3 < 16; ++j3)
468
            {
469
                BlockPos blockpos1 = this.worldObj.getPrecipitationHeight(blockpos.add(k2, 0, j3));
470
                BlockPos blockpos2 = blockpos1.down();
471
472
                if (this.worldObj.canBlockFreezeWater(blockpos2))
473
                {
474
                    this.worldObj.setBlockState(blockpos2, Blocks.ice.getDefaultState(), 2);
475
                }
476
477
                if (this.worldObj.canSnowAt(blockpos1, true))
478
                {
479
                    this.worldObj.setBlockState(blockpos1, Blocks.snow_layer.getDefaultState(), 2);
480
                }
481
            }
482
        }
483
484
        BlockFalling.fallInstantly = false;
485
    }
486
487
    public boolean populateChunk(IChunkProvider chunkProvider, Chunk chunkIn, int x, int z)
488
    {
489
        boolean flag = false;
490
491
        if (this.settings.useMonuments && this.mapFeaturesEnabled && chunkIn.getInhabitedTime() < 3600L)
492
        {
493
            flag |= this.oceanMonumentGenerator.generateStructure(this.worldObj, this.rand, new ChunkCoordIntPair(x, z));
494
        }
495
496
        return flag;
497
    }
498
499
    /**
500
     * Two modes of operation: if passed true, save all Chunks in one go.  If passed false, save up to two chunks.
501
     * Return true if all chunks have been saved.
502
     */
503
    public boolean saveChunks(boolean saveAllChunks, IProgressUpdate progressCallback)
504
    {
505
        return true;
506
    }
507
508
    /**
509
     * Save extra data not associated with any Chunk.  Not saved during autosave, only during world unload.  Currently
510
     * unimplemented.
511
     */
512
    public void saveExtraData()
513
    {
514
    }
515
516
    /**
517
     * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.
518
     */
519
    public boolean unloadQueuedChunks()
520
    {
521
        return false;
522
    }
523
524
    /**
525
     * Returns if the IChunkProvider supports saving.
526
     */
527
    public boolean canSave()
528
    {
529
        return true;
530
    }
531
532
    /**
533
     * Converts the instance data to a readable string.
534
     */
535
    public String makeString()
536
    {
537
        return "RandomLevelSource";
538
    }
539
540
    public List<BiomeGenBase.SpawnListEntry> getPossibleCreatures(EnumCreatureType creatureType, BlockPos pos)
541
    {
542
        BiomeGenBase biomegenbase = this.worldObj.getBiomeGenForCoords(pos);
543
544
        if (this.mapFeaturesEnabled)
545
        {
546
            if (creatureType == EnumCreatureType.MONSTER && this.scatteredFeatureGenerator.func_175798_a(pos))
547
            {
548
                return this.scatteredFeatureGenerator.getScatteredFeatureSpawnList();
549
            }
550
551
            if (creatureType == EnumCreatureType.MONSTER && this.settings.useMonuments && this.oceanMonumentGenerator.isPositionInStructure(this.worldObj, pos))
552
            {
553
                return this.oceanMonumentGenerator.getScatteredFeatureSpawnList();
554
            }
555
        }
556
557
        return biomegenbase.getSpawnableList(creatureType);
558
    }
559
560
    public BlockPos getStrongholdGen(World worldIn, String structureName, BlockPos position)
561
    {
562
        return "Stronghold".equals(structureName) && this.strongholdGenerator != null ? this.strongholdGenerator.getClosestStrongholdPos(worldIn, position) : null;
563
    }
564
565
    public int getLoadedChunkCount()
566
    {
567
        return 0;
568
    }
569
570
    public void recreateStructures(Chunk chunkIn, int x, int z)
571
    {
572
        if (this.settings.useMineShafts && this.mapFeaturesEnabled)
573
        {
574
            this.mineshaftGenerator.generate(this, this.worldObj, x, z, (ChunkPrimer)null);
575
        }
576
577
        if (this.settings.useVillages && this.mapFeaturesEnabled)
578
        {
579
            this.villageGenerator.generate(this, this.worldObj, x, z, (ChunkPrimer)null);
580
        }
581
582
        if (this.settings.useStrongholds && this.mapFeaturesEnabled)
583
        {
584
            this.strongholdGenerator.generate(this, this.worldObj, x, z, (ChunkPrimer)null);
585
        }
586
587
        if (this.settings.useTemples && this.mapFeaturesEnabled)
588
        {
589
            this.scatteredFeatureGenerator.generate(this, this.worldObj, x, z, (ChunkPrimer)null);
590
        }
591
592
        if (this.settings.useMonuments && this.mapFeaturesEnabled)
593
        {
594
            this.oceanMonumentGenerator.generate(this, this.worldObj, x, z, (ChunkPrimer)null);
595
        }
596
    }
597
598
    public Chunk provideChunk(BlockPos blockPosIn)
599
    {
600
        return this.provideChunk(blockPosIn.getX() >> 4, blockPosIn.getZ() >> 4);
601
    }
602
}
603

Deobfuscated MCP 1.8.9 source of ChunkProviderGenerate from Marcelektro/MavenMCP-1.8.9 (net/minecraft/world/gen/ChunkProviderGenerate.java), stored verbatim.