summaryrefslogtreecommitdiff
path: root/src/main/java/jp/plusplus/fbs/world/structure/StructureSealedLibStart.java
blob: 403f78859f2bac0915657bb062aeb315b00ee5c5 (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
package jp.plusplus.fbs.world.structure;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraft.world.gen.structure.StructureStart;

import java.util.Random;

/**
 * Createdby pluslus_Fon 2015/06/06.
 */
public class StructureSealedLibStart extends StructureStart {

    public StructureSealedLibStart() {}

    public StructureSealedLibStart(World par1World, Random par2Random, int par3, int par4) {
        super(par3, par4);
        // 構造物の構成パーツを決定する

        //decides Position
        int x=par3*16+2,y,z=par4*16+2;
        /*
        int sy=0, sym=8*par2Random.nextInt(4);
        Block b2;
        do{
            sy+=8;
            b2=par1World.getBlock(x,12+sy,z);
        }while(b2.getMaterial() != Material.water && b2.getMaterial() !=Material.lava && b2.getMaterial()!=Material.air && sy<sym);

        y=12+sy-8;
        */

        y=par1World.getChunkHeightMapMinimum(x, z)-10-12;
        if(y<0) y=10;
        else y=12+par2Random.nextInt(Math.min(y, 50));

        //y=100;
        StructureSealedLib1 ssl1 = new StructureSealedLib1(0, par2Random, x,y,z);
        this.components.add(ssl1);

        // 次のパーツを得る
        ssl1.buildComponent(ssl1, components, par2Random);

        // 構造物全体の占有範囲を更新する
        this.updateBoundingBox();
    }
}