summaryrefslogtreecommitdiff
path: root/src/main/java/darkknight/jewelrycraft/worldGen/WorldGenStructure5.java
blob: 16782af86df66980f582b6315a892a00f00ec952 (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
110
111
112
113
114
115
116
117
118
/**
 * 
 */
package darkknight.jewelrycraft.worldGen;

import java.util.Random;

import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.block.BlockMoltenMetal;
import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.util.JewelryNBT;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;

/**
 * @author Sorin
 */
public class WorldGenStructure5 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;
		Block block = Blocks.stonebrick;
		int metadata = 0, slabMeta = 5;
		if (biome == BiomeGenBase.desert
				|| biome == BiomeGenBase.desertHills) {
			stair = Blocks.sandstone_stairs;
			block = Blocks.sandstone;
			metadata = 2;
			slabMeta = 1;
		}
		for (int i = -2; i <= 2; i++)
			for (int j = 0; j <= 3; j++)
				for (int k = -3; k <= -1; k++)
					world.setBlock(x + i, y + j, z + k,
							Blocks.air);
		for (int i = -5; i <= -3; i++)
			for (int k = -3; k <= 2; k++)
				world.setBlock(x + i, y, z + k,
						Blocks.air);
		for (int i = -2; i <= 2; i++)
			for (int k = -3; k <= -1; k++)
				world.setBlock(x + i, y, z + k, block,
						metadata, 2);
		for (int i = 1; i <= 2; i++)
			for (int k = -3; k <= -1; k++)
				world.setBlock(x + i, y + 1, z + k, block,
						metadata, 2);
		for (int i = -5; i <= -3; i++)
			for (int k = -3; k <= 2; k++)
				world.setBlock(x + i, y - 1, z + k, block,
						metadata, 2);
		for (int i = -5; i <= -3; i++)
			for (int k = -3; k <= 2; k++)
				if ((i != -4 || k <= -3 || k >= 2)
						&& !(i == -3 && k == -2))
					world.setBlock(x + i, y, z + k,
							slab, slabMeta, 2);
		world.setBlock(x - 3, y, z - 1, stair, 0, 2);
		world.setBlock(x - 3, y, z - 3, stair, 0, 2);
		world.setBlock(x - 2, y + 1, z - 3, slab, slabMeta, 2);
		world.setBlock(x - 2, y + 1, z - 1, slab, slabMeta, 2);
		world.setBlock(x - 1, y + 1, z - 3, slab, slabMeta, 2);
		world.setBlock(x - 1, y + 1, z - 1, slab, slabMeta, 2);
		world.setBlock(x, y + 1, z - 1, stair, 0, 2);
		world.setBlock(x, y + 1, z - 3, stair, 0, 2);
		world.setBlock(x + 1, y + 2, z - 3, slab, slabMeta, 2);
		world.setBlock(x + 1, y + 2, z - 1, slab, slabMeta, 2);
		for (int k = -3; k <= -1; k++)
			world.setBlock(x + 2, y + 2, z + k, block,
					metadata, 2);
		if (rand.nextInt(5) == 0) {
			ItemStack stack = new ItemStack(ItemList.bucket);
			JewelryNBT.addMetal(stack,
					new ItemStack(Items.gold_ingot));
			if (stack != null && JewelryNBT
					.ingot(stack) != null) {
				if (!world.isRemote)
					world.func_147480_a(x, y, z, true);
				world.setBlock(x + 1, y + 2, z - 2,
						BlockList.moltenMetal, 0,
						3);
				if (BlockMoltenMetal.getTileEntity(world,
						x + 1, y + 2,
						z - 2) != null)
					BlockMoltenMetal.getTileEntity(
							world, x + 1,
							y + 2, z - 2)
							.setMetal(JewelryNBT
									.ingot(stack));
			}
		} else
			world.setBlock(x + 1, y + 2, z - 2, Blocks.water,
					0, 3);
		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 5;
	}
}