-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChunkProviderHell.java
More file actions
422 lines (391 loc) · 15.3 KB
/
ChunkProviderHell.java
File metadata and controls
422 lines (391 loc) · 15.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
package net.minecraft.src;
// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) braces deadcode
import java.util.Random;
public class ChunkProviderHell
implements IChunkProvider
{
public ChunkProviderHell(World world, long l)
{
field_4162_p = new double[256];
field_4161_q = new double[256];
field_4160_r = new double[256];
field_4159_s = new MapGenCavesHell();
field_4164_n = world;
hellRNG = new Random(l);
field_4169_i = new NoiseGeneratorOctaves(hellRNG, 16);
field_4168_j = new NoiseGeneratorOctaves(hellRNG, 16);
field_4167_k = new NoiseGeneratorOctaves(hellRNG, 8);
field_4166_l = new NoiseGeneratorOctaves(hellRNG, 4);
field_4165_m = new NoiseGeneratorOctaves(hellRNG, 4);
field_4177_a = new NoiseGeneratorOctaves(hellRNG, 10);
field_4176_b = new NoiseGeneratorOctaves(hellRNG, 16);
}
public void func_4059_a(int i, int j, byte abyte0[])
{
byte byte0 = 4;
byte byte1 = 32;
int k = byte0 + 1;
byte byte2 = 17;
int l = byte0 + 1;
field_4163_o = func_4057_a(field_4163_o, i * byte0, 0, j * byte0, k, byte2, l);
for(int i1 = 0; i1 < byte0; i1++)
{
for(int j1 = 0; j1 < byte0; j1++)
{
for(int k1 = 0; k1 < 16; k1++)
{
double d = 0.125D;
double d1 = field_4163_o[((i1 + 0) * l + (j1 + 0)) * byte2 + (k1 + 0)];
double d2 = field_4163_o[((i1 + 0) * l + (j1 + 1)) * byte2 + (k1 + 0)];
double d3 = field_4163_o[((i1 + 1) * l + (j1 + 0)) * byte2 + (k1 + 0)];
double d4 = field_4163_o[((i1 + 1) * l + (j1 + 1)) * byte2 + (k1 + 0)];
double d5 = (field_4163_o[((i1 + 0) * l + (j1 + 0)) * byte2 + (k1 + 1)] - d1) * d;
double d6 = (field_4163_o[((i1 + 0) * l + (j1 + 1)) * byte2 + (k1 + 1)] - d2) * d;
double d7 = (field_4163_o[((i1 + 1) * l + (j1 + 0)) * byte2 + (k1 + 1)] - d3) * d;
double d8 = (field_4163_o[((i1 + 1) * l + (j1 + 1)) * byte2 + (k1 + 1)] - d4) * d;
for(int l1 = 0; l1 < 8; l1++)
{
double d9 = 0.25D;
double d10 = d1;
double d11 = d2;
double d12 = (d3 - d1) * d9;
double d13 = (d4 - d2) * d9;
for(int i2 = 0; i2 < 4; i2++)
{
int j2 = i2 + i1 * 4 << 11 | 0 + j1 * 4 << 7 | k1 * 8 + l1;
char c = '\200';
double d14 = 0.25D;
double d15 = d10;
double d16 = (d11 - d10) * d14;
for(int k2 = 0; k2 < 4; k2++)
{
int l2 = 0;
if(k1 * 8 + l1 < byte1)
{
l2 = Block.lavaMoving.blockID;
}
if(d15 > 0.0D)
{
l2 = Block.bloodStone.blockID;
}
abyte0[j2] = (byte)l2;
j2 += c;
d15 += d16;
}
d10 += d12;
d11 += d13;
}
d1 += d5;
d2 += d6;
d3 += d7;
d4 += d8;
}
}
}
}
}
public void func_4058_b(int i, int j, byte abyte0[])
{
byte byte0 = 64;
double d = 0.03125D;
field_4162_p = field_4166_l.generateNoiseOctaves(field_4162_p, i * 16, j * 16, 0.0D, 16, 16, 1, d, d, 1.0D);
field_4161_q = field_4166_l.generateNoiseOctaves(field_4161_q, i * 16, 109.0134D, j * 16, 16, 1, 16, d, 1.0D, d);
field_4160_r = field_4165_m.generateNoiseOctaves(field_4160_r, i * 16, j * 16, 0.0D, 16, 16, 1, d * 2D, d * 2D, d * 2D);
for(int k = 0; k < 16; k++)
{
for(int l = 0; l < 16; l++)
{
boolean flag = field_4162_p[k + l * 16] + hellRNG.nextDouble() * 0.20000000000000001D > 0.0D;
boolean flag1 = field_4161_q[k + l * 16] + hellRNG.nextDouble() * 0.20000000000000001D > 0.0D;
int i1 = (int)(field_4160_r[k + l * 16] / 3D + 3D + hellRNG.nextDouble() * 0.25D);
int j1 = -1;
byte byte1 = (byte)Block.bloodStone.blockID;
byte byte2 = (byte)Block.bloodStone.blockID;
for(int k1 = 127; k1 >= 0; k1--)
{
int l1 = (l * 16 + k) * 128 + k1;
if(k1 >= 127 - hellRNG.nextInt(5))
{
abyte0[l1] = (byte)Block.bedrock.blockID;
continue;
}
if(k1 <= 0 + hellRNG.nextInt(5))
{
abyte0[l1] = (byte)Block.bedrock.blockID;
continue;
}
byte byte3 = abyte0[l1];
if(byte3 == 0)
{
j1 = -1;
continue;
}
if(byte3 != Block.bloodStone.blockID)
{
continue;
}
if(j1 == -1)
{
if(i1 <= 0)
{
byte1 = 0;
byte2 = (byte)Block.bloodStone.blockID;
} else
if(k1 >= byte0 - 4 && k1 <= byte0 + 1)
{
byte1 = (byte)Block.bloodStone.blockID;
byte2 = (byte)Block.bloodStone.blockID;
if(flag1)
{
byte1 = (byte)Block.gravel.blockID;
}
if(flag1)
{
byte2 = (byte)Block.bloodStone.blockID;
}
if(flag)
{
byte1 = (byte)Block.slowSand.blockID;
}
if(flag)
{
byte2 = (byte)Block.slowSand.blockID;
}
}
if(k1 < byte0 && byte1 == 0)
{
byte1 = (byte)Block.lavaMoving.blockID;
}
j1 = i1;
if(k1 >= byte0 - 1)
{
abyte0[l1] = byte1;
} else
{
abyte0[l1] = byte2;
}
continue;
}
if(j1 > 0)
{
j1--;
abyte0[l1] = byte2;
}
}
}
}
}
public Chunk provideChunk(int i, int j)
{
hellRNG.setSeed((long)i * 0x4f9939f508L + (long)j * 0x1ef1565bd5L);
byte abyte0[] = new byte[32768];
func_4059_a(i, j, abyte0);
func_4058_b(i, j, abyte0);
field_4159_s.func_867_a(this, field_4164_n, i, j, abyte0);
Chunk chunk = new Chunk(field_4164_n, abyte0, i, j);
return chunk;
}
private double[] func_4057_a(double ad[], int i, int j, int k, int l, int i1, int j1)
{
if(ad == null)
{
ad = new double[l * i1 * j1];
}
double d = 684.41200000000003D;
double d1 = 2053.2359999999999D;
field_4172_f = field_4177_a.generateNoiseOctaves(field_4172_f, i, j, k, l, 1, j1, 1.0D, 0.0D, 1.0D);
field_4171_g = field_4176_b.generateNoiseOctaves(field_4171_g, i, j, k, l, 1, j1, 100D, 0.0D, 100D);
field_4175_c = field_4167_k.generateNoiseOctaves(field_4175_c, i, j, k, l, i1, j1, d / 80D, d1 / 60D, d / 80D);
field_4174_d = field_4169_i.generateNoiseOctaves(field_4174_d, i, j, k, l, i1, j1, d, d1, d);
field_4173_e = field_4168_j.generateNoiseOctaves(field_4173_e, i, j, k, l, i1, j1, d, d1, d);
int k1 = 0;
int l1 = 0;
double ad1[] = new double[i1];
for(int i2 = 0; i2 < i1; i2++)
{
ad1[i2] = Math.cos(((double)i2 * 3.1415926535897931D * 6D) / (double)i1) * 2D;
double d2 = i2;
if(i2 > i1 / 2)
{
d2 = i1 - 1 - i2;
}
if(d2 < 4D)
{
d2 = 4D - d2;
ad1[i2] -= d2 * d2 * d2 * 10D;
}
}
for(int j2 = 0; j2 < l; j2++)
{
for(int k2 = 0; k2 < j1; k2++)
{
double d3 = (field_4172_f[l1] + 256D) / 512D;
if(d3 > 1.0D)
{
d3 = 1.0D;
}
double d4 = 0.0D;
double d5 = field_4171_g[l1] / 8000D;
if(d5 < 0.0D)
{
d5 = -d5;
}
d5 = d5 * 3D - 3D;
if(d5 < 0.0D)
{
d5 /= 2D;
if(d5 < -1D)
{
d5 = -1D;
}
d5 /= 1.3999999999999999D;
d5 /= 2D;
d3 = 0.0D;
} else
{
if(d5 > 1.0D)
{
d5 = 1.0D;
}
d5 /= 6D;
}
d3 += 0.5D;
d5 = (d5 * (double)i1) / 16D;
l1++;
for(int l2 = 0; l2 < i1; l2++)
{
double d6 = 0.0D;
double d7 = ad1[l2];
double d8 = field_4174_d[k1] / 512D;
double d9 = field_4173_e[k1] / 512D;
double d10 = (field_4175_c[k1] / 10D + 1.0D) / 2D;
if(d10 < 0.0D)
{
d6 = d8;
} else
if(d10 > 1.0D)
{
d6 = d9;
} else
{
d6 = d8 + (d9 - d8) * d10;
}
d6 -= d7;
if(l2 > i1 - 4)
{
double d11 = (float)(l2 - (i1 - 4)) / 3F;
d6 = d6 * (1.0D - d11) + -10D * d11;
}
if((double)l2 < d4)
{
double d12 = (d4 - (double)l2) / 4D;
if(d12 < 0.0D)
{
d12 = 0.0D;
}
if(d12 > 1.0D)
{
d12 = 1.0D;
}
d6 = d6 * (1.0D - d12) + -10D * d12;
}
ad[k1] = d6;
k1++;
}
}
}
return ad;
}
public boolean chunkExists(int i, int j)
{
return true;
}
public void populate(IChunkProvider ichunkprovider, int i, int j)
{
BlockSand.fallInstantly = true;
int k = i * 16;
int l = j * 16;
for(int i1 = 0; i1 < 8; i1++)
{
int k1 = k + hellRNG.nextInt(16) + 8;
int i3 = hellRNG.nextInt(120) + 4;
int k4 = l + hellRNG.nextInt(16) + 8;
(new WorldGenHellLava(Block.lavaStill.blockID)).generate(field_4164_n, hellRNG, k1, i3, k4);
}
int j1 = hellRNG.nextInt(hellRNG.nextInt(10) + 1) + 1;
for(int l1 = 0; l1 < j1; l1++)
{
int j3 = k + hellRNG.nextInt(16) + 8;
int l4 = hellRNG.nextInt(120) + 4;
int i6 = l + hellRNG.nextInt(16) + 8;
(new WorldGenFire()).generate(field_4164_n, hellRNG, j3, l4, i6);
}
j1 = hellRNG.nextInt(hellRNG.nextInt(10) + 1);
for(int i2 = 0; i2 < j1; i2++)
{
int k3 = k + hellRNG.nextInt(16) + 8;
int i5 = hellRNG.nextInt(120) + 4;
int j6 = l + hellRNG.nextInt(16) + 8;
(new WorldGenLightStone1()).generate(field_4164_n, hellRNG, k3, i5, j6);
}
for(int j2 = 0; j2 < 10; j2++)
{
int l3 = k + hellRNG.nextInt(16) + 8;
int j5 = hellRNG.nextInt(128);
int k6 = l + hellRNG.nextInt(16) + 8;
(new WorldGenLightStone2()).generate(field_4164_n, hellRNG, l3, j5, k6);
}
if(hellRNG.nextInt(1) == 0)
{
int k2 = k + hellRNG.nextInt(16) + 8;
int i4 = hellRNG.nextInt(128);
int k5 = l + hellRNG.nextInt(16) + 8;
(new WorldGenFlowers(Block.mushroomBrown.blockID)).generate(field_4164_n, hellRNG, k2, i4, k5);
}
if(hellRNG.nextInt(1) == 0)
{
int l2 = k + hellRNG.nextInt(16) + 8;
int j4 = hellRNG.nextInt(128);
int l5 = l + hellRNG.nextInt(16) + 8;
(new WorldGenFlowers(Block.mushroomRed.blockID)).generate(field_4164_n, hellRNG, l2, j4, l5);
}
BlockSand.fallInstantly = false;
}
public boolean saveChunks(boolean flag, IProgressUpdate iprogressupdate)
{
return true;
}
public boolean func_532_a()
{
return false;
}
public boolean func_536_b()
{
return true;
}
public String toString()
{
return "HellRandomLevelSource";
}
private Random hellRNG;
private NoiseGeneratorOctaves field_4169_i;
private NoiseGeneratorOctaves field_4168_j;
private NoiseGeneratorOctaves field_4167_k;
private NoiseGeneratorOctaves field_4166_l;
private NoiseGeneratorOctaves field_4165_m;
public NoiseGeneratorOctaves field_4177_a;
public NoiseGeneratorOctaves field_4176_b;
private World field_4164_n;
private double field_4163_o[];
private double field_4162_p[];
private double field_4161_q[];
private double field_4160_r[];
private MapGenBase field_4159_s;
double field_4175_c[];
double field_4174_d[];
double field_4173_e[];
double field_4172_f[];
double field_4171_g[];
}