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
|
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 darkknight.jewelrycraft.util.JewelrycraftUtil;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase;
/**
* @author Sorin
*/
public class WorldGenStructure2 extends WorldGenStructure {
@Override
public boolean generate(World world, BiomeGenBase biome, Random rand, int x, int y, int z) {
Block block = Blocks.stonebrick;
Block stair = Blocks.stone_brick_stairs;
int metadata = 0;
if (biome == BiomeGenBase.desert || biome == BiomeGenBase.desertHills) {
block = Blocks.sandstone;
stair = Blocks.sandstone_stairs;
metadata = 2;
}
for (int i = -1; i <= 1; i++)
for (int k = -1; k <= 1; k++)
world.setBlock(x + i, y, 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, block, metadata, 2);
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);
world.setBlock(x, y, z, Blocks.air);
ItemStack stack = new ItemStack(ItemList.bucket);
if (JewelrycraftUtil.metal.size() > 0) {
JewelryNBT.addMetal(stack, JewelrycraftUtil.metal.get(rand.nextInt(JewelrycraftUtil.metal.size())));
}
if (stack != null && JewelryNBT.ingot(stack) != null) {
if (!world.isRemote)
world.func_147480_a(x, y, z, true);
world.setBlock(x, y, z, BlockList.moltenMetal, 0, 3);
if (BlockMoltenMetal.getTileEntity(world, x, y, z) != null)
BlockMoltenMetal.getTileEntity(world, x, y, z).setMetal(JewelryNBT.ingot(stack));
}
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 2;
}
}
|