Fork of Poseidon providing Bukkit #1060 to older Beta versions (b1.0-b1.7.3)
1package net.minecraft.server;
2
3import java.util.Random;
4
5import uk.betacraft.uberbukkit.UberbukkitConfig;
6
7public class ChunkProviderGenerate implements IChunkProvider {
8
9 private Random j;
10 private NoiseGeneratorOctaves k;
11 private NoiseGeneratorOctaves l;
12 private NoiseGeneratorOctaves m;
13 private NoiseGeneratorOctaves n;
14 private NoiseGeneratorOctaves o;
15 public NoiseGeneratorOctaves a;
16 public NoiseGeneratorOctaves b;
17 public NoiseGeneratorOctaves c;
18 private World p;
19 private double[] q;
20 private double[] r = new double[256];
21 private double[] s = new double[256];
22 private double[] t = new double[256];
23 private MapGenBase u = new MapGenCaves();
24 private BiomeBase[] v;
25 double[] d;
26 double[] e;
27 double[] f;
28 double[] g;
29 double[] h;
30 int[][] i = new int[32][32];
31 private double[] w;
32
33 public ChunkProviderGenerate(World world, long i) {
34 this.p = world;
35 this.j = new Random(i);
36 this.k = new NoiseGeneratorOctaves(this.j, 16);
37 this.l = new NoiseGeneratorOctaves(this.j, 16);
38 this.m = new NoiseGeneratorOctaves(this.j, 8);
39 this.n = new NoiseGeneratorOctaves(this.j, 4);
40 this.o = new NoiseGeneratorOctaves(this.j, 4);
41 this.a = new NoiseGeneratorOctaves(this.j, 10);
42 this.b = new NoiseGeneratorOctaves(this.j, 16);
43 this.c = new NoiseGeneratorOctaves(this.j, 8);
44 }
45
46 public void a(int i, int j, byte[] abyte, BiomeBase[] abiomebase, double[] adouble) {
47 byte b0 = 4;
48 byte b1 = 64;
49 int k = b0 + 1;
50 byte b2 = 17;
51 int l = b0 + 1;
52
53 this.q = this.a(this.q, i * b0, 0, j * b0, k, b2, l);
54
55 for (int i1 = 0; i1 < b0; ++i1) {
56 for (int j1 = 0; j1 < b0; ++j1) {
57 for (int k1 = 0; k1 < 16; ++k1) {
58 double d0 = 0.125D;
59 double d1 = this.q[((i1 + 0) * l + j1 + 0) * b2 + k1 + 0];
60 double d2 = this.q[((i1 + 0) * l + j1 + 1) * b2 + k1 + 0];
61 double d3 = this.q[((i1 + 1) * l + j1 + 0) * b2 + k1 + 0];
62 double d4 = this.q[((i1 + 1) * l + j1 + 1) * b2 + k1 + 0];
63 double d5 = (this.q[((i1 + 0) * l + j1 + 0) * b2 + k1 + 1] - d1) * d0;
64 double d6 = (this.q[((i1 + 0) * l + j1 + 1) * b2 + k1 + 1] - d2) * d0;
65 double d7 = (this.q[((i1 + 1) * l + j1 + 0) * b2 + k1 + 1] - d3) * d0;
66 double d8 = (this.q[((i1 + 1) * l + j1 + 1) * b2 + k1 + 1] - d4) * d0;
67
68 for (int l1 = 0; l1 < 8; ++l1) {
69 double d9 = 0.25D;
70 double d10 = d1;
71 double d11 = d2;
72 double d12 = (d3 - d1) * d9;
73 double d13 = (d4 - d2) * d9;
74
75 for (int i2 = 0; i2 < 4; ++i2) {
76 int j2 = i2 + i1 * 4 << 11 | 0 + j1 * 4 << 7 | k1 * 8 + l1;
77 short short1 = 128;
78 double d14 = 0.25D;
79 double d15 = d10;
80 double d16 = (d11 - d10) * d14;
81
82 for (int k2 = 0; k2 < 4; ++k2) {
83 double d17 = adouble[(i1 * 4 + i2) * 16 + j1 * 4 + k2];
84 int l2 = 0;
85
86 if (k1 * 8 + l1 < b1) {
87 if (d17 < 0.5D && k1 * 8 + l1 >= b1 - 1) {
88 l2 = Block.ICE.id;
89 } else {
90 l2 = Block.STATIONARY_WATER.id;
91 }
92 }
93
94 if (d15 > 0.0D) {
95 l2 = Block.STONE.id;
96 }
97
98 abyte[j2] = (byte) l2;
99 j2 += short1;
100 d15 += d16;
101 }
102
103 d10 += d12;
104 d11 += d13;
105 }
106
107 d1 += d5;
108 d2 += d6;
109 d3 += d7;
110 d4 += d8;
111 }
112 }
113 }
114 }
115 }
116
117 public void a(int i, int j, byte[] abyte, BiomeBase[] abiomebase) {
118 byte b0 = 64;
119 double d0 = 0.03125D;
120
121 this.r = this.n.a(this.r, (double) (i * 16), (double) (j * 16), 0.0D, 16, 16, 1, d0, d0, 1.0D);
122 this.s = this.n.a(this.s, (double) (i * 16), 109.0134D, (double) (j * 16), 16, 1, 16, d0, 1.0D, d0);
123 this.t = this.o.a(this.t, (double) (i * 16), (double) (j * 16), 0.0D, 16, 16, 1, d0 * 2.0D, d0 * 2.0D, d0 * 2.0D);
124
125 for (int k = 0; k < 16; ++k) {
126 for (int l = 0; l < 16; ++l) {
127 BiomeBase biomebase = abiomebase[k + l * 16];
128 boolean flag = this.r[k + l * 16] + this.j.nextDouble() * 0.2D > 0.0D;
129 boolean flag1 = this.s[k + l * 16] + this.j.nextDouble() * 0.2D > 3.0D;
130 int i1 = (int) (this.t[k + l * 16] / 3.0D + 3.0D + this.j.nextDouble() * 0.25D);
131 int j1 = -1;
132 byte b1 = biomebase.p;
133 byte b2 = biomebase.q;
134
135 for (int k1 = 127; k1 >= 0; --k1) {
136 int l1 = (l * 16 + k) * 128 + k1;
137
138 if (k1 <= 0 + this.j.nextInt(5)) {
139 abyte[l1] = (byte) Block.BEDROCK.id;
140 } else {
141 byte b3 = abyte[l1];
142
143 if (b3 == 0) {
144 j1 = -1;
145 } else if (b3 == Block.STONE.id) {
146 if (j1 == -1) {
147 if (i1 <= 0) {
148 b1 = 0;
149 b2 = (byte) Block.STONE.id;
150 } else if (k1 >= b0 - 4 && k1 <= b0 + 1) {
151 b1 = biomebase.p;
152 b2 = biomebase.q;
153 if (flag1) {
154 b1 = 0;
155 }
156
157 if (flag1) {
158 b2 = (byte) Block.GRAVEL.id;
159 }
160
161 if (flag) {
162 b1 = (byte) Block.SAND.id;
163 }
164
165 if (flag) {
166 b2 = (byte) Block.SAND.id;
167 }
168 }
169
170 if (k1 < b0 && b1 == 0) {
171 b1 = (byte) Block.STATIONARY_WATER.id;
172 }
173
174 j1 = i1;
175 if (k1 >= b0 - 1) {
176 abyte[l1] = b1;
177 } else {
178 abyte[l1] = b2;
179 }
180 } else if (j1 > 0) {
181 --j1;
182 abyte[l1] = b2;
183 // uberbukkit
184 if (UberbukkitConfig.getInstance().getBoolean("worldgen.generate_sandstone", true) && j1 == 0 && b2 == Block.SAND.id) {
185 j1 = this.j.nextInt(4);
186 b2 = (byte) Block.SANDSTONE.id;
187 }
188 }
189 }
190 }
191 }
192 }
193 }
194 }
195
196 public Chunk getChunkAt(int i, int j) {
197 return this.getOrCreateChunk(i, j);
198 }
199
200 public Chunk getOrCreateChunk(int i, int j) {
201 this.j.setSeed((long) i * 341873128712L + (long) j * 132897987541L);
202 byte[] abyte = new byte['\u8000'];
203 Chunk chunk = new Chunk(this.p, abyte, i, j);
204
205 this.v = this.p.getWorldChunkManager().a(this.v, i * 16, j * 16, 16, 16);
206 double[] adouble = this.p.getWorldChunkManager().temperature;
207
208 this.a(i, j, abyte, this.v, adouble);
209 this.a(i, j, abyte, this.v);
210 this.u.a(this, this.p, i, j, abyte);
211 chunk.initLighting();
212 return chunk;
213 }
214
215 private double[] a(double[] adouble, int i, int j, int k, int l, int i1, int j1) {
216 if (adouble == null) {
217 adouble = new double[l * i1 * j1];
218 }
219
220 double d0 = 684.412D;
221 double d1 = 684.412D;
222 double[] adouble1 = this.p.getWorldChunkManager().temperature;
223 double[] adouble2 = this.p.getWorldChunkManager().rain;
224
225 this.g = this.a.a(this.g, i, k, l, j1, 1.121D, 1.121D, 0.5D);
226 this.h = this.b.a(this.h, i, k, l, j1, 200.0D, 200.0D, 0.5D);
227 this.d = this.m.a(this.d, (double) i, (double) j, (double) k, l, i1, j1, d0 / 80.0D, d1 / 160.0D, d0 / 80.0D);
228 this.e = this.k.a(this.e, (double) i, (double) j, (double) k, l, i1, j1, d0, d1, d0);
229 this.f = this.l.a(this.f, (double) i, (double) j, (double) k, l, i1, j1, d0, d1, d0);
230 int k1 = 0;
231 int l1 = 0;
232 int i2 = 16 / l;
233
234 for (int j2 = 0; j2 < l; ++j2) {
235 int k2 = j2 * i2 + i2 / 2;
236
237 for (int l2 = 0; l2 < j1; ++l2) {
238 int i3 = l2 * i2 + i2 / 2;
239 double d2 = adouble1[k2 * 16 + i3];
240 double d3 = adouble2[k2 * 16 + i3] * d2;
241 double d4 = 1.0D - d3;
242
243 d4 *= d4;
244 d4 *= d4;
245 d4 = 1.0D - d4;
246 double d5 = (this.g[l1] + 256.0D) / 512.0D;
247
248 d5 *= d4;
249 if (d5 > 1.0D) {
250 d5 = 1.0D;
251 }
252
253 double d6 = this.h[l1] / 8000.0D;
254
255 if (d6 < 0.0D) {
256 d6 = -d6 * 0.3D;
257 }
258
259 d6 = d6 * 3.0D - 2.0D;
260 if (d6 < 0.0D) {
261 d6 /= 2.0D;
262 if (d6 < -1.0D) {
263 d6 = -1.0D;
264 }
265
266 d6 /= 1.4D;
267 d6 /= 2.0D;
268 d5 = 0.0D;
269 } else {
270 if (d6 > 1.0D) {
271 d6 = 1.0D;
272 }
273
274 d6 /= 8.0D;
275 }
276
277 if (d5 < 0.0D) {
278 d5 = 0.0D;
279 }
280
281 d5 += 0.5D;
282 d6 = d6 * (double) i1 / 16.0D;
283 double d7 = (double) i1 / 2.0D + d6 * 4.0D;
284
285 ++l1;
286
287 for (int j3 = 0; j3 < i1; ++j3) {
288 double d8 = 0.0D;
289 double d9 = ((double) j3 - d7) * 12.0D / d5;
290
291 if (d9 < 0.0D) {
292 d9 *= 4.0D;
293 }
294
295 double d10 = this.e[k1] / 512.0D;
296 double d11 = this.f[k1] / 512.0D;
297 double d12 = (this.d[k1] / 10.0D + 1.0D) / 2.0D;
298
299 if (d12 < 0.0D) {
300 d8 = d10;
301 } else if (d12 > 1.0D) {
302 d8 = d11;
303 } else {
304 d8 = d10 + (d11 - d10) * d12;
305 }
306
307 d8 -= d9;
308 if (j3 > i1 - 4) {
309 double d13 = (double) ((float) (j3 - (i1 - 4)) / 3.0F);
310
311 d8 = d8 * (1.0D - d13) + -10.0D * d13;
312 }
313
314 adouble[k1] = d8;
315 ++k1;
316 }
317 }
318 }
319
320 return adouble;
321 }
322
323 public boolean isChunkLoaded(int i, int j) {
324 return true;
325 }
326
327 public void getChunkAt(IChunkProvider ichunkprovider, int i, int j) {
328 BlockSand.instaFall = true;
329 int k = i * 16;
330 int l = j * 16;
331 BiomeBase biomebase = this.p.getWorldChunkManager().getBiome(k + 16, l + 16);
332
333 this.j.setSeed(this.p.getSeed());
334 long i1 = this.j.nextLong() / 2L * 2L + 1L;
335 long j1 = this.j.nextLong() / 2L * 2L + 1L;
336
337 this.j.setSeed((long) i * i1 + (long) j * j1 ^ this.p.getSeed());
338 double d0 = 0.25D;
339 int k1;
340 int l1;
341 int i2;
342
343 if (this.j.nextInt(4) == 0) {
344 k1 = k + this.j.nextInt(16) + 8;
345 l1 = this.j.nextInt(128);
346 i2 = l + this.j.nextInt(16) + 8;
347 (new WorldGenLakes(Block.STATIONARY_WATER.id)).a(this.p, this.j, k1, l1, i2);
348 }
349
350 if (this.j.nextInt(8) == 0) {
351 k1 = k + this.j.nextInt(16) + 8;
352 l1 = this.j.nextInt(this.j.nextInt(120) + 8);
353 i2 = l + this.j.nextInt(16) + 8;
354 if (l1 < 64 || this.j.nextInt(10) == 0) {
355 (new WorldGenLakes(Block.STATIONARY_LAVA.id)).a(this.p, this.j, k1, l1, i2);
356 }
357 }
358
359 int j2;
360
361 for (k1 = 0; k1 < 8; ++k1) {
362 l1 = k + this.j.nextInt(16) + 8;
363 i2 = this.j.nextInt(128);
364 j2 = l + this.j.nextInt(16) + 8;
365 (new WorldGenDungeons()).a(this.p, this.j, l1, i2, j2);
366 }
367
368 for (k1 = 0; k1 < 10; ++k1) {
369 l1 = k + this.j.nextInt(16);
370 i2 = this.j.nextInt(128);
371 j2 = l + this.j.nextInt(16);
372 (new WorldGenClay(32)).a(this.p, this.j, l1, i2, j2);
373 }
374
375 for (k1 = 0; k1 < 20; ++k1) {
376 l1 = k + this.j.nextInt(16);
377 i2 = this.j.nextInt(128);
378 j2 = l + this.j.nextInt(16);
379 (new WorldGenMinable(Block.DIRT.id, 32)).a(this.p, this.j, l1, i2, j2);
380 }
381
382 for (k1 = 0; k1 < 10; ++k1) {
383 l1 = k + this.j.nextInt(16);
384 i2 = this.j.nextInt(128);
385 j2 = l + this.j.nextInt(16);
386 (new WorldGenMinable(Block.GRAVEL.id, 32)).a(this.p, this.j, l1, i2, j2);
387 }
388
389 for (k1 = 0; k1 < 20; ++k1) {
390 l1 = k + this.j.nextInt(16);
391 i2 = this.j.nextInt(128);
392 j2 = l + this.j.nextInt(16);
393 (new WorldGenMinable(Block.COAL_ORE.id, 16)).a(this.p, this.j, l1, i2, j2);
394 }
395
396 for (k1 = 0; k1 < 20; ++k1) {
397 l1 = k + this.j.nextInt(16);
398 i2 = this.j.nextInt(64);
399 j2 = l + this.j.nextInt(16);
400 (new WorldGenMinable(Block.IRON_ORE.id, 8)).a(this.p, this.j, l1, i2, j2);
401 }
402
403 for (k1 = 0; k1 < 2; ++k1) {
404 l1 = k + this.j.nextInt(16);
405 i2 = this.j.nextInt(32);
406 j2 = l + this.j.nextInt(16);
407 (new WorldGenMinable(Block.GOLD_ORE.id, 8)).a(this.p, this.j, l1, i2, j2);
408 }
409
410 for (k1 = 0; k1 < 8; ++k1) {
411 l1 = k + this.j.nextInt(16);
412 i2 = this.j.nextInt(16);
413 j2 = l + this.j.nextInt(16);
414 (new WorldGenMinable(Block.REDSTONE_ORE.id, 7)).a(this.p, this.j, l1, i2, j2);
415 }
416
417 for (k1 = 0; k1 < 1; ++k1) {
418 l1 = k + this.j.nextInt(16);
419 i2 = this.j.nextInt(16);
420 j2 = l + this.j.nextInt(16);
421 (new WorldGenMinable(Block.DIAMOND_ORE.id, 7)).a(this.p, this.j, l1, i2, j2);
422 }
423
424 // uberbukkit
425 if (UberbukkitConfig.getInstance().getBoolean("worldgen.generate_lapis_ores", true)) {
426 for (k1 = 0; k1 < 1; ++k1) {
427 l1 = k + this.j.nextInt(16);
428 i2 = this.j.nextInt(16) + this.j.nextInt(16);
429 j2 = l + this.j.nextInt(16);
430 (new WorldGenMinable(Block.LAPIS_ORE.id, 6)).a(this.p, this.j, l1, i2, j2);
431 }
432 }
433
434 d0 = 0.5D;
435 k1 = (int) ((this.c.a((double) k * d0, (double) l * d0) / 8.0D + this.j.nextDouble() * 4.0D + 4.0D) / 3.0D);
436 l1 = 0;
437 if (this.j.nextInt(10) == 0) {
438 ++l1;
439 }
440
441 if (biomebase == BiomeBase.FOREST) {
442 l1 += k1 + 5;
443 }
444
445 if (biomebase == BiomeBase.RAINFOREST) {
446 l1 += k1 + 5;
447 }
448
449 if (biomebase == BiomeBase.SEASONAL_FOREST) {
450 l1 += k1 + 2;
451 }
452
453 if (biomebase == BiomeBase.TAIGA) {
454 l1 += k1 + 5;
455 }
456
457 if (biomebase == BiomeBase.DESERT) {
458 l1 -= 20;
459 }
460
461 if (biomebase == BiomeBase.TUNDRA) {
462 l1 -= 20;
463 }
464
465 if (biomebase == BiomeBase.PLAINS) {
466 l1 -= 20;
467 }
468
469 // uberbukkit
470 Object object = biomebase.a(this.j);
471 if (UberbukkitConfig.getInstance().getBoolean("worldgen.pre_b1_2_tree_generation", false)) {
472 object = new WorldGenTrees();
473 if (this.j.nextInt(10) == 0) {
474 object = new WorldGenBigTree();
475 }
476
477 if (biomebase == BiomeBase.RAINFOREST && this.j.nextInt(3) == 0) {
478 object = new WorldGenBigTree();
479 }
480 }
481
482 int k2;
483
484 for (i2 = 0; i2 < l1; ++i2) {
485 j2 = k + this.j.nextInt(16) + 8;
486 k2 = l + this.j.nextInt(16) + 8;
487 // uberbukkit
488 WorldGenerator worldgenerator = (WorldGenerator) object;
489
490 worldgenerator.a(1.0D, 1.0D, 1.0D);
491 worldgenerator.a(this.p, this.j, j2, this.p.getHighestBlockYAt(j2, k2), k2);
492 }
493
494 byte b0 = 0;
495
496 if (biomebase == BiomeBase.FOREST) {
497 b0 = 2;
498 }
499
500 if (biomebase == BiomeBase.SEASONAL_FOREST) {
501 b0 = 4;
502 }
503
504 if (biomebase == BiomeBase.TAIGA) {
505 b0 = 2;
506 }
507
508 if (biomebase == BiomeBase.PLAINS) {
509 b0 = 3;
510 }
511
512 int l2;
513 int i3;
514
515 for (j2 = 0; j2 < b0; ++j2) {
516 k2 = k + this.j.nextInt(16) + 8;
517 i3 = this.j.nextInt(128);
518 l2 = l + this.j.nextInt(16) + 8;
519 (new WorldGenFlowers(Block.YELLOW_FLOWER.id)).a(this.p, this.j, k2, i3, l2);
520 }
521
522 byte b1 = 0;
523
524 if (biomebase == BiomeBase.FOREST) {
525 b1 = 2;
526 }
527
528 if (biomebase == BiomeBase.RAINFOREST) {
529 b1 = 10;
530 }
531
532 if (biomebase == BiomeBase.SEASONAL_FOREST) {
533 b1 = 2;
534 }
535
536 if (biomebase == BiomeBase.TAIGA) {
537 b1 = 1;
538 }
539
540 if (biomebase == BiomeBase.PLAINS) {
541 b1 = 10;
542 }
543
544 int j3;
545 int k3;
546
547 // uberbukkit
548 if (UberbukkitConfig.getInstance().getBoolean("worldgen.generate_tallgrass", true)) {
549 for (k2 = 0; k2 < b1; ++k2) {
550 byte b2 = 1;
551
552 if (biomebase == BiomeBase.RAINFOREST && this.j.nextInt(3) != 0) {
553 b2 = 2;
554 }
555
556 l2 = k + this.j.nextInt(16) + 8;
557 k3 = this.j.nextInt(128);
558 j3 = l + this.j.nextInt(16) + 8;
559 (new WorldGenGrass(Block.LONG_GRASS.id, b2)).a(this.p, this.j, l2, k3, j3);
560 }
561 }
562
563 b1 = 0;
564 if (biomebase == BiomeBase.DESERT) {
565 b1 = 2;
566 }
567
568 // uberbukkit
569 if (UberbukkitConfig.getInstance().getBoolean("worldgen.generate_tallgrass", true)) {
570 for (k2 = 0; k2 < b1; ++k2) {
571 i3 = k + this.j.nextInt(16) + 8;
572 l2 = this.j.nextInt(128);
573 k3 = l + this.j.nextInt(16) + 8;
574 (new WorldGenDeadBush(Block.DEAD_BUSH.id)).a(this.p, this.j, i3, l2, k3);
575 }
576 }
577
578 if (this.j.nextInt(2) == 0) {
579 k2 = k + this.j.nextInt(16) + 8;
580 i3 = this.j.nextInt(128);
581 l2 = l + this.j.nextInt(16) + 8;
582 (new WorldGenFlowers(Block.RED_ROSE.id)).a(this.p, this.j, k2, i3, l2);
583 }
584
585 if (this.j.nextInt(4) == 0) {
586 k2 = k + this.j.nextInt(16) + 8;
587 i3 = this.j.nextInt(128);
588 l2 = l + this.j.nextInt(16) + 8;
589 (new WorldGenFlowers(Block.BROWN_MUSHROOM.id)).a(this.p, this.j, k2, i3, l2);
590 }
591
592 if (this.j.nextInt(8) == 0) {
593 k2 = k + this.j.nextInt(16) + 8;
594 i3 = this.j.nextInt(128);
595 l2 = l + this.j.nextInt(16) + 8;
596 (new WorldGenFlowers(Block.RED_MUSHROOM.id)).a(this.p, this.j, k2, i3, l2);
597 }
598
599 for (k2 = 0; k2 < 10; ++k2) {
600 i3 = k + this.j.nextInt(16) + 8;
601 l2 = this.j.nextInt(128);
602 k3 = l + this.j.nextInt(16) + 8;
603 (new WorldGenReed()).a(this.p, this.j, i3, l2, k3);
604 }
605
606 if (this.j.nextInt(32) == 0) {
607 k2 = k + this.j.nextInt(16) + 8;
608 i3 = this.j.nextInt(128);
609 l2 = l + this.j.nextInt(16) + 8;
610 (new WorldGenPumpkin()).a(this.p, this.j, k2, i3, l2);
611 }
612
613 k2 = 0;
614 if (biomebase == BiomeBase.DESERT) {
615 k2 += 10;
616 }
617
618 for (i3 = 0; i3 < k2; ++i3) {
619 l2 = k + this.j.nextInt(16) + 8;
620 k3 = this.j.nextInt(128);
621 j3 = l + this.j.nextInt(16) + 8;
622 (new WorldGenCactus()).a(this.p, this.j, l2, k3, j3);
623 }
624
625 for (i3 = 0; i3 < 50; ++i3) {
626 l2 = k + this.j.nextInt(16) + 8;
627 k3 = this.j.nextInt(this.j.nextInt(120) + 8);
628 j3 = l + this.j.nextInt(16) + 8;
629 (new WorldGenLiquids(Block.WATER.id)).a(this.p, this.j, l2, k3, j3);
630 }
631
632 for (i3 = 0; i3 < 20; ++i3) {
633 l2 = k + this.j.nextInt(16) + 8;
634 k3 = this.j.nextInt(this.j.nextInt(this.j.nextInt(112) + 8) + 8);
635 j3 = l + this.j.nextInt(16) + 8;
636 (new WorldGenLiquids(Block.LAVA.id)).a(this.p, this.j, l2, k3, j3);
637 }
638
639 this.w = this.p.getWorldChunkManager().a(this.w, k + 8, l + 8, 16, 16);
640
641 for (i3 = k + 8; i3 < k + 8 + 16; ++i3) {
642 for (l2 = l + 8; l2 < l + 8 + 16; ++l2) {
643 k3 = i3 - (k + 8);
644 j3 = l2 - (l + 8);
645 int l3 = this.p.e(i3, l2);
646 double d1 = this.w[k3 * 16 + j3] - (double) (l3 - 64) / 64.0D * 0.3D;
647
648 if (d1 < 0.5D && l3 > 0 && l3 < 128 && this.p.isEmpty(i3, l3, l2) && this.p.getMaterial(i3, l3 - 1, l2).isSolid() && this.p.getMaterial(i3, l3 - 1, l2) != Material.ICE) {
649 this.p.setTypeId(i3, l3, l2, Block.SNOW.id);
650 }
651 }
652 }
653
654 // uberbukkit
655 if (UberbukkitConfig.getInstance().getBoolean("worldgen.generate_steveco_chests", false)) {
656 k2 = k + this.j.nextInt(16) + 8;
657 l2 = this.j.nextInt(128);
658 i3 = l + this.j.nextInt(16) + 8;
659 if (this.p.getTypeId(k2, l2, i3) == 0 && this.p.p(k2, l2 - 1, i3)) {
660 System.out.println("added a chest!!");
661 this.p.setTypeId(k2, l2, i3, Block.LOCKED_CHEST.id);
662 }
663 }
664
665 BlockSand.instaFall = false;
666 }
667
668 public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate) {
669 return true;
670 }
671
672 public boolean unloadChunks() {
673 return false;
674 }
675
676 public boolean canSave() {
677 return true;
678 }
679}