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
|
/**
*
*/
package darkknight.jewelrycraft.worldGen;
import java.util.Random;
import darkknight.jewelrycraft.block.BlockList;
import darkknight.jewelrycraft.item.ItemList;
import darkknight.jewelrycraft.random.WeightedRandomItem;
import darkknight.jewelrycraft.tileentity.TileEntityHandPedestal;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.util.WeightedRandom;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
/**
* @author Sorin
*/
public class WorldGenStructure1 extends WorldGenStructure {
public static final WeightedRandomItem[] items = new WeightedRandomItem[] {
new WeightedRandomItem(new ItemStack(
ItemList.thiefGloves), 10),
new WeightedRandomItem(
new ItemStack(Items.golden_apple),
8),
new WeightedRandomItem(new ItemStack(
Items.golden_apple, 1, 1), 1),
new WeightedRandomItem(
new ItemStack(ItemList.guide), 20),
new WeightedRandomItem(new ItemStack(
ItemList.shadowIngot), 25),
new WeightedRandomItem(
new ItemStack(BlockList.shadowEye),
2),
new WeightedRandomItem(
new ItemStack(Items.nether_star),
1),
new WeightedRandomItem(new ItemStack(
BlockList.shadowBlock), 2),
new WeightedRandomItem(
new ItemStack(BlockList.crystal),
16, 20)
};
@Override
public boolean generate(World world, BiomeGenBase biome,
Random rand, int x, int y, int z) {
Block block = Blocks.stonebrick;
int metadata = 0, slabMeta = 5;
if (biome == BiomeGenBase.desert
|| biome == BiomeGenBase.desertHills) {
block = Blocks.sandstone;
metadata = 2;
slabMeta = 1;
}
for (int i = -2; i <= 2; i++)
for (int j = -1; j <= 4; j++)
for (int k = -2; k <= 2; k++)
world.setBlock(x + i, y + j, z + k,
Blocks.air);
for (int i = -2; i <= 2; i++)
for (int k = -2; k <= 2; k++) {
world.setBlock(x + i, y - 1, z + k, block,
metadata, 2);
if (i % 2 == 0 && k % 2 == 0 && i != 0
&& k != 0)
world.setBlock(x + i, y, z + k,
BlockList.crystal);
}
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
world.setBlock(x + i, y, z + k,
Blocks.stone_slab,
slabMeta, 2);
world.setBlock(x, y, z, block, metadata, 2);
world.setBlock(x, y + 1, z, BlockList.handPedestal, 6, 2);
TileEntityHandPedestal pedestal = (TileEntityHandPedestal) world
.getTileEntity(x, y + 1, z);
pedestal.setHeldItemStack(
((WeightedRandomItem) WeightedRandom
.getRandomItem(rand,
items)).getItem(rand));
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 int structureNo() {
return 1;
}
}
|