initial commit
This commit is contained in:
parent
3c9ee26b06
commit
22186c33b9
1458 changed files with 282792 additions and 0 deletions
38
java/src/game/worldgen/GeneratorDestroyed.java
Executable file
38
java/src/game/worldgen/GeneratorDestroyed.java
Executable file
|
@ -0,0 +1,38 @@
|
|||
package game.worldgen;
|
||||
|
||||
import game.init.Blocks;
|
||||
import game.rng.Random;
|
||||
import game.world.State;
|
||||
import game.world.WorldServer;
|
||||
|
||||
public class GeneratorDestroyed implements ChunkGenerator
|
||||
{
|
||||
private final State block = Blocks.coal_block.getState();
|
||||
private final State alt = Blocks.soul_sand.getState();
|
||||
private final State gap = Blocks.air.getState();
|
||||
private final State liquid = Blocks.lava.getState();
|
||||
private final State top = Blocks.obsidian.getState();
|
||||
private final int height;
|
||||
private final Random rand = new Random(); // NON-DETERMINISTIC!!
|
||||
|
||||
public GeneratorDestroyed(int height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public int getMaximumHeight() {
|
||||
return this.height;
|
||||
}
|
||||
|
||||
public void generateChunk(WorldServer world, int x, int z, ChunkPrimer primer)
|
||||
{
|
||||
for(int by = 0; by < this.height; ++by) {
|
||||
for(int bx = 0; bx < 16; ++bx) {
|
||||
for(int bz = 0; bz < 16; ++bz) {
|
||||
primer.set(bx, by, bz, by >= this.height - this.rand.zrange(3) ? this.gap :
|
||||
(by == this.height - 1 ? this.top : this.rand.chance(this.block, (by == this.height - 3 ?
|
||||
this.liquid : this.alt), 15)));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue