summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure3.java
blob: 5eafd03b98d439c1e465e17a061014977fadc5a6 (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
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
/**
 * 
 */
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;
	}
}