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
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
/**
*
*/
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 darkknight.jewelrycraft.tileentity.TileEntityJewelrsCraftingTable;
import darkknight.jewelrycraft.util.JewelryNBT;
import darkknight.jewelrycraft.util.JewelrycraftUtil;
import net.minecraft.block.Block;
import net.minecraft.block.BlockSkull;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntitySkull;
import net.minecraft.util.MathHelper;
import net.minecraft.util.WeightedRandom;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
/**
* @author Sorin
*/
public class WorldGenStructure6 extends WorldGenStructure {
@Override
public boolean generate(World world, BiomeGenBase biome,
Random rand, int x, int y, int z) {
int randBlock, randBlockMeta;
Block block;
for (int i = -2; i <= 1; i++)
for (int j = -1; j <= 1; j++)
for (int k = -2; k <= 1; k++)
world.setBlock(x + i, y + j, z + k,
Blocks.air);
for (int i = -2; i <= 1; i++)
for (int k = -2; k <= 1; k++) {
randBlock = rand.nextInt(4);
switch (randBlock) {
case 0:
block = Blocks.cobblestone;
randBlockMeta = 0;
break;
case 1:
block = Blocks.stonebrick;
randBlockMeta = 2;
break;
case 2:
block = Blocks.stonebrick;
randBlockMeta = 0;
break;
default:
block = Blocks.cobblestone;
randBlockMeta = 0;
break;
}
world.setBlock(x + i, y - 1, z + k, block,
randBlockMeta, 2);
}
int crystalCol = rand.nextInt(15);
world.setBlock(x - 2, y, z - 2, BlockList.crystal, 0, 2);
world.setBlock(x - 2, y, z + 1, BlockList.crystal,
1 + crystalCol, 2);
world.setBlock(x + 1, y, z - 2, BlockList.crystal,
1 + crystalCol, 2);
world.setBlock(x + 1, y, z + 1, BlockList.crystal, 0, 2);
world.setBlock(x - 1, y, z - 1, Blocks.skull, 1, 2);
TileEntity tileentity = world.getTileEntity(x - 1, y,
z - 1);
if (tileentity != null
&& tileentity instanceof TileEntitySkull) {
((TileEntitySkull) tileentity).func_152107_a(
rand.nextInt(50) == 0 ? 1 : 0);
((TileEntitySkull) tileentity).func_145903_a(
MathHelper.floor_double(
(double) (rand.nextInt(
361)
* 16.0F
/ 360.0F)
+ 0.5D)
& 15);
((BlockSkull) Blocks.skull).func_149965_a(world,
x - 1, y, z - 1,
(TileEntitySkull) tileentity);
}
world.setBlock(x + 1, y, z - 1,
BlockList.jewelCraftingTable, 3, 2);
TileEntity jewelersTable = world.getTileEntity(x + 1, y,
z - 1);
Item[] jewelry = new Item[] {
ItemList.ring, ItemList.necklace,
ItemList.bracelet, ItemList.earrings
};
if (jewelersTable != null
&& jewelersTable instanceof TileEntityJewelrsCraftingTable) {
if (rand.nextBoolean())
((TileEntityJewelrsCraftingTable) jewelersTable)
.setGemItemStack(
JewelrycraftUtil.gem
.get(rand.nextInt(
JewelrycraftUtil.gem
.size())));
else if (rand.nextBoolean()) {
ItemStack result = new ItemStack(
jewelry[rand.nextInt(4)],
1, 0);
if (JewelrycraftUtil.metal.size() > 0)
JewelryNBT.addMetal(result,
JewelrycraftUtil.metal
.get(rand.nextInt(
JewelrycraftUtil.metal
.size())));
((TileEntityJewelrsCraftingTable) jewelersTable)
.setJewelryItemStack(
result);
}
}
world.setBlock(x - 1, y, z + 1, BlockList.handPedestal, 0,
2);
TileEntity pedestal = world.getTileEntity(x - 1, y, z + 1);
if (pedestal != null
&& pedestal instanceof TileEntityHandPedestal)
((TileEntityHandPedestal) pedestal)
.setHeldItemStack(
((WeightedRandomItem) WeightedRandom
.getRandomItem(rand,
WorldGenStructure1.items))
.getItem(rand));
world.setBlock(x - 1, y + 1, z + 1, BlockList.shadowEye, 0,
2);
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 6;
}
}
|