summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure3.java
blob: 0af7443865529f87574fcf4c7b69b038f5de5b4f (plain)
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
/**
 * 
 */
package darkknight.jewelrycraft.worldGen;

import java.util.Random;

import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.tileentity.TileEntityMobSpawner;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
import net.minecraftforge.common.DungeonHooks;

/**
 * @author Sorin
 */
public class WorldGenStructure3 extends WorldGenStructure {
	@Override
	public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
		Block slab = Blocks.stone_slab;
		Block stair = Blocks.stone_brick_stairs;
		int slabMeta = 13;
		if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills) {
			stair = Blocks.sandstone_stairs;
			slabMeta = 9;
		}
		for (int i = -1; i <= 1; i++)
			for (int j = -1; j <= 2; j++)
				for (int k = -1; k <= 1; k++)
					world.setBlock(x + i, y + j, z + k, Blocks.air);
		for (int i = -1; i <= 1; i++)
			for (int k = -1; k <= 1; k++)
				world.setBlock(x + i, y - 1, z + k, slab, slabMeta, 1);
		for (int i = -1; i <= 1; i++)
			for (int k = -1; k <= 1; k++)
				world.setBlock(x + i, y, z + k, stair);
		for (int i = -1; i <= 1; i++)
			for (int k = -1; k <= 1; k++)
				world.setBlockMetadataWithNotify(x + i, y, z + k, (k == -1) ? 3 : (k == 0) ? (i == 1) ? 0 : 1 : 2, 2);
		for (int i = -1; i <= 1; i++)
			for (int k = -1; k <= 1; k++)
				world.setBlock(x + i, y + 1, z + k, stair);
		for (int i = -1; i <= 1; i++)
			for (int k = -1; k <= 1; k++)
				world.setBlockMetadataWithNotify(x + i, y + 1, z + k, (k == -1) ? 7 : (k == 0) ? (i == 1) ? 4 : 5 : 6,
						2);
		slabMeta = 5;
		if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills)
			slabMeta = 1;
		for (int i = -1; i <= 1; i++)
			for (int k = -1; k <= 1; k++)
				world.setBlock(x + i, y + 2, z + k, slab, slabMeta, 2);
		world.setBlock(x, y, z, Blocks.mob_spawner);
		world.setBlock(x, y + 1, z, Blocks.mob_spawner);
		for (int l = 0; l < 2; l++) {
			TileEntityMobSpawner tileentitymobspawner = (TileEntityMobSpawner) world.getTileEntity(x, y + l, z);
			if (tileentitymobspawner != null)
				tileentitymobspawner.func_145881_a().setEntityName(DungeonHooks.getRandomDungeonMob(rand));
			else
				System.err.println("Failed to fetch mob spawner entity at (" + x + ", " + (y + l) + ", " + z + ")");
		}
		return true;
	}

	@Override
	public boolean generate(World world, Random rand, int x, int y, int z) {
		return generate(world, BiomeGenBase.plains, rand, x, y, z);
	}

	@Override
	public boolean isUnderground() {
		return true;
	}

	@Override
	public int structureNo() {
		return 3;
	}
}